##// END OF EJS Templates
Clarify copyright and license of Migrate
Clarify copyright and license of Migrate

File last commit:

r4116:ffd45b18 rhodecode-2.2.5-gpl
r4136:c558221c rhodecode-2.2.5-gpl
Show More
forms.py
518 lines | 20.9 KiB | text/x-python | PythonLexer
Bradley M. Kuhn
Imported some of the GPLv3'd changes from RhodeCode v2.2.5....
r4116 # -*- coding: utf-8 -*-
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
this is forms validation classes
renamed project to rhodecode
r547 http://formencode.org/module-formencode.validators.html
for list off all availible validators
we can create our own validators
The table below outlines the options which can be used in a schema in addition to the validators themselves
pre_validators [] These validators will be applied before the schema
chained_validators [] These validators will be applied after the schema
allow_extra_fields False If True, then it is not an error when keys that aren't associated with a validator are present
filter_extra_fields False If True, then keys that aren't associated with a validator are removed
if_key_missing NoDefault If this is given, then any keys that aren't available but are expected will be replaced with this value (and then validated). This does not override a present .if_missing attribute on validators. NoDefault is a special FormEncode class to mean that no default values has been specified and therefore missing keys shouldn't take a default value.
source code cleanup: remove trailing white space, normalize file endings
r1203 ignore_key_missing False If True, then missing keys will be missing in the result, if the validator doesn't have .if_missing on it already
renamed project to rhodecode
r547 <name> = formencode.validators.<name of validator>
<name> must equal form name
list=[1,2,3,4,5]
for SELECT use formencode.All(OneOf(list), Int())
source code cleanup: remove trailing white space, normalize file endings
r1203
renamed project to rhodecode
r547 """
ldap auth rewrite, moved split authfunc into two functions,...
r761 import logging
import formencode
renamed project to rhodecode
r547 from formencode import All
ldap auth rewrite, moved split authfunc into two functions,...
r761
renamed project to rhodecode
r547 from pylons.i18n.translation import _
ldap auth rewrite, moved split authfunc into two functions,...
r761
Bradley M. Kuhn
Imported some of the GPLv3'd changes from RhodeCode v2.2.5....
r4116 from rhodecode import BACKENDS
Switched forms to new validators
r2467 from rhodecode.model import validators as v
ldap auth rewrite, moved split authfunc into two functions,...
r761
renamed project to rhodecode
r547 log = logging.getLogger(__name__)
added validation to repo groups to check for conflicting repository name fixes #337
r1898
renamed project to rhodecode
r547 class LoginForm(formencode.Schema):
allow_extra_fields = True
filter_extra_fields = True
Switched forms to new validators
r2467 username = v.UnicodeString(
#344 optional firstname lastname on user creation...
r1950 strip=True,
min=1,
not_empty=True,
messages={
Switched forms to new validators
r2467 'empty': _(u'Please enter a login'),
'tooShort': _(u'Enter a value %(min)i characters long or more')}
#344 optional firstname lastname on user creation...
r1950 )
renamed project to rhodecode
r547
Switched forms to new validators
r2467 password = v.UnicodeString(
#419 don't strip passwords for login forms, make rhodecode more compatible with LDAP servers
r2181 strip=False,
#344 optional firstname lastname on user creation...
r1950 min=3,
not_empty=True,
messages={
Switched forms to new validators
r2467 'empty': _(u'Please enter a password'),
'tooShort': _(u'Enter %(min)i characters or more')}
#344 optional firstname lastname on user creation...
r1950 )
renamed project to rhodecode
r547
Switched forms to new validators
r2467 remember = v.StringBoolean(if_missing=False)
auto white-space removal
r1818
Switched forms to new validators
r2467 chained_validators = [v.ValidAuth()]
Code refactoring,models renames...
r629
added validation to repo groups to check for conflicting repository name fixes #337
r1898
Bradley M. Kuhn
Imported some of the GPLv3'd changes from RhodeCode v2.2.5....
r4116 def PasswordChangeForm(username):
class _PasswordChangeForm(formencode.Schema):
allow_extra_fields = True
filter_extra_fields = True
current_password = v.ValidOldPassword(username)(not_empty=True)
new_password = All(v.ValidPassword(), v.UnicodeString(strip=False, min=6))
new_password_confirmation = All(v.ValidPassword(), v.UnicodeString(strip=False, min=6))
chained_validators = [v.ValidPasswordsMatch('new_password',
'new_password_confirmation')]
return _PasswordChangeForm
renamed project to rhodecode
r547 def UserForm(edit=False, old_data={}):
class _UserForm(formencode.Schema):
allow_extra_fields = True
filter_extra_fields = True
Switched forms to new validators
r2467 username = All(v.UnicodeString(strip=True, min=1, not_empty=True),
v.ValidUsername(edit, old_data))
renamed project to rhodecode
r547 if edit:
Switched forms to new validators
r2467 new_password = All(
Renamed name to firstname in forms...
r2544 v.ValidPassword(),
Switched forms to new validators
r2467 v.UnicodeString(strip=False, min=6, not_empty=False)
)
password_confirmation = All(
v.ValidPassword(),
v.UnicodeString(strip=False, min=6, not_empty=False),
)
admin = v.StringBoolean(if_missing=False)
renamed project to rhodecode
r547 else:
Switched forms to new validators
r2467 password = All(
v.ValidPassword(),
v.UnicodeString(strip=False, min=6, not_empty=True)
)
password_confirmation = All(
v.ValidPassword(),
v.UnicodeString(strip=False, min=6, not_empty=False)
)
#235 forking page repo group selection...
r1722
Switched forms to new validators
r2467 active = v.StringBoolean(if_missing=False)
Renamed name to firstname in forms...
r2544 firstname = v.UnicodeString(strip=True, min=1, not_empty=False)
Switched forms to new validators
r2467 lastname = v.UnicodeString(strip=True, min=1, not_empty=False)
email = All(v.Email(not_empty=True), v.UniqSystemEmail(old_data))
Bradley M. Kuhn
Imported some of the GPLv3'd changes from RhodeCode v2.2.5....
r4116 extern_name = v.UnicodeString(strip=True)
extern_type = v.UnicodeString(strip=True)
Switched forms to new validators
r2467 chained_validators = [v.ValidPasswordsMatch()]
renamed project to rhodecode
r547 return _UserForm
#56 fixed found bugs, implemented adding of new group + forms+validators...
r959
Mads Kiilerich
further cleanup of UsersGroup...
r3417 def UserGroupForm(edit=False, old_data={}, available_members=[]):
class _UserGroupForm(formencode.Schema):
#56 fixed found bugs, implemented adding of new group + forms+validators...
r959 allow_extra_fields = True
filter_extra_fields = True
Switched forms to new validators
r2467 users_group_name = All(
v.UnicodeString(strip=True, min=1, not_empty=True),
Mads Kiilerich
further cleanup of UsersGroup...
r3417 v.ValidUserGroup(edit, old_data)
Switched forms to new validators
r2467 )
Bradley M. Kuhn
Imported some of the GPLv3'd changes from RhodeCode v2.2.5....
r4116 user_group_description = v.UnicodeString(strip=True, min=1,
not_empty=False)
#56 fixed found bugs, implemented adding of new group + forms+validators...
r959
Switched forms to new validators
r2467 users_group_active = v.StringBoolean(if_missing=False)
#56 fixed found bugs, implemented adding of new group + forms+validators...
r959
#56 implemented users groups editing,...
r972 if edit:
Switched forms to new validators
r2467 users_group_members = v.OneOf(
available_members, hideList=False, testValueList=True,
if_missing=None, not_empty=False
)
#56 implemented users groups editing,...
r972
Mads Kiilerich
further cleanup of UsersGroup...
r3417 return _UserGroupForm
#56 fixed found bugs, implemented adding of new group + forms+validators...
r959
added validation to repo groups to check for conflicting repository name fixes #337
r1898
Bradley M. Kuhn
Imported some of the GPLv3'd changes from RhodeCode v2.2.5....
r4116 def RepoGroupForm(edit=False, old_data={}, available_groups=[],
Group management delegation:...
r3222 can_create_in_root=False):
Bradley M. Kuhn
Imported some of the GPLv3'd changes from RhodeCode v2.2.5....
r4116 class _RepoGroupForm(formencode.Schema):
#47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods....
r1345 allow_extra_fields = True
#227 Initial version of repository groups permissions system...
r1982 filter_extra_fields = False
#47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods....
r1345
Switched forms to new validators
r2467 group_name = All(v.UnicodeString(strip=True, min=1, not_empty=True),
Bradley M. Kuhn
Imported some of the GPLv3'd changes from RhodeCode v2.2.5....
r4116 v.SlugifyName(),
v.ValidRegex(msg=_('Name must not contain only digits'))(r'(?!^\d+$)^.+$'))
Switched forms to new validators
r2467 group_description = v.UnicodeString(strip=True, min=1,
Bradley M. Kuhn
Imported some of the GPLv3'd changes from RhodeCode v2.2.5....
r4116 not_empty=False)
group_copy_permissions = v.StringBoolean(if_missing=False)
Group management delegation:...
r3222 if edit:
#FIXME: do a special check that we cannot move a group to one of
#it's children
pass
group_parent_id = All(v.CanCreateGroup(can_create_in_root),
v.OneOf(available_groups, hideList=False,
testValueList=True,
if_missing=None, not_empty=True))
Recursive set locking on all children of a group.
r2749 enable_locking = v.StringBoolean(if_missing=False)
Bradley M. Kuhn
Imported some of the GPLv3'd changes from RhodeCode v2.2.5....
r4116 chained_validators = [v.ValidRepoGroup(edit, old_data)]
#47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods....
r1345
Bradley M. Kuhn
Imported some of the GPLv3'd changes from RhodeCode v2.2.5....
r4116 return _RepoGroupForm
#47 implemented Adding of new repo_groups+forms+validators. Fixed sorting of repo groups by main names in multiple locations. Removed some unneeded calls to self.sa for exchange to .query() methods....
r1345
added validation to repo groups to check for conflicting repository name fixes #337
r1898
fixes #69 password confirmation for register dialog....
r722 def RegisterForm(edit=False, old_data={}):
class _RegisterForm(formencode.Schema):
allow_extra_fields = True
filter_extra_fields = True
Switched forms to new validators
r2467 username = All(
v.ValidUsername(edit, old_data),
v.UnicodeString(strip=True, min=1, not_empty=True)
)
password = All(
v.ValidPassword(),
v.UnicodeString(strip=False, min=6, not_empty=True)
)
password_confirmation = All(
v.ValidPassword(),
v.UnicodeString(strip=False, min=6, not_empty=True)
)
active = v.StringBoolean(if_missing=False)
renamed some leftover name -> firstname
r2595 firstname = v.UnicodeString(strip=True, min=1, not_empty=False)
Switched forms to new validators
r2467 lastname = v.UnicodeString(strip=True, min=1, not_empty=False)
email = All(v.Email(not_empty=True), v.UniqSystemEmail(old_data))
fixes #69 password confirmation for register dialog....
r722
Switched forms to new validators
r2467 chained_validators = [v.ValidPasswordsMatch()]
fixes #69 password confirmation for register dialog....
r722
return _RegisterForm
renamed project to rhodecode
r547
#344 optional firstname lastname on user creation...
r1950
renamed project to rhodecode
r547 def PasswordResetForm():
class _PasswordResetForm(formencode.Schema):
allow_extra_fields = True
filter_extra_fields = True
Switched forms to new validators
r2467 email = All(v.ValidSystemEmail(), v.Email(not_empty=True))
renamed project to rhodecode
r547 return _PasswordResetForm
#344 optional firstname lastname on user creation...
r1950
#109, added optional clone uri when creating repo....
r1112 def RepoForm(edit=False, old_data={}, supported_backends=BACKENDS.keys(),
validating choices for landing_rev
r2460 repo_groups=[], landing_revs=[]):
renamed project to rhodecode
r547 class _RepoForm(formencode.Schema):
allow_extra_fields = True
Fixed some issues with edit form...
r3089 filter_extra_fields = False
Switched forms to new validators
r2467 repo_name = All(v.UnicodeString(strip=True, min=1, not_empty=True),
v.SlugifyName())
Pass in old groups data to CanWriteToGroup validator for later skipping group checks....
r3524 repo_group = All(v.CanWriteGroup(old_data),
Implemented permissions for writing to repo...
r2835 v.OneOf(repo_groups, hideList=True))
fix required repo_type param on repo edit form
r3863 repo_type = v.OneOf(supported_backends, required=False,
if_missing=old_data.get('repo_type'))
Implemented #379 defaults settings page for creation of repositories...
r3056 repo_description = v.UnicodeString(strip=True, min=1, not_empty=False)
repo_private = v.StringBoolean(if_missing=False)
Fixed some issues with edit form...
r3089 repo_landing_rev = v.OneOf(landing_revs, hideList=True)
Bradley M. Kuhn
Imported some of the GPLv3'd changes from RhodeCode v2.2.5....
r4116 repo_copy_permissions = v.StringBoolean(if_missing=False)
Fixed some issues with edit form...
r3089 clone_uri = All(v.UnicodeString(strip=True, min=1, not_empty=False))
Implemented #379 defaults settings page for creation of repositories...
r3056 repo_enable_statistics = v.StringBoolean(if_missing=False)
repo_enable_downloads = v.StringBoolean(if_missing=False)
repo_enable_locking = v.StringBoolean(if_missing=False)
#109, added optional clone uri when creating repo....
r1112
renamed project to rhodecode
r547 if edit:
#56 added assignments of users groups into repository
r1014 #this is repo owner
Switched forms to new validators
r2467 user = All(v.UnicodeString(not_empty=True), v.ValidRepoUser())
Bradley M. Kuhn
Imported some of the GPLv3'd changes from RhodeCode v2.2.5....
r4116 clone_uri_change = v.UnicodeString(not_empty=False, if_missing=v.Missing)
Code refactoring,models renames...
r629
Switched forms to new validators
r2467 chained_validators = [v.ValidCloneUri(),
moved permission management into separate entity....
r3628 v.ValidRepoName(edit, old_data)]
renamed project to rhodecode
r547 return _RepoForm
#344 optional firstname lastname on user creation...
r1950
moved permission management into separate entity....
r3628 def RepoPermsForm():
class _RepoPermsForm(formencode.Schema):
allow_extra_fields = True
filter_extra_fields = False
- Manage User’s Groups: create, delete, rename, add/remove users inside....
r3714 chained_validators = [v.ValidPerms(type_='repo')]
moved permission management into separate entity....
r3628 return _RepoPermsForm
Bradley M. Kuhn
Imported some of the GPLv3'd changes from RhodeCode v2.2.5....
r4116 def RepoGroupPermsForm(valid_recursive_choices):
- Manage User’s Groups: create, delete, rename, add/remove users inside....
r3714 class _RepoGroupPermsForm(formencode.Schema):
allow_extra_fields = True
filter_extra_fields = False
Bradley M. Kuhn
Imported some of the GPLv3'd changes from RhodeCode v2.2.5....
r4116 recursive = v.OneOf(valid_recursive_choices)
- Manage User’s Groups: create, delete, rename, add/remove users inside....
r3714 chained_validators = [v.ValidPerms(type_='repo_group')]
return _RepoGroupPermsForm
def UserGroupPermsForm():
class _UserPermsForm(formencode.Schema):
allow_extra_fields = True
filter_extra_fields = False
chained_validators = [v.ValidPerms(type_='user_group')]
return _UserPermsForm
repository extra fields implementation...
r3308 def RepoFieldForm():
class _RepoFieldForm(formencode.Schema):
filter_extra_fields = True
allow_extra_fields = True
new_field_key = All(v.FieldKey(),
v.UnicodeString(strip=True, min=3, not_empty=True))
new_field_value = v.UnicodeString(not_empty=False, if_missing='')
new_field_type = v.OneOf(['str', 'unicode', 'list', 'tuple'],
if_missing='str')
new_field_label = v.UnicodeString(not_empty=False)
new_field_desc = v.UnicodeString(not_empty=False)
return _RepoFieldForm
validating choices for landing_rev
r2460 def RepoForkForm(edit=False, old_data={}, supported_backends=BACKENDS.keys(),
added landing revision into fork create form
r2485 repo_groups=[], landing_revs=[]):
renamed project to rhodecode
r547 class _RepoForkForm(formencode.Schema):
allow_extra_fields = True
filter_extra_fields = False
Switched forms to new validators
r2467 repo_name = All(v.UnicodeString(strip=True, min=1, not_empty=True),
v.SlugifyName())
Implemented permissions for writing to repo...
r2835 repo_group = All(v.CanWriteGroup(),
v.OneOf(repo_groups, hideList=True))
Switched forms to new validators
r2467 repo_type = All(v.ValidForkType(old_data), v.OneOf(supported_backends))
description = v.UnicodeString(strip=True, min=1, not_empty=True)
private = v.StringBoolean(if_missing=False)
copy_permissions = v.StringBoolean(if_missing=False)
update_after_clone = v.StringBoolean(if_missing=False)
fork_parent_id = v.UnicodeString()
chained_validators = [v.ValidForkName(edit, old_data)]
added landing revision into fork create form
r2485 landing_rev = v.OneOf(landing_revs, hideList=True)
fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached...
r1366
renamed project to rhodecode
r547 return _RepoForkForm
#344 optional firstname lastname on user creation...
r1950
renamed project to rhodecode
r547 def ApplicationSettingsForm():
class _ApplicationSettingsForm(formencode.Schema):
allow_extra_fields = True
filter_extra_fields = False
Bradley M. Kuhn
Imported some of the GPLv3'd changes from RhodeCode v2.2.5....
r4116 rhodecode_title = v.UnicodeString(strip=True, not_empty=False)
Switched forms to new validators
r2467 rhodecode_realm = v.UnicodeString(strip=True, min=1, not_empty=True)
rhodecode_ga_code = v.UnicodeString(strip=True, min=1, not_empty=False)
Bradley M. Kuhn
Imported some of the GPLv3'd changes from RhodeCode v2.2.5....
r4116 rhodecode_captcha_public_key = v.UnicodeString(strip=True, min=1, not_empty=False)
rhodecode_captcha_private_key = v.UnicodeString(strip=True, min=1, not_empty=False)
Code refactoring,models renames...
r629
renamed project to rhodecode
r547 return _ApplicationSettingsForm
Code refactoring,models renames...
r629
#344 optional firstname lastname on user creation...
r1950
merged + fixed pull request #62: Implemented metatags and visualisation options....
r2674 def ApplicationVisualisationForm():
class _ApplicationVisualisationForm(formencode.Schema):
allow_extra_fields = True
filter_extra_fields = False
rhodecode_show_public_icon = v.StringBoolean(if_missing=False)
rhodecode_show_private_icon = v.StringBoolean(if_missing=False)
rhodecode_stylify_metatags = v.StringBoolean(if_missing=False)
repository extra fields implementation...
r3308 rhodecode_repository_fields = v.StringBoolean(if_missing=False)
Added lightweight journal option for visual
r2952 rhodecode_lightweight_journal = v.StringBoolean(if_missing=False)
Improve validation on dashboard items field
r3949 rhodecode_dashboard_items = v.Int(min=5, not_empty=True)
Bradley M. Kuhn
Imported some of the GPLv3'd changes from RhodeCode v2.2.5....
r4116 rhodecode_admin_grid_items = v.Int(min=5, not_empty=True)
Implements #842 RhodeCode version disclosure....
r3910 rhodecode_show_version = v.StringBoolean(if_missing=False)
Bradley M. Kuhn
Imported some of the GPLv3'd changes from RhodeCode v2.2.5....
r4116 rhodecode_use_gravatar = v.StringBoolean(if_missing=False)
rhodecode_gravatar_url = v.UnicodeString(min=3)
rhodecode_clone_uri_tmpl = v.UnicodeString(min=3)
Added lightweight dashboard option. ref #500
r2936
merged + fixed pull request #62: Implemented metatags and visualisation options....
r2674 return _ApplicationVisualisationForm
renamed project to rhodecode
r547 def ApplicationUiSettingsForm():
class _ApplicationUiSettingsForm(formencode.Schema):
allow_extra_fields = True
filter_extra_fields = False
merged + fixed pull request #62: Implemented metatags and visualisation options....
r2674 web_push_ssl = v.StringBoolean(if_missing=False)
Switched forms to new validators
r2467 paths_root_path = All(
v.ValidPath(),
v.UnicodeString(strip=True, min=1, not_empty=True)
)
merged + fixed pull request #62: Implemented metatags and visualisation options....
r2674 hooks_changegroup_update = v.StringBoolean(if_missing=False)
hooks_changegroup_repo_size = v.StringBoolean(if_missing=False)
hooks_changegroup_push_logger = v.StringBoolean(if_missing=False)
Implemented basic locking functionality....
r2726 hooks_outgoing_pull_logger = v.StringBoolean(if_missing=False)
Code refactoring,models renames...
r629
Added form for controlling mercurial extensions...
r2708 extensions_largefiles = v.StringBoolean(if_missing=False)
extensions_hgsubversion = v.StringBoolean(if_missing=False)
extensions_hggit = v.StringBoolean(if_missing=False)
renamed project to rhodecode
r547 return _ApplicationUiSettingsForm
#344 optional firstname lastname on user creation...
r1950
Implemented #379 defaults settings page for creation of repositories...
r3056 def DefaultPermissionsForm(repo_perms_choices, group_perms_choices,
New default permissions definition for user group create
r3734 user_group_perms_choices, create_choices,
Bradley M. Kuhn
Imported some of the GPLv3'd changes from RhodeCode v2.2.5....
r4116 create_on_write_choices, repo_group_create_choices,
user_group_create_choices, fork_choices,
register_choices, extern_activate_choices):
renamed project to rhodecode
r547 class _DefaultPermissionsForm(formencode.Schema):
allow_extra_fields = True
filter_extra_fields = True
implemented #663 Admin/permission: specify default repogroup perms...
r3052 overwrite_default_repo = v.StringBoolean(if_missing=False)
overwrite_default_group = v.StringBoolean(if_missing=False)
fixed overwrite default user group permission flag
r3735 overwrite_default_user_group = v.StringBoolean(if_missing=False)
merged + fixed pull request #62: Implemented metatags and visualisation options....
r2674 anonymous = v.StringBoolean(if_missing=False)
implemented #663 Admin/permission: specify default repogroup perms...
r3052 default_repo_perm = v.OneOf(repo_perms_choices)
default_group_perm = v.OneOf(group_perms_choices)
New default permissions definition for user group create
r3734 default_user_group_perm = v.OneOf(user_group_perms_choices)
default_repo_create = v.OneOf(create_choices)
Bradley M. Kuhn
Imported some of the GPLv3'd changes from RhodeCode v2.2.5....
r4116 create_on_write = v.OneOf(create_on_write_choices)
New default permissions definition for user group create
r3734 default_user_group_create = v.OneOf(user_group_create_choices)
#default_repo_group_create = v.OneOf(repo_group_create_choices) #not impl. yet
RhodeCode now has a option to explicitly set forking permissions. ref #508...
r2709 default_fork = v.OneOf(fork_choices)
Code refactoring,models renames...
r629
New default permissions definition for user group create
r3734 default_register = v.OneOf(register_choices)
Added separate default permission for external_auth account...
r3786 default_extern_activate = v.OneOf(extern_activate_choices)
renamed project to rhodecode
r547 return _DefaultPermissionsForm
implements #60, ldap configuration and authentication....
r705
Iteration on default permissions...
r3736 def CustomDefaultPermissionsForm():
class _CustomDefaultPermissionsForm(formencode.Schema):
filter_extra_fields = True
allow_extra_fields = True
inherit_default_permissions = v.StringBoolean(if_missing=False)
create_repo_perm = v.StringBoolean(if_missing=False)
create_user_group_perm = v.StringBoolean(if_missing=False)
#create_repo_group_perm Impl. later
fork_repo_perm = v.StringBoolean(if_missing=False)
return _CustomDefaultPermissionsForm
Implemented #379 defaults settings page for creation of repositories...
r3056 def DefaultsForm(edit=False, old_data={}, supported_backends=BACKENDS.keys()):
class _DefaultsForm(formencode.Schema):
allow_extra_fields = True
filter_extra_fields = True
default_repo_type = v.OneOf(supported_backends)
default_repo_private = v.StringBoolean(if_missing=False)
default_repo_enable_statistics = v.StringBoolean(if_missing=False)
default_repo_enable_downloads = v.StringBoolean(if_missing=False)
default_repo_enable_locking = v.StringBoolean(if_missing=False)
return _DefaultsForm
Bradley M. Kuhn
Imported some of the GPLv3'd changes from RhodeCode v2.2.5....
r4116 def AuthSettingsForm(current_active_modules):
class _AuthSettingsForm(formencode.Schema):
allow_extra_fields = True
filter_extra_fields = True
auth_plugins = All(v.ValidAuthPlugins(),
v.UniqueListFromString()(not_empty=True))
def __init__(self, *args, **kwargs):
# The auth plugins tell us what form validators they use
if current_active_modules:
import rhodecode.lib.auth_modules
from rhodecode.lib.auth_modules import LazyFormencode
for module in current_active_modules:
plugin = rhodecode.lib.auth_modules.loadplugin(module)
plugin_name = plugin.name
for sv in plugin.plugin_settings():
newk = "auth_%s_%s" % (plugin_name, sv["name"])
# can be a LazyFormencode object from plugin settings
validator = sv["validator"]
if isinstance(validator, LazyFormencode):
validator = validator()
#init all lazy validators from formencode.All
if isinstance(validator, All):
init_validators = []
for validator in validator.validators:
if isinstance(validator, LazyFormencode):
validator = validator()
init_validators.append(validator)
validator.validators = init_validators
self.add_field(newk, validator)
formencode.Schema.__init__(self, *args, **kwargs)
return _AuthSettingsForm
Switched forms to new validators
r2467 def LdapSettingsForm(tls_reqcert_choices, search_scope_choices,
tls_kind_choices):
implements #60, ldap configuration and authentication....
r705 class _LdapSettingsForm(formencode.Schema):
allow_extra_fields = True
filter_extra_fields = True
fixed #374 LDAP config is now saved but deactivated if python-ldap lib is missing
r2193 #pre_validators = [LdapLibValidator]
Switched forms to new validators
r2467 ldap_active = v.StringBoolean(if_missing=False)
ldap_host = v.UnicodeString(strip=True,)
ldap_port = v.Number(strip=True,)
ldap_tls_kind = v.OneOf(tls_kind_choices)
ldap_tls_reqcert = v.OneOf(tls_reqcert_choices)
ldap_dn_user = v.UnicodeString(strip=True,)
ldap_dn_pass = v.UnicodeString(strip=True,)
ldap_base_dn = v.UnicodeString(strip=True,)
ldap_filter = v.UnicodeString(strip=True,)
ldap_search_scope = v.OneOf(search_scope_choices)
fixed ldap tests when ldap lib is installed
r3674 ldap_attr_login = v.AttrLoginValidator()(not_empty=True)
Switched forms to new validators
r2467 ldap_attr_firstname = v.UnicodeString(strip=True,)
ldap_attr_lastname = v.UnicodeString(strip=True,)
ldap_attr_email = v.UnicodeString(strip=True,)
implements #60, ldap configuration and authentication....
r705
return _LdapSettingsForm
Added validation into user email map
r2479
def UserExtraEmailForm():
class _UserExtraEmailForm(formencode.Schema):
Added UserIpMap interface for allowed IP addresses and IP restriction access...
r3125 email = All(v.UniqSystemEmail(), v.Email(not_empty=True))
return _UserExtraEmailForm
Added validation into user email map
r2479
Added UserIpMap interface for allowed IP addresses and IP restriction access...
r3125 def UserExtraIpForm():
class _UserExtraIpForm(formencode.Schema):
ip = v.ValidIp()(not_empty=True)
return _UserExtraIpForm
added more validations when opening pull request...
r2711
Fixed #585, checks for status of revision where to strict, and made opening pull request with those revision impossible due to previosly set status....
r2893 def PullRequestForm(repo_id):
added more validations when opening pull request...
r2711 class _PullRequestForm(formencode.Schema):
allow_extra_fields = True
filter_extra_fields = True
user = v.UnicodeString(strip=True, required=True)
org_repo = v.UnicodeString(strip=True, required=True)
org_ref = v.UnicodeString(strip=True, required=True)
other_repo = v.UnicodeString(strip=True, required=True)
other_ref = v.UnicodeString(strip=True, required=True)
set the status of changesets initially on pull request, and make sure we care of version collisions....
r3175 revisions = All(#v.NotReviewedRevisions(repo_id)(),
Bradley M. Kuhn
Imported some of the GPLv3'd changes from RhodeCode v2.2.5....
r4116 v.UniqueList()(not_empty=True))
review_members = v.UniqueList()(not_empty=True)
added more validations when opening pull request...
r2711
Mads Kiilerich
pull requests: make title optional - generate one automatically
r4058 pullrequest_title = v.UnicodeString(strip=True, required=True)
added more validations when opening pull request...
r2711 pullrequest_desc = v.UnicodeString(strip=True, required=False)
Mads Kiilerich
compare/pullrequest: introduce merge parameter...
r3486 ancestor_rev = v.UnicodeString(strip=True, required=True)
merge_rev = v.UnicodeString(strip=True, required=True)
White space cleanup
r2815 return _PullRequestForm
Implemented simple gist functionality ref #530....
r3840
def GistForm(lifetime_options):
class _GistForm(formencode.Schema):
Gist: don't allow files inside directories when creating gists
r3846 filename = All(v.BasePath()(),
v.UnicodeString(strip=True, required=False))
Implemented simple gist functionality ref #530....
r3840 description = v.UnicodeString(required=False, if_missing='')
lifetime = v.OneOf(lifetime_options)
Added codemirror syntax mode in gists....
r4030 mimetype = v.UnicodeString(required=False, if_missing=None)
Implemented simple gist functionality ref #530....
r3840 content = v.UnicodeString(required=True, not_empty=True)
public = v.UnicodeString(required=False, if_missing='')
private = v.UnicodeString(required=False, if_missing='')
return _GistForm