Mercurial > kallithea
annotate rhodecode/model/forms.py @ 2467:4419551b2915 codereview
Switched forms to new validators
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Sun, 17 Jun 2012 21:37:07 +0200 |
parents | 12fa0c19c42f |
children | 9225597688f4 |
rev | line source |
---|---|
0 | 1 """ this is forms validation classes |
2 http://formencode.org/module-formencode.validators.html | |
3 for list off all availible validators | |
4 | |
5 we can create our own validators | |
6 | |
7 The table below outlines the options which can be used in a schema in addition to the validators themselves | |
8 pre_validators [] These validators will be applied before the schema | |
9 chained_validators [] These validators will be applied after the schema | |
10 allow_extra_fields False If True, then it is not an error when keys that aren't associated with a validator are present | |
11 filter_extra_fields False If True, then keys that aren't associated with a validator are removed | |
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 | 16 <name> = formencode.validators.<name of validator> |
17 <name> must equal form name | |
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 | 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 | 35 class LoginForm(formencode.Schema): |
36 allow_extra_fields = True | |
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 | 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 | 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( |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
69 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
|
70 ) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
71 password_confirmation = All( |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
72 v.ValidPassword(), |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
73 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
|
74 ) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
75 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
|
76 else: |
2467
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
77 password = All( |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
78 v.ValidPassword(), |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
79 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
|
80 ) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
81 password_confirmation = All( |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
82 v.ValidPassword(), |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
83 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
|
84 ) |
1722
e7eef7a1db6a
#235 forking page repo group selection
Marcin Kuzminski <marcin@python-works.com>
parents:
1633
diff
changeset
|
85 |
2467
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
86 active = v.StringBoolean(if_missing=False) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
87 name = 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
|
88 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
|
89 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
|
90 |
2467
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
91 chained_validators = [v.ValidPasswordsMatch()] |
722
02bdf2f296ff
fixes #69 password confirmation for register dialog.
Marcin Kuzminski <marcin@python-works.com>
parents:
710
diff
changeset
|
92 |
238
a55c17874486
Rewrite of user managment, improved forms, added some user info
Marcin Kuzminski <marcin@python-works.com>
parents:
234
diff
changeset
|
93 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
|
94 |
959
fff21c9b075c
#56 fixed found bugs, implemented adding of new group + forms+validators
Marcin Kuzminski <marcin@python-works.com>
parents:
891
diff
changeset
|
95 |
972
2c8fd84935a4
#56 implemented users groups editing,
Marcin Kuzminski <marcin@python-works.com>
parents:
962
diff
changeset
|
96 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
|
97 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
|
98 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
|
99 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
|
100 |
2467
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
101 users_group_name = All( |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
102 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
|
103 v.ValidUsersGroup(edit, old_data) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
104 ) |
959
fff21c9b075c
#56 fixed found bugs, implemented adding of new group + forms+validators
Marcin Kuzminski <marcin@python-works.com>
parents:
891
diff
changeset
|
105 |
2467
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
106 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
|
107 |
972
2c8fd84935a4
#56 implemented users groups editing,
Marcin Kuzminski <marcin@python-works.com>
parents:
962
diff
changeset
|
108 if edit: |
2467
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
109 users_group_members = v.OneOf( |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
110 available_members, hideList=False, testValueList=True, |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
111 if_missing=None, not_empty=False |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
112 ) |
972
2c8fd84935a4
#56 implemented users groups editing,
Marcin Kuzminski <marcin@python-works.com>
parents:
962
diff
changeset
|
113 |
959
fff21c9b075c
#56 fixed found bugs, implemented adding of new group + forms+validators
Marcin Kuzminski <marcin@python-works.com>
parents:
891
diff
changeset
|
114 return _UsersGroupForm |
fff21c9b075c
#56 fixed found bugs, implemented adding of new group + forms+validators
Marcin Kuzminski <marcin@python-works.com>
parents:
891
diff
changeset
|
115 |
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
|
116 |
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
|
117 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
|
118 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
|
119 allow_extra_fields = True |
1982
87f0800abc7b
#227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents:
1976
diff
changeset
|
120 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
|
121 |
2467
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
122 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
|
123 v.SlugifyName()) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
124 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
|
125 not_empty=True) |
2467
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
126 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
|
127 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
|
128 if_missing=None, not_empty=False) |
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 |
2467
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
130 chained_validators = [v.ValidReposGroup(edit, old_data), |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
131 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
|
132 |
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 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
|
134 |
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
|
135 |
722
02bdf2f296ff
fixes #69 password confirmation for register dialog.
Marcin Kuzminski <marcin@python-works.com>
parents:
710
diff
changeset
|
136 def RegisterForm(edit=False, old_data={}): |
02bdf2f296ff
fixes #69 password confirmation for register dialog.
Marcin Kuzminski <marcin@python-works.com>
parents:
710
diff
changeset
|
137 class _RegisterForm(formencode.Schema): |
02bdf2f296ff
fixes #69 password confirmation for register dialog.
Marcin Kuzminski <marcin@python-works.com>
parents:
710
diff
changeset
|
138 allow_extra_fields = True |
02bdf2f296ff
fixes #69 password confirmation for register dialog.
Marcin Kuzminski <marcin@python-works.com>
parents:
710
diff
changeset
|
139 filter_extra_fields = True |
2467
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
140 username = All( |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
141 v.ValidUsername(edit, old_data), |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
142 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
|
143 ) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
144 password = All( |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
145 v.ValidPassword(), |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
146 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
|
147 ) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
148 password_confirmation = All( |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
149 v.ValidPassword(), |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
150 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
|
151 ) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
152 active = v.StringBoolean(if_missing=False) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
153 name = 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
|
154 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
|
155 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
|
156 |
2467
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
157 chained_validators = [v.ValidPasswordsMatch()] |
722
02bdf2f296ff
fixes #69 password confirmation for register dialog.
Marcin Kuzminski <marcin@python-works.com>
parents:
710
diff
changeset
|
158 |
02bdf2f296ff
fixes #69 password confirmation for register dialog.
Marcin Kuzminski <marcin@python-works.com>
parents:
710
diff
changeset
|
159 return _RegisterForm |
474
a3d9d24acbec
Implemented password reset(forms/models/ tasks) and mailing tasks.
Marcin Kuzminski <marcin@python-works.com>
parents:
458
diff
changeset
|
160 |
1950
4ae17f819ee8
#344 optional firstname lastname on user creation
Marcin Kuzminski <marcin@python-works.com>
parents:
1898
diff
changeset
|
161 |
474
a3d9d24acbec
Implemented password reset(forms/models/ tasks) and mailing tasks.
Marcin Kuzminski <marcin@python-works.com>
parents:
458
diff
changeset
|
162 def PasswordResetForm(): |
a3d9d24acbec
Implemented password reset(forms/models/ tasks) and mailing tasks.
Marcin Kuzminski <marcin@python-works.com>
parents:
458
diff
changeset
|
163 class _PasswordResetForm(formencode.Schema): |
a3d9d24acbec
Implemented password reset(forms/models/ tasks) and mailing tasks.
Marcin Kuzminski <marcin@python-works.com>
parents:
458
diff
changeset
|
164 allow_extra_fields = True |
a3d9d24acbec
Implemented password reset(forms/models/ tasks) and mailing tasks.
Marcin Kuzminski <marcin@python-works.com>
parents:
458
diff
changeset
|
165 filter_extra_fields = True |
2467
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
166 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
|
167 return _PasswordResetForm |
a3d9d24acbec
Implemented password reset(forms/models/ tasks) and mailing tasks.
Marcin Kuzminski <marcin@python-works.com>
parents:
458
diff
changeset
|
168 |
1950
4ae17f819ee8
#344 optional firstname lastname on user creation
Marcin Kuzminski <marcin@python-works.com>
parents:
1898
diff
changeset
|
169 |
1112
6d0a7284949d
#109, added optional clone uri when creating repo.
Marcin Kuzminski <marcin@python-works.com>
parents:
1022
diff
changeset
|
170 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
|
171 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
|
172 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
|
173 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
|
174 filter_extra_fields = False |
2467
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
175 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
|
176 v.SlugifyName()) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
177 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
|
178 repo_group = v.OneOf(repo_groups, hideList=True) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
179 repo_type = v.OneOf(supported_backends) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
180 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
|
181 private = v.StringBoolean(if_missing=False) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
182 enable_statistics = v.StringBoolean(if_missing=False) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
183 enable_downloads = v.StringBoolean(if_missing=False) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
184 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
|
185 |
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
|
186 if edit: |
1014
6fdc3ff65fce
#56 added assignments of users groups into repository
Marcin Kuzminski <marcin@python-works.com>
parents:
1013
diff
changeset
|
187 #this is repo owner |
2467
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
188 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
|
189 |
2467
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
190 chained_validators = [v.ValidCloneUri(), |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
191 v.ValidRepoName(edit, old_data), |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
192 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
|
193 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
|
194 |
1950
4ae17f819ee8
#344 optional firstname lastname on user creation
Marcin Kuzminski <marcin@python-works.com>
parents:
1898
diff
changeset
|
195 |
2460
12fa0c19c42f
validating choices for landing_rev
Marcin Kuzminski <marcin@python-works.com>
parents:
2459
diff
changeset
|
196 def RepoForkForm(edit=False, old_data={}, supported_backends=BACKENDS.keys(), |
12fa0c19c42f
validating choices for landing_rev
Marcin Kuzminski <marcin@python-works.com>
parents:
2459
diff
changeset
|
197 repo_groups=[]): |
530
a08f610e545e
Implemented server side forks
Marcin Kuzminski <marcin@python-works.com>
parents:
529
diff
changeset
|
198 class _RepoForkForm(formencode.Schema): |
a08f610e545e
Implemented server side forks
Marcin Kuzminski <marcin@python-works.com>
parents:
529
diff
changeset
|
199 allow_extra_fields = True |
a08f610e545e
Implemented server side forks
Marcin Kuzminski <marcin@python-works.com>
parents:
529
diff
changeset
|
200 filter_extra_fields = False |
2467
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
201 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
|
202 v.SlugifyName()) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
203 repo_group = v.OneOf(repo_groups, hideList=True) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
204 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
|
205 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
|
206 private = v.StringBoolean(if_missing=False) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
207 copy_permissions = v.StringBoolean(if_missing=False) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
208 update_after_clone = v.StringBoolean(if_missing=False) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
209 fork_parent_id = v.UnicodeString() |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
210 chained_validators = [v.ValidForkName(edit, old_data)] |
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
|
211 |
530
a08f610e545e
Implemented server side forks
Marcin Kuzminski <marcin@python-works.com>
parents:
529
diff
changeset
|
212 return _RepoForkForm |
a08f610e545e
Implemented server side forks
Marcin Kuzminski <marcin@python-works.com>
parents:
529
diff
changeset
|
213 |
1950
4ae17f819ee8
#344 optional firstname lastname on user creation
Marcin Kuzminski <marcin@python-works.com>
parents:
1898
diff
changeset
|
214 |
2467
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
215 def RepoSettingsForm(edit=False, old_data={}, |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
216 supported_backends=BACKENDS.keys(), repo_groups=[], |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
217 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
|
218 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
|
219 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
|
220 filter_extra_fields = False |
2467
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
221 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
|
222 v.SlugifyName()) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
223 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
|
224 repo_group = v.OneOf(repo_groups, hideList=True) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
225 private = v.StringBoolean(if_missing=False) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
226 landing_rev = v.OneOf(landing_revs, hideList=True) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
227 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
|
228 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
|
229 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
|
230 |
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
|
231 |
350
664a5b8c551a
Added application settings, are now customizable from database
Marcin Kuzminski <marcin@python-works.com>
parents:
347
diff
changeset
|
232 def ApplicationSettingsForm(): |
664a5b8c551a
Added application settings, are now customizable from database
Marcin Kuzminski <marcin@python-works.com>
parents:
347
diff
changeset
|
233 class _ApplicationSettingsForm(formencode.Schema): |
664a5b8c551a
Added application settings, are now customizable from database
Marcin Kuzminski <marcin@python-works.com>
parents:
347
diff
changeset
|
234 allow_extra_fields = True |
664a5b8c551a
Added application settings, are now customizable from database
Marcin Kuzminski <marcin@python-works.com>
parents:
347
diff
changeset
|
235 filter_extra_fields = False |
2467
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
236 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
|
237 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
|
238 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
|
239 |
350
664a5b8c551a
Added application settings, are now customizable from database
Marcin Kuzminski <marcin@python-works.com>
parents:
347
diff
changeset
|
240 return _ApplicationSettingsForm |
629
7e536d1af60d
Code refactoring,models renames
Marcin Kuzminski <marcin@python-works.com>
parents:
555
diff
changeset
|
241 |
1950
4ae17f819ee8
#344 optional firstname lastname on user creation
Marcin Kuzminski <marcin@python-works.com>
parents:
1898
diff
changeset
|
242 |
388
3bcf9529d221
Added new application settings,Push ssl and repositories path
Marcin Kuzminski <marcin@python-works.com>
parents:
381
diff
changeset
|
243 def ApplicationUiSettingsForm(): |
3bcf9529d221
Added new application settings,Push ssl and repositories path
Marcin Kuzminski <marcin@python-works.com>
parents:
381
diff
changeset
|
244 class _ApplicationUiSettingsForm(formencode.Schema): |
3bcf9529d221
Added new application settings,Push ssl and repositories path
Marcin Kuzminski <marcin@python-works.com>
parents:
381
diff
changeset
|
245 allow_extra_fields = True |
3bcf9529d221
Added new application settings,Push ssl and repositories path
Marcin Kuzminski <marcin@python-works.com>
parents:
381
diff
changeset
|
246 filter_extra_fields = False |
2467
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
247 web_push_ssl = v.OneOf(['true', 'false'], if_missing='false') |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
248 paths_root_path = All( |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
249 v.ValidPath(), |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
250 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
|
251 ) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
252 hooks_changegroup_update = v.OneOf(['True', 'False'], |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
253 if_missing=False) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
254 hooks_changegroup_repo_size = v.OneOf(['True', 'False'], |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
255 if_missing=False) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
256 hooks_changegroup_push_logger = v.OneOf(['True', 'False'], |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
257 if_missing=False) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
258 hooks_preoutgoing_pull_logger = v.OneOf(['True', 'False'], |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
259 if_missing=False) |
629
7e536d1af60d
Code refactoring,models renames
Marcin Kuzminski <marcin@python-works.com>
parents:
555
diff
changeset
|
260 |
388
3bcf9529d221
Added new application settings,Push ssl and repositories path
Marcin Kuzminski <marcin@python-works.com>
parents:
381
diff
changeset
|
261 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
|
262 |
1950
4ae17f819ee8
#344 optional firstname lastname on user creation
Marcin Kuzminski <marcin@python-works.com>
parents:
1898
diff
changeset
|
263 |
417
3ed2d46a2ca7
permission refactoring,
Marcin Kuzminski <marcin@python-works.com>
parents:
416
diff
changeset
|
264 def DefaultPermissionsForm(perms_choices, register_choices, create_choices): |
3ed2d46a2ca7
permission refactoring,
Marcin Kuzminski <marcin@python-works.com>
parents:
416
diff
changeset
|
265 class _DefaultPermissionsForm(formencode.Schema): |
3ed2d46a2ca7
permission refactoring,
Marcin Kuzminski <marcin@python-works.com>
parents:
416
diff
changeset
|
266 allow_extra_fields = True |
3ed2d46a2ca7
permission refactoring,
Marcin Kuzminski <marcin@python-works.com>
parents:
416
diff
changeset
|
267 filter_extra_fields = True |
2467
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
268 overwrite_default = v.StringBoolean(if_missing=False) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
269 anonymous = v.OneOf(['True', 'False'], if_missing=False) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
270 default_perm = v.OneOf(perms_choices) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
271 default_register = v.OneOf(register_choices) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
272 default_create = v.OneOf(create_choices) |
629
7e536d1af60d
Code refactoring,models renames
Marcin Kuzminski <marcin@python-works.com>
parents:
555
diff
changeset
|
273 |
417
3ed2d46a2ca7
permission refactoring,
Marcin Kuzminski <marcin@python-works.com>
parents:
416
diff
changeset
|
274 return _DefaultPermissionsForm |
705
9e9f1b919c0c
implements #60, ldap configuration and authentication.
Marcin Kuzminski <marcin@python-works.com>
parents:
699
diff
changeset
|
275 |
9e9f1b919c0c
implements #60, ldap configuration and authentication.
Marcin Kuzminski <marcin@python-works.com>
parents:
699
diff
changeset
|
276 |
2467
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
277 def LdapSettingsForm(tls_reqcert_choices, search_scope_choices, |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
278 tls_kind_choices): |
705
9e9f1b919c0c
implements #60, ldap configuration and authentication.
Marcin Kuzminski <marcin@python-works.com>
parents:
699
diff
changeset
|
279 class _LdapSettingsForm(formencode.Schema): |
9e9f1b919c0c
implements #60, ldap configuration and authentication.
Marcin Kuzminski <marcin@python-works.com>
parents:
699
diff
changeset
|
280 allow_extra_fields = True |
9e9f1b919c0c
implements #60, ldap configuration and authentication.
Marcin Kuzminski <marcin@python-works.com>
parents:
699
diff
changeset
|
281 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
|
282 #pre_validators = [LdapLibValidator] |
2467
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
283 ldap_active = v.StringBoolean(if_missing=False) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
284 ldap_host = v.UnicodeString(strip=True,) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
285 ldap_port = v.Number(strip=True,) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
286 ldap_tls_kind = v.OneOf(tls_kind_choices) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
287 ldap_tls_reqcert = v.OneOf(tls_reqcert_choices) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
288 ldap_dn_user = v.UnicodeString(strip=True,) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
289 ldap_dn_pass = v.UnicodeString(strip=True,) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
290 ldap_base_dn = v.UnicodeString(strip=True,) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
291 ldap_filter = v.UnicodeString(strip=True,) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
292 ldap_search_scope = v.OneOf(search_scope_choices) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
293 ldap_attr_login = All( |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
294 v.AttrLoginValidator(), |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
295 v.UnicodeString(strip=True,) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
296 ) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
297 ldap_attr_firstname = v.UnicodeString(strip=True,) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
298 ldap_attr_lastname = v.UnicodeString(strip=True,) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
299 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
|
300 |
9e9f1b919c0c
implements #60, ldap configuration and authentication.
Marcin Kuzminski <marcin@python-works.com>
parents:
699
diff
changeset
|
301 return _LdapSettingsForm |