annotate rhodecode/model/forms.py @ 2776:63e58ef80ef1

Merge beta branch into stable
author Marcin Kuzminski <marcin@python-works.com>
date Sun, 02 Sep 2012 21:19:54 +0200
parents a437a986d399 3ed4dae499d0
children f7a52d548fd0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
1 """ this is forms validation classes
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
2 http://formencode.org/module-formencode.validators.html
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
3 for list off all availible validators
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
4
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
5 we can create our own validators
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
6
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
7 The table below outlines the options which can be used in a schema in addition to the validators themselves
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
8 pre_validators [] These validators will be applied before the schema
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
9 chained_validators [] These validators will be applied after the schema
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
10 allow_extra_fields False If True, then it is not an error when keys that aren't associated with a validator are present
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
11 filter_extra_fields False If True, then keys that aren't associated with a validator are removed
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
12 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.
1203
6832ef664673 source code cleanup: remove trailing white space, normalize file endings
Marcin Kuzminski <marcin@python-works.com>
parents: 1159
diff changeset
13 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
6832ef664673 source code cleanup: remove trailing white space, normalize file endings
Marcin Kuzminski <marcin@python-works.com>
parents: 1159
diff changeset
14
6832ef664673 source code cleanup: remove trailing white space, normalize file endings
Marcin Kuzminski <marcin@python-works.com>
parents: 1159
diff changeset
15
0
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
16 <name> = formencode.validators.<name of validator>
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
17 <name> must equal form name
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
18 list=[1,2,3,4,5]
186
556473ba0399 fixed menu in home page, and added login html with forms that validates username and password.
Marcin Kuzminski <marcin@python-works.com>
parents: 45
diff changeset
19 for SELECT use formencode.All(OneOf(list), Int())
1203
6832ef664673 source code cleanup: remove trailing white space, normalize file endings
Marcin Kuzminski <marcin@python-works.com>
parents: 1159
diff changeset
20
0
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
21 """
761
56c2850a5b5f ldap auth rewrite, moved split authfunc into two functions,
Marcin Kuzminski <marcin@python-works.com>
parents: 746
diff changeset
22 import logging
56c2850a5b5f ldap auth rewrite, moved split authfunc into two functions,
Marcin Kuzminski <marcin@python-works.com>
parents: 746
diff changeset
23
56c2850a5b5f ldap auth rewrite, moved split authfunc into two functions,
Marcin Kuzminski <marcin@python-works.com>
parents: 746
diff changeset
24 import formencode
242
5da4ef115006 Added lastlogin to user after login, model db update
Marcin Kuzminski <marcin@python-works.com>
parents: 238
diff changeset
25 from formencode import All
761
56c2850a5b5f ldap auth rewrite, moved split authfunc into two functions,
Marcin Kuzminski <marcin@python-works.com>
parents: 746
diff changeset
26
186
556473ba0399 fixed menu in home page, and added login html with forms that validates username and password.
Marcin Kuzminski <marcin@python-works.com>
parents: 45
diff changeset
27 from pylons.i18n.translation import _
761
56c2850a5b5f ldap auth rewrite, moved split authfunc into two functions,
Marcin Kuzminski <marcin@python-works.com>
parents: 746
diff changeset
28
2467
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
29 from rhodecode.model import validators as v
761
56c2850a5b5f ldap auth rewrite, moved split authfunc into two functions,
Marcin Kuzminski <marcin@python-works.com>
parents: 746
diff changeset
30 from rhodecode import BACKENDS
56c2850a5b5f ldap auth rewrite, moved split authfunc into two functions,
Marcin Kuzminski <marcin@python-works.com>
parents: 746
diff changeset
31
186
556473ba0399 fixed menu in home page, and added login html with forms that validates username and password.
Marcin Kuzminski <marcin@python-works.com>
parents: 45
diff changeset
32 log = logging.getLogger(__name__)
556473ba0399 fixed menu in home page, and added login html with forms that validates username and password.
Marcin Kuzminski <marcin@python-works.com>
parents: 45
diff changeset
33
1898
a7dfe823933a added validation to repo groups to check for conflicting repository name fixes #337
Marcin Kuzminski <marcin@python-works.com>
parents: 1818
diff changeset
34
45
a886f5eba757 implemented admin page login
marcink
parents: 0
diff changeset
35 class LoginForm(formencode.Schema):
a886f5eba757 implemented admin page login
marcink
parents: 0
diff changeset
36 allow_extra_fields = True
a886f5eba757 implemented admin page login
marcink
parents: 0
diff changeset
37 filter_extra_fields = True
2467
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
38 username = v.UnicodeString(
1950
4ae17f819ee8 #344 optional firstname lastname on user creation
Marcin Kuzminski <marcin@python-works.com>
parents: 1898
diff changeset
39 strip=True,
4ae17f819ee8 #344 optional firstname lastname on user creation
Marcin Kuzminski <marcin@python-works.com>
parents: 1898
diff changeset
40 min=1,
4ae17f819ee8 #344 optional firstname lastname on user creation
Marcin Kuzminski <marcin@python-works.com>
parents: 1898
diff changeset
41 not_empty=True,
4ae17f819ee8 #344 optional firstname lastname on user creation
Marcin Kuzminski <marcin@python-works.com>
parents: 1898
diff changeset
42 messages={
2467
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
43 'empty': _(u'Please enter a login'),
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
44 'tooShort': _(u'Enter a value %(min)i characters long or more')}
1950
4ae17f819ee8 #344 optional firstname lastname on user creation
Marcin Kuzminski <marcin@python-works.com>
parents: 1898
diff changeset
45 )
0
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
46
2467
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
47 password = v.UnicodeString(
2181
e1c1ebbe7346 #419 don't strip passwords for login forms, make rhodecode more compatible with LDAP servers
Marcin Kuzminski <marcin@python-works.com>
parents: 2072
diff changeset
48 strip=False,
1950
4ae17f819ee8 #344 optional firstname lastname on user creation
Marcin Kuzminski <marcin@python-works.com>
parents: 1898
diff changeset
49 min=3,
4ae17f819ee8 #344 optional firstname lastname on user creation
Marcin Kuzminski <marcin@python-works.com>
parents: 1898
diff changeset
50 not_empty=True,
4ae17f819ee8 #344 optional firstname lastname on user creation
Marcin Kuzminski <marcin@python-works.com>
parents: 1898
diff changeset
51 messages={
2467
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
52 'empty': _(u'Please enter a password'),
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
53 'tooShort': _(u'Enter %(min)i characters or more')}
1950
4ae17f819ee8 #344 optional firstname lastname on user creation
Marcin Kuzminski <marcin@python-works.com>
parents: 1898
diff changeset
54 )
0
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
55
2467
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
56 remember = v.StringBoolean(if_missing=False)
1818
cf51bbfb120e auto white-space removal
Marcin Kuzminski <marcin@python-works.com>
parents: 1802
diff changeset
57
2467
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
58 chained_validators = [v.ValidAuth()]
629
7e536d1af60d Code refactoring,models renames
Marcin Kuzminski <marcin@python-works.com>
parents: 555
diff changeset
59
1898
a7dfe823933a added validation to repo groups to check for conflicting repository name fixes #337
Marcin Kuzminski <marcin@python-works.com>
parents: 1818
diff changeset
60
357
ebdd1a89cdd9 Added extra validation in creating users.
Marcin Kuzminski <marcin@python-works.com>
parents: 356
diff changeset
61 def UserForm(edit=False, old_data={}):
238
a55c17874486 Rewrite of user managment, improved forms, added some user info
Marcin Kuzminski <marcin@python-works.com>
parents: 234
diff changeset
62 class _UserForm(formencode.Schema):
a55c17874486 Rewrite of user managment, improved forms, added some user info
Marcin Kuzminski <marcin@python-works.com>
parents: 234
diff changeset
63 allow_extra_fields = True
a55c17874486 Rewrite of user managment, improved forms, added some user info
Marcin Kuzminski <marcin@python-works.com>
parents: 234
diff changeset
64 filter_extra_fields = True
2467
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
65 username = All(v.UnicodeString(strip=True, min=1, not_empty=True),
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
66 v.ValidUsername(edit, old_data))
238
a55c17874486 Rewrite of user managment, improved forms, added some user info
Marcin Kuzminski <marcin@python-works.com>
parents: 234
diff changeset
67 if edit:
2467
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
68 new_password = All(
2544
6ce3387bf0ce Renamed name to firstname in forms
Marcin Kuzminski <marcin@python-works.com>
parents: 2485
diff changeset
69 v.ValidPassword(),
2467
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
70 v.UnicodeString(strip=False, min=6, not_empty=False)
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
71 )
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
72 password_confirmation = All(
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
73 v.ValidPassword(),
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
74 v.UnicodeString(strip=False, min=6, not_empty=False),
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
75 )
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
76 admin = v.StringBoolean(if_missing=False)
238
a55c17874486 Rewrite of user managment, improved forms, added some user info
Marcin Kuzminski <marcin@python-works.com>
parents: 234
diff changeset
77 else:
2467
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
78 password = All(
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
79 v.ValidPassword(),
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
80 v.UnicodeString(strip=False, min=6, not_empty=True)
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
81 )
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
82 password_confirmation = All(
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
83 v.ValidPassword(),
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
84 v.UnicodeString(strip=False, min=6, not_empty=False)
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
85 )
1722
e7eef7a1db6a #235 forking page repo group selection
Marcin Kuzminski <marcin@python-works.com>
parents: 1633
diff changeset
86
2467
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
87 active = v.StringBoolean(if_missing=False)
2544
6ce3387bf0ce Renamed name to firstname in forms
Marcin Kuzminski <marcin@python-works.com>
parents: 2485
diff changeset
88 firstname = v.UnicodeString(strip=True, min=1, not_empty=False)
2467
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
89 lastname = v.UnicodeString(strip=True, min=1, not_empty=False)
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
90 email = All(v.Email(not_empty=True), v.UniqSystemEmail(old_data))
629
7e536d1af60d Code refactoring,models renames
Marcin Kuzminski <marcin@python-works.com>
parents: 555
diff changeset
91
2467
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
92 chained_validators = [v.ValidPasswordsMatch()]
722
02bdf2f296ff fixes #69 password confirmation for register dialog.
Marcin Kuzminski <marcin@python-works.com>
parents: 710
diff changeset
93
238
a55c17874486 Rewrite of user managment, improved forms, added some user info
Marcin Kuzminski <marcin@python-works.com>
parents: 234
diff changeset
94 return _UserForm
265
0e5455fda8fd Implemented basic repository managment. Implemented repo2db mappings, model, helpers updates and code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents: 242
diff changeset
95
959
fff21c9b075c #56 fixed found bugs, implemented adding of new group + forms+validators
Marcin Kuzminski <marcin@python-works.com>
parents: 891
diff changeset
96
972
2c8fd84935a4 #56 implemented users groups editing,
Marcin Kuzminski <marcin@python-works.com>
parents: 962
diff changeset
97 def UsersGroupForm(edit=False, old_data={}, available_members=[]):
959
fff21c9b075c #56 fixed found bugs, implemented adding of new group + forms+validators
Marcin Kuzminski <marcin@python-works.com>
parents: 891
diff changeset
98 class _UsersGroupForm(formencode.Schema):
fff21c9b075c #56 fixed found bugs, implemented adding of new group + forms+validators
Marcin Kuzminski <marcin@python-works.com>
parents: 891
diff changeset
99 allow_extra_fields = True
fff21c9b075c #56 fixed found bugs, implemented adding of new group + forms+validators
Marcin Kuzminski <marcin@python-works.com>
parents: 891
diff changeset
100 filter_extra_fields = True
fff21c9b075c #56 fixed found bugs, implemented adding of new group + forms+validators
Marcin Kuzminski <marcin@python-works.com>
parents: 891
diff changeset
101
2467
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
102 users_group_name = All(
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
103 v.UnicodeString(strip=True, min=1, not_empty=True),
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
104 v.ValidUsersGroup(edit, old_data)
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
105 )
959
fff21c9b075c #56 fixed found bugs, implemented adding of new group + forms+validators
Marcin Kuzminski <marcin@python-works.com>
parents: 891
diff changeset
106
2467
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
107 users_group_active = v.StringBoolean(if_missing=False)
959
fff21c9b075c #56 fixed found bugs, implemented adding of new group + forms+validators
Marcin Kuzminski <marcin@python-works.com>
parents: 891
diff changeset
108
972
2c8fd84935a4 #56 implemented users groups editing,
Marcin Kuzminski <marcin@python-works.com>
parents: 962
diff changeset
109 if edit:
2467
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
110 users_group_members = v.OneOf(
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
111 available_members, hideList=False, testValueList=True,
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
112 if_missing=None, not_empty=False
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
113 )
972
2c8fd84935a4 #56 implemented users groups editing,
Marcin Kuzminski <marcin@python-works.com>
parents: 962
diff changeset
114
959
fff21c9b075c #56 fixed found bugs, implemented adding of new group + forms+validators
Marcin Kuzminski <marcin@python-works.com>
parents: 891
diff changeset
115 return _UsersGroupForm
fff21c9b075c #56 fixed found bugs, implemented adding of new group + forms+validators
Marcin Kuzminski <marcin@python-works.com>
parents: 891
diff changeset
116
1898
a7dfe823933a added validation to repo groups to check for conflicting repository name fixes #337
Marcin Kuzminski <marcin@python-works.com>
parents: 1818
diff changeset
117
1345
3bce31f026b8 #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.
Marcin Kuzminski <marcin@python-works.com>
parents: 1324
diff changeset
118 def ReposGroupForm(edit=False, old_data={}, available_groups=[]):
3bce31f026b8 #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.
Marcin Kuzminski <marcin@python-works.com>
parents: 1324
diff changeset
119 class _ReposGroupForm(formencode.Schema):
3bce31f026b8 #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.
Marcin Kuzminski <marcin@python-works.com>
parents: 1324
diff changeset
120 allow_extra_fields = True
1982
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents: 1976
diff changeset
121 filter_extra_fields = False
1345
3bce31f026b8 #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.
Marcin Kuzminski <marcin@python-works.com>
parents: 1324
diff changeset
122
2467
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
123 group_name = All(v.UnicodeString(strip=True, min=1, not_empty=True),
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
124 v.SlugifyName())
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
125 group_description = v.UnicodeString(strip=True, min=1,
1345
3bce31f026b8 #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.
Marcin Kuzminski <marcin@python-works.com>
parents: 1324
diff changeset
126 not_empty=True)
2467
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
127 group_parent_id = v.OneOf(available_groups, hideList=False,
1345
3bce31f026b8 #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.
Marcin Kuzminski <marcin@python-works.com>
parents: 1324
diff changeset
128 testValueList=True,
3bce31f026b8 #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.
Marcin Kuzminski <marcin@python-works.com>
parents: 1324
diff changeset
129 if_missing=None, not_empty=False)
2749
3ed4dae499d0 Recursive set locking on all children of a group.
Marcin Kuzminski <marcin@python-works.com>
parents: 2726
diff changeset
130 enable_locking = v.StringBoolean(if_missing=False)
2467
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
131 chained_validators = [v.ValidReposGroup(edit, old_data),
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
132 v.ValidPerms('group')]
1345
3bce31f026b8 #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.
Marcin Kuzminski <marcin@python-works.com>
parents: 1324
diff changeset
133
3bce31f026b8 #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.
Marcin Kuzminski <marcin@python-works.com>
parents: 1324
diff changeset
134 return _ReposGroupForm
3bce31f026b8 #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.
Marcin Kuzminski <marcin@python-works.com>
parents: 1324
diff changeset
135
1898
a7dfe823933a added validation to repo groups to check for conflicting repository name fixes #337
Marcin Kuzminski <marcin@python-works.com>
parents: 1818
diff changeset
136
722
02bdf2f296ff fixes #69 password confirmation for register dialog.
Marcin Kuzminski <marcin@python-works.com>
parents: 710
diff changeset
137 def RegisterForm(edit=False, old_data={}):
02bdf2f296ff fixes #69 password confirmation for register dialog.
Marcin Kuzminski <marcin@python-works.com>
parents: 710
diff changeset
138 class _RegisterForm(formencode.Schema):
02bdf2f296ff fixes #69 password confirmation for register dialog.
Marcin Kuzminski <marcin@python-works.com>
parents: 710
diff changeset
139 allow_extra_fields = True
02bdf2f296ff fixes #69 password confirmation for register dialog.
Marcin Kuzminski <marcin@python-works.com>
parents: 710
diff changeset
140 filter_extra_fields = True
2467
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
141 username = All(
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
142 v.ValidUsername(edit, old_data),
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
143 v.UnicodeString(strip=True, min=1, not_empty=True)
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
144 )
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
145 password = All(
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
146 v.ValidPassword(),
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
147 v.UnicodeString(strip=False, min=6, not_empty=True)
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
148 )
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
149 password_confirmation = All(
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
150 v.ValidPassword(),
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
151 v.UnicodeString(strip=False, min=6, not_empty=True)
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
152 )
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
153 active = v.StringBoolean(if_missing=False)
2595
6c83dc0226d2 renamed some leftover name -> firstname
Marcin Kuzminski <marcin@python-works.com>
parents: 2544
diff changeset
154 firstname = v.UnicodeString(strip=True, min=1, not_empty=False)
2467
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
155 lastname = v.UnicodeString(strip=True, min=1, not_empty=False)
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
156 email = All(v.Email(not_empty=True), v.UniqSystemEmail(old_data))
722
02bdf2f296ff fixes #69 password confirmation for register dialog.
Marcin Kuzminski <marcin@python-works.com>
parents: 710
diff changeset
157
2467
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
158 chained_validators = [v.ValidPasswordsMatch()]
722
02bdf2f296ff fixes #69 password confirmation for register dialog.
Marcin Kuzminski <marcin@python-works.com>
parents: 710
diff changeset
159
02bdf2f296ff fixes #69 password confirmation for register dialog.
Marcin Kuzminski <marcin@python-works.com>
parents: 710
diff changeset
160 return _RegisterForm
474
a3d9d24acbec Implemented password reset(forms/models/ tasks) and mailing tasks.
Marcin Kuzminski <marcin@python-works.com>
parents: 458
diff changeset
161
1950
4ae17f819ee8 #344 optional firstname lastname on user creation
Marcin Kuzminski <marcin@python-works.com>
parents: 1898
diff changeset
162
474
a3d9d24acbec Implemented password reset(forms/models/ tasks) and mailing tasks.
Marcin Kuzminski <marcin@python-works.com>
parents: 458
diff changeset
163 def PasswordResetForm():
a3d9d24acbec Implemented password reset(forms/models/ tasks) and mailing tasks.
Marcin Kuzminski <marcin@python-works.com>
parents: 458
diff changeset
164 class _PasswordResetForm(formencode.Schema):
a3d9d24acbec Implemented password reset(forms/models/ tasks) and mailing tasks.
Marcin Kuzminski <marcin@python-works.com>
parents: 458
diff changeset
165 allow_extra_fields = True
a3d9d24acbec Implemented password reset(forms/models/ tasks) and mailing tasks.
Marcin Kuzminski <marcin@python-works.com>
parents: 458
diff changeset
166 filter_extra_fields = True
2467
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
167 email = All(v.ValidSystemEmail(), v.Email(not_empty=True))
474
a3d9d24acbec Implemented password reset(forms/models/ tasks) and mailing tasks.
Marcin Kuzminski <marcin@python-works.com>
parents: 458
diff changeset
168 return _PasswordResetForm
a3d9d24acbec Implemented password reset(forms/models/ tasks) and mailing tasks.
Marcin Kuzminski <marcin@python-works.com>
parents: 458
diff changeset
169
1950
4ae17f819ee8 #344 optional firstname lastname on user creation
Marcin Kuzminski <marcin@python-works.com>
parents: 1898
diff changeset
170
1112
6d0a7284949d #109, added optional clone uri when creating repo.
Marcin Kuzminski <marcin@python-works.com>
parents: 1022
diff changeset
171 def RepoForm(edit=False, old_data={}, supported_backends=BACKENDS.keys(),
2460
12fa0c19c42f validating choices for landing_rev
Marcin Kuzminski <marcin@python-works.com>
parents: 2459
diff changeset
172 repo_groups=[], landing_revs=[]):
265
0e5455fda8fd Implemented basic repository managment. Implemented repo2db mappings, model, helpers updates and code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents: 242
diff changeset
173 class _RepoForm(formencode.Schema):
0e5455fda8fd Implemented basic repository managment. Implemented repo2db mappings, model, helpers updates and code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents: 242
diff changeset
174 allow_extra_fields = True
296
29370bb76fa6 first permissions commit: added permission managment on repository edit. Changed db rmissions, validators.
Marcin Kuzminski <marcin@python-works.com>
parents: 265
diff changeset
175 filter_extra_fields = False
2467
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
176 repo_name = All(v.UnicodeString(strip=True, min=1, not_empty=True),
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
177 v.SlugifyName())
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
178 clone_uri = All(v.UnicodeString(strip=True, min=1, not_empty=False))
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
179 repo_group = v.OneOf(repo_groups, hideList=True)
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
180 repo_type = v.OneOf(supported_backends)
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
181 description = v.UnicodeString(strip=True, min=1, not_empty=False)
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
182 private = v.StringBoolean(if_missing=False)
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
183 enable_statistics = v.StringBoolean(if_missing=False)
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
184 enable_downloads = v.StringBoolean(if_missing=False)
2726
aa17c7a1b8a5 Implemented basic locking functionality.
Marcin Kuzminski <marcin@python-works.com>
parents: 2719
diff changeset
185 enable_locking = v.StringBoolean(if_missing=False)
2467
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
186 landing_rev = v.OneOf(landing_revs, hideList=True)
1112
6d0a7284949d #109, added optional clone uri when creating repo.
Marcin Kuzminski <marcin@python-works.com>
parents: 1022
diff changeset
187
265
0e5455fda8fd Implemented basic repository managment. Implemented repo2db mappings, model, helpers updates and code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents: 242
diff changeset
188 if edit:
1014
6fdc3ff65fce #56 added assignments of users groups into repository
Marcin Kuzminski <marcin@python-works.com>
parents: 1013
diff changeset
189 #this is repo owner
2467
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
190 user = All(v.UnicodeString(not_empty=True), v.ValidRepoUser())
629
7e536d1af60d Code refactoring,models renames
Marcin Kuzminski <marcin@python-works.com>
parents: 555
diff changeset
191
2467
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
192 chained_validators = [v.ValidCloneUri(),
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
193 v.ValidRepoName(edit, old_data),
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
194 v.ValidPerms()]
265
0e5455fda8fd Implemented basic repository managment. Implemented repo2db mappings, model, helpers updates and code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents: 242
diff changeset
195 return _RepoForm
320
05b212954275 Implemented owner settings, as separete posibility to edit repositry by non administrative owner of repository
Marcin Kuzminski <marcin@python-works.com>
parents: 310
diff changeset
196
1950
4ae17f819ee8 #344 optional firstname lastname on user creation
Marcin Kuzminski <marcin@python-works.com>
parents: 1898
diff changeset
197
2460
12fa0c19c42f validating choices for landing_rev
Marcin Kuzminski <marcin@python-works.com>
parents: 2459
diff changeset
198 def RepoForkForm(edit=False, old_data={}, supported_backends=BACKENDS.keys(),
2485
133209bf300c added landing revision into fork create form
Marcin Kuzminski <marcin@python-works.com>
parents: 2480
diff changeset
199 repo_groups=[], landing_revs=[]):
530
a08f610e545e Implemented server side forks
Marcin Kuzminski <marcin@python-works.com>
parents: 529
diff changeset
200 class _RepoForkForm(formencode.Schema):
a08f610e545e Implemented server side forks
Marcin Kuzminski <marcin@python-works.com>
parents: 529
diff changeset
201 allow_extra_fields = True
a08f610e545e Implemented server side forks
Marcin Kuzminski <marcin@python-works.com>
parents: 529
diff changeset
202 filter_extra_fields = False
2467
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
203 repo_name = All(v.UnicodeString(strip=True, min=1, not_empty=True),
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
204 v.SlugifyName())
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
205 repo_group = v.OneOf(repo_groups, hideList=True)
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
206 repo_type = All(v.ValidForkType(old_data), v.OneOf(supported_backends))
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
207 description = v.UnicodeString(strip=True, min=1, not_empty=True)
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
208 private = v.StringBoolean(if_missing=False)
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
209 copy_permissions = v.StringBoolean(if_missing=False)
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
210 update_after_clone = v.StringBoolean(if_missing=False)
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
211 fork_parent_id = v.UnicodeString()
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
212 chained_validators = [v.ValidForkName(edit, old_data)]
2485
133209bf300c added landing revision into fork create form
Marcin Kuzminski <marcin@python-works.com>
parents: 2480
diff changeset
213 landing_rev = v.OneOf(landing_revs, hideList=True)
1366
9c0f5d558789 fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents: 1364
diff changeset
214
530
a08f610e545e Implemented server side forks
Marcin Kuzminski <marcin@python-works.com>
parents: 529
diff changeset
215 return _RepoForkForm
a08f610e545e Implemented server side forks
Marcin Kuzminski <marcin@python-works.com>
parents: 529
diff changeset
216
1950
4ae17f819ee8 #344 optional firstname lastname on user creation
Marcin Kuzminski <marcin@python-works.com>
parents: 1898
diff changeset
217
2467
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
218 def RepoSettingsForm(edit=False, old_data={},
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
219 supported_backends=BACKENDS.keys(), repo_groups=[],
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
220 landing_revs=[]):
320
05b212954275 Implemented owner settings, as separete posibility to edit repositry by non administrative owner of repository
Marcin Kuzminski <marcin@python-works.com>
parents: 310
diff changeset
221 class _RepoForm(formencode.Schema):
05b212954275 Implemented owner settings, as separete posibility to edit repositry by non administrative owner of repository
Marcin Kuzminski <marcin@python-works.com>
parents: 310
diff changeset
222 allow_extra_fields = True
05b212954275 Implemented owner settings, as separete posibility to edit repositry by non administrative owner of repository
Marcin Kuzminski <marcin@python-works.com>
parents: 310
diff changeset
223 filter_extra_fields = False
2467
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
224 repo_name = All(v.UnicodeString(strip=True, min=1, not_empty=True),
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
225 v.SlugifyName())
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
226 description = v.UnicodeString(strip=True, min=1, not_empty=True)
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
227 repo_group = v.OneOf(repo_groups, hideList=True)
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
228 private = v.StringBoolean(if_missing=False)
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
229 landing_rev = v.OneOf(landing_revs, hideList=True)
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
230 chained_validators = [v.ValidRepoName(edit, old_data), v.ValidPerms(),
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
231 v.ValidSettings()]
320
05b212954275 Implemented owner settings, as separete posibility to edit repositry by non administrative owner of repository
Marcin Kuzminski <marcin@python-works.com>
parents: 310
diff changeset
232 return _RepoForm
05b212954275 Implemented owner settings, as separete posibility to edit repositry by non administrative owner of repository
Marcin Kuzminski <marcin@python-works.com>
parents: 310
diff changeset
233
05b212954275 Implemented owner settings, as separete posibility to edit repositry by non administrative owner of repository
Marcin Kuzminski <marcin@python-works.com>
parents: 310
diff changeset
234
350
664a5b8c551a Added application settings, are now customizable from database
Marcin Kuzminski <marcin@python-works.com>
parents: 347
diff changeset
235 def ApplicationSettingsForm():
664a5b8c551a Added application settings, are now customizable from database
Marcin Kuzminski <marcin@python-works.com>
parents: 347
diff changeset
236 class _ApplicationSettingsForm(formencode.Schema):
664a5b8c551a Added application settings, are now customizable from database
Marcin Kuzminski <marcin@python-works.com>
parents: 347
diff changeset
237 allow_extra_fields = True
664a5b8c551a Added application settings, are now customizable from database
Marcin Kuzminski <marcin@python-works.com>
parents: 347
diff changeset
238 filter_extra_fields = False
2467
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
239 rhodecode_title = v.UnicodeString(strip=True, min=1, not_empty=True)
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
240 rhodecode_realm = v.UnicodeString(strip=True, min=1, not_empty=True)
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
241 rhodecode_ga_code = v.UnicodeString(strip=True, min=1, not_empty=False)
629
7e536d1af60d Code refactoring,models renames
Marcin Kuzminski <marcin@python-works.com>
parents: 555
diff changeset
242
350
664a5b8c551a Added application settings, are now customizable from database
Marcin Kuzminski <marcin@python-works.com>
parents: 347
diff changeset
243 return _ApplicationSettingsForm
629
7e536d1af60d Code refactoring,models renames
Marcin Kuzminski <marcin@python-works.com>
parents: 555
diff changeset
244
1950
4ae17f819ee8 #344 optional firstname lastname on user creation
Marcin Kuzminski <marcin@python-works.com>
parents: 1898
diff changeset
245
2674
a221706dab50 merged + fixed pull request #62: Implemented metatags and visualisation options.
Marcin Kuzminski <marcin@python-works.com>
parents: 2595
diff changeset
246 def ApplicationVisualisationForm():
a221706dab50 merged + fixed pull request #62: Implemented metatags and visualisation options.
Marcin Kuzminski <marcin@python-works.com>
parents: 2595
diff changeset
247 class _ApplicationVisualisationForm(formencode.Schema):
a221706dab50 merged + fixed pull request #62: Implemented metatags and visualisation options.
Marcin Kuzminski <marcin@python-works.com>
parents: 2595
diff changeset
248 allow_extra_fields = True
a221706dab50 merged + fixed pull request #62: Implemented metatags and visualisation options.
Marcin Kuzminski <marcin@python-works.com>
parents: 2595
diff changeset
249 filter_extra_fields = False
a221706dab50 merged + fixed pull request #62: Implemented metatags and visualisation options.
Marcin Kuzminski <marcin@python-works.com>
parents: 2595
diff changeset
250 rhodecode_show_public_icon = v.StringBoolean(if_missing=False)
a221706dab50 merged + fixed pull request #62: Implemented metatags and visualisation options.
Marcin Kuzminski <marcin@python-works.com>
parents: 2595
diff changeset
251 rhodecode_show_private_icon = v.StringBoolean(if_missing=False)
a221706dab50 merged + fixed pull request #62: Implemented metatags and visualisation options.
Marcin Kuzminski <marcin@python-works.com>
parents: 2595
diff changeset
252 rhodecode_stylify_metatags = v.StringBoolean(if_missing=False)
a221706dab50 merged + fixed pull request #62: Implemented metatags and visualisation options.
Marcin Kuzminski <marcin@python-works.com>
parents: 2595
diff changeset
253
a221706dab50 merged + fixed pull request #62: Implemented metatags and visualisation options.
Marcin Kuzminski <marcin@python-works.com>
parents: 2595
diff changeset
254 return _ApplicationVisualisationForm
a221706dab50 merged + fixed pull request #62: Implemented metatags and visualisation options.
Marcin Kuzminski <marcin@python-works.com>
parents: 2595
diff changeset
255
a221706dab50 merged + fixed pull request #62: Implemented metatags and visualisation options.
Marcin Kuzminski <marcin@python-works.com>
parents: 2595
diff changeset
256
388
3bcf9529d221 Added new application settings,Push ssl and repositories path
Marcin Kuzminski <marcin@python-works.com>
parents: 381
diff changeset
257 def ApplicationUiSettingsForm():
3bcf9529d221 Added new application settings,Push ssl and repositories path
Marcin Kuzminski <marcin@python-works.com>
parents: 381
diff changeset
258 class _ApplicationUiSettingsForm(formencode.Schema):
3bcf9529d221 Added new application settings,Push ssl and repositories path
Marcin Kuzminski <marcin@python-works.com>
parents: 381
diff changeset
259 allow_extra_fields = True
3bcf9529d221 Added new application settings,Push ssl and repositories path
Marcin Kuzminski <marcin@python-works.com>
parents: 381
diff changeset
260 filter_extra_fields = False
2674
a221706dab50 merged + fixed pull request #62: Implemented metatags and visualisation options.
Marcin Kuzminski <marcin@python-works.com>
parents: 2595
diff changeset
261 web_push_ssl = v.StringBoolean(if_missing=False)
2467
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
262 paths_root_path = All(
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
263 v.ValidPath(),
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
264 v.UnicodeString(strip=True, min=1, not_empty=True)
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
265 )
2674
a221706dab50 merged + fixed pull request #62: Implemented metatags and visualisation options.
Marcin Kuzminski <marcin@python-works.com>
parents: 2595
diff changeset
266 hooks_changegroup_update = v.StringBoolean(if_missing=False)
a221706dab50 merged + fixed pull request #62: Implemented metatags and visualisation options.
Marcin Kuzminski <marcin@python-works.com>
parents: 2595
diff changeset
267 hooks_changegroup_repo_size = v.StringBoolean(if_missing=False)
a221706dab50 merged + fixed pull request #62: Implemented metatags and visualisation options.
Marcin Kuzminski <marcin@python-works.com>
parents: 2595
diff changeset
268 hooks_changegroup_push_logger = v.StringBoolean(if_missing=False)
2726
aa17c7a1b8a5 Implemented basic locking functionality.
Marcin Kuzminski <marcin@python-works.com>
parents: 2719
diff changeset
269 hooks_outgoing_pull_logger = v.StringBoolean(if_missing=False)
629
7e536d1af60d Code refactoring,models renames
Marcin Kuzminski <marcin@python-works.com>
parents: 555
diff changeset
270
2708
9bce679a3f49 Added form for controlling mercurial extensions
Marcin Kuzminski <marcin@python-works.com>
parents: 2674
diff changeset
271 extensions_largefiles = v.StringBoolean(if_missing=False)
9bce679a3f49 Added form for controlling mercurial extensions
Marcin Kuzminski <marcin@python-works.com>
parents: 2674
diff changeset
272 extensions_hgsubversion = v.StringBoolean(if_missing=False)
9bce679a3f49 Added form for controlling mercurial extensions
Marcin Kuzminski <marcin@python-works.com>
parents: 2674
diff changeset
273 extensions_hggit = v.StringBoolean(if_missing=False)
9bce679a3f49 Added form for controlling mercurial extensions
Marcin Kuzminski <marcin@python-works.com>
parents: 2674
diff changeset
274
388
3bcf9529d221 Added new application settings,Push ssl and repositories path
Marcin Kuzminski <marcin@python-works.com>
parents: 381
diff changeset
275 return _ApplicationUiSettingsForm
320
05b212954275 Implemented owner settings, as separete posibility to edit repositry by non administrative owner of repository
Marcin Kuzminski <marcin@python-works.com>
parents: 310
diff changeset
276
1950
4ae17f819ee8 #344 optional firstname lastname on user creation
Marcin Kuzminski <marcin@python-works.com>
parents: 1898
diff changeset
277
2709
d2d35cf2b351 RhodeCode now has a option to explicitly set forking permissions. ref #508
Marcin Kuzminski <marcin@python-works.com>
parents: 2708
diff changeset
278 def DefaultPermissionsForm(perms_choices, register_choices, create_choices,
d2d35cf2b351 RhodeCode now has a option to explicitly set forking permissions. ref #508
Marcin Kuzminski <marcin@python-works.com>
parents: 2708
diff changeset
279 fork_choices):
417
3ed2d46a2ca7 permission refactoring,
Marcin Kuzminski <marcin@python-works.com>
parents: 416
diff changeset
280 class _DefaultPermissionsForm(formencode.Schema):
3ed2d46a2ca7 permission refactoring,
Marcin Kuzminski <marcin@python-works.com>
parents: 416
diff changeset
281 allow_extra_fields = True
3ed2d46a2ca7 permission refactoring,
Marcin Kuzminski <marcin@python-works.com>
parents: 416
diff changeset
282 filter_extra_fields = True
2467
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
283 overwrite_default = v.StringBoolean(if_missing=False)
2674
a221706dab50 merged + fixed pull request #62: Implemented metatags and visualisation options.
Marcin Kuzminski <marcin@python-works.com>
parents: 2595
diff changeset
284 anonymous = v.StringBoolean(if_missing=False)
2467
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
285 default_perm = v.OneOf(perms_choices)
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
286 default_register = v.OneOf(register_choices)
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
287 default_create = v.OneOf(create_choices)
2709
d2d35cf2b351 RhodeCode now has a option to explicitly set forking permissions. ref #508
Marcin Kuzminski <marcin@python-works.com>
parents: 2708
diff changeset
288 default_fork = v.OneOf(fork_choices)
629
7e536d1af60d Code refactoring,models renames
Marcin Kuzminski <marcin@python-works.com>
parents: 555
diff changeset
289
417
3ed2d46a2ca7 permission refactoring,
Marcin Kuzminski <marcin@python-works.com>
parents: 416
diff changeset
290 return _DefaultPermissionsForm
705
9e9f1b919c0c implements #60, ldap configuration and authentication.
Marcin Kuzminski <marcin@python-works.com>
parents: 699
diff changeset
291
9e9f1b919c0c implements #60, ldap configuration and authentication.
Marcin Kuzminski <marcin@python-works.com>
parents: 699
diff changeset
292
2467
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
293 def LdapSettingsForm(tls_reqcert_choices, search_scope_choices,
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
294 tls_kind_choices):
705
9e9f1b919c0c implements #60, ldap configuration and authentication.
Marcin Kuzminski <marcin@python-works.com>
parents: 699
diff changeset
295 class _LdapSettingsForm(formencode.Schema):
9e9f1b919c0c implements #60, ldap configuration and authentication.
Marcin Kuzminski <marcin@python-works.com>
parents: 699
diff changeset
296 allow_extra_fields = True
9e9f1b919c0c implements #60, ldap configuration and authentication.
Marcin Kuzminski <marcin@python-works.com>
parents: 699
diff changeset
297 filter_extra_fields = True
2193
3ea397063fc7 fixed #374 LDAP config is now saved but deactivated if python-ldap lib is missing
Marcin Kuzminski <marcin@python-works.com>
parents: 2181
diff changeset
298 #pre_validators = [LdapLibValidator]
2467
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
299 ldap_active = v.StringBoolean(if_missing=False)
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
300 ldap_host = v.UnicodeString(strip=True,)
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
301 ldap_port = v.Number(strip=True,)
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
302 ldap_tls_kind = v.OneOf(tls_kind_choices)
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
303 ldap_tls_reqcert = v.OneOf(tls_reqcert_choices)
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
304 ldap_dn_user = v.UnicodeString(strip=True,)
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
305 ldap_dn_pass = v.UnicodeString(strip=True,)
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
306 ldap_base_dn = v.UnicodeString(strip=True,)
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
307 ldap_filter = v.UnicodeString(strip=True,)
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
308 ldap_search_scope = v.OneOf(search_scope_choices)
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
309 ldap_attr_login = All(
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
310 v.AttrLoginValidator(),
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
311 v.UnicodeString(strip=True,)
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
312 )
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
313 ldap_attr_firstname = v.UnicodeString(strip=True,)
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
314 ldap_attr_lastname = v.UnicodeString(strip=True,)
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
315 ldap_attr_email = v.UnicodeString(strip=True,)
705
9e9f1b919c0c implements #60, ldap configuration and authentication.
Marcin Kuzminski <marcin@python-works.com>
parents: 699
diff changeset
316
9e9f1b919c0c implements #60, ldap configuration and authentication.
Marcin Kuzminski <marcin@python-works.com>
parents: 699
diff changeset
317 return _LdapSettingsForm
2479
9225597688f4 Added validation into user email map
Marcin Kuzminski <marcin@python-works.com>
parents: 2467
diff changeset
318
9225597688f4 Added validation into user email map
Marcin Kuzminski <marcin@python-works.com>
parents: 2467
diff changeset
319
9225597688f4 Added validation into user email map
Marcin Kuzminski <marcin@python-works.com>
parents: 2467
diff changeset
320 def UserExtraEmailForm():
9225597688f4 Added validation into user email map
Marcin Kuzminski <marcin@python-works.com>
parents: 2467
diff changeset
321 class _UserExtraEmailForm(formencode.Schema):
9225597688f4 Added validation into user email map
Marcin Kuzminski <marcin@python-works.com>
parents: 2467
diff changeset
322 email = All(v.UniqSystemEmail(), v.Email)
9225597688f4 Added validation into user email map
Marcin Kuzminski <marcin@python-works.com>
parents: 2467
diff changeset
323
2480
cb9e73b29a87 User active flag should be default to True
Marcin Kuzminski <marcin@python-works.com>
parents: 2479
diff changeset
324 return _UserExtraEmailForm
2711
1de45f582f9d added more validations when opening pull request
Marcin Kuzminski <marcin@python-works.com>
parents: 2709
diff changeset
325
1de45f582f9d added more validations when opening pull request
Marcin Kuzminski <marcin@python-works.com>
parents: 2709
diff changeset
326
1de45f582f9d added more validations when opening pull request
Marcin Kuzminski <marcin@python-works.com>
parents: 2709
diff changeset
327 def PullRequestForm():
1de45f582f9d added more validations when opening pull request
Marcin Kuzminski <marcin@python-works.com>
parents: 2709
diff changeset
328 class _PullRequestForm(formencode.Schema):
1de45f582f9d added more validations when opening pull request
Marcin Kuzminski <marcin@python-works.com>
parents: 2709
diff changeset
329 allow_extra_fields = True
1de45f582f9d added more validations when opening pull request
Marcin Kuzminski <marcin@python-works.com>
parents: 2709
diff changeset
330 filter_extra_fields = True
1de45f582f9d added more validations when opening pull request
Marcin Kuzminski <marcin@python-works.com>
parents: 2709
diff changeset
331
1de45f582f9d added more validations when opening pull request
Marcin Kuzminski <marcin@python-works.com>
parents: 2709
diff changeset
332 user = v.UnicodeString(strip=True, required=True)
1de45f582f9d added more validations when opening pull request
Marcin Kuzminski <marcin@python-works.com>
parents: 2709
diff changeset
333 org_repo = v.UnicodeString(strip=True, required=True)
1de45f582f9d added more validations when opening pull request
Marcin Kuzminski <marcin@python-works.com>
parents: 2709
diff changeset
334 org_ref = v.UnicodeString(strip=True, required=True)
1de45f582f9d added more validations when opening pull request
Marcin Kuzminski <marcin@python-works.com>
parents: 2709
diff changeset
335 other_repo = v.UnicodeString(strip=True, required=True)
1de45f582f9d added more validations when opening pull request
Marcin Kuzminski <marcin@python-works.com>
parents: 2709
diff changeset
336 other_ref = v.UnicodeString(strip=True, required=True)
2719
2e7f7568ea92 Changed v.Set validation into our own that actually raises exceptions on missing values.
Marcin Kuzminski <marcin@python-works.com>
parents: 2711
diff changeset
337 revisions = All(v.NotReviewedRevisions()(), v.UniqueList(not_empty=True))
2e7f7568ea92 Changed v.Set validation into our own that actually raises exceptions on missing values.
Marcin Kuzminski <marcin@python-works.com>
parents: 2711
diff changeset
338 review_members = v.UniqueList(not_empty=True)
2711
1de45f582f9d added more validations when opening pull request
Marcin Kuzminski <marcin@python-works.com>
parents: 2709
diff changeset
339
1de45f582f9d added more validations when opening pull request
Marcin Kuzminski <marcin@python-works.com>
parents: 2709
diff changeset
340 pullrequest_title = v.UnicodeString(strip=True, required=True, min=3)
1de45f582f9d added more validations when opening pull request
Marcin Kuzminski <marcin@python-works.com>
parents: 2709
diff changeset
341 pullrequest_desc = v.UnicodeString(strip=True, required=False)
1de45f582f9d added more validations when opening pull request
Marcin Kuzminski <marcin@python-works.com>
parents: 2709
diff changeset
342
1de45f582f9d added more validations when opening pull request
Marcin Kuzminski <marcin@python-works.com>
parents: 2709
diff changeset
343 return _PullRequestForm