Mercurial > kallithea
annotate rhodecode/model/forms.py @ 3020:00498b3e4c88 beta
Cleaned the way cache keys are invalidated
should fix issue #504 RhodeCode is showing different
versions of README on different summary page loads
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Fri, 23 Nov 2012 16:59:30 +0100 |
parents | f8d827686e9a |
children | d3200c58764e |
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( |
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) |
2820
c0cc8f8a71b0
Permissions on group can be set in recursive mode setting defined permission to all children
Marcin Kuzminski <marcin@python-works.com>
parents:
2815
diff
changeset
|
131 recursive = v.StringBoolean(if_missing=False) |
2467
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
132 chained_validators = [v.ValidReposGroup(edit, old_data), |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
133 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
|
134 |
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 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
|
136 |
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
|
137 |
722
02bdf2f296ff
fixes #69 password confirmation for register dialog.
Marcin Kuzminski <marcin@python-works.com>
parents:
710
diff
changeset
|
138 def RegisterForm(edit=False, old_data={}): |
02bdf2f296ff
fixes #69 password confirmation for register dialog.
Marcin Kuzminski <marcin@python-works.com>
parents:
710
diff
changeset
|
139 class _RegisterForm(formencode.Schema): |
02bdf2f296ff
fixes #69 password confirmation for register dialog.
Marcin Kuzminski <marcin@python-works.com>
parents:
710
diff
changeset
|
140 allow_extra_fields = True |
02bdf2f296ff
fixes #69 password confirmation for register dialog.
Marcin Kuzminski <marcin@python-works.com>
parents:
710
diff
changeset
|
141 filter_extra_fields = True |
2467
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
142 username = All( |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
143 v.ValidUsername(edit, old_data), |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
144 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
|
145 ) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
146 password = All( |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
147 v.ValidPassword(), |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
148 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
|
149 ) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
150 password_confirmation = All( |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
151 v.ValidPassword(), |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
152 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
|
153 ) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
154 active = v.StringBoolean(if_missing=False) |
2595
6c83dc0226d2
renamed some leftover name -> firstname
Marcin Kuzminski <marcin@python-works.com>
parents:
2544
diff
changeset
|
155 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
|
156 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
|
157 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
|
158 |
2467
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
159 chained_validators = [v.ValidPasswordsMatch()] |
722
02bdf2f296ff
fixes #69 password confirmation for register dialog.
Marcin Kuzminski <marcin@python-works.com>
parents:
710
diff
changeset
|
160 |
02bdf2f296ff
fixes #69 password confirmation for register dialog.
Marcin Kuzminski <marcin@python-works.com>
parents:
710
diff
changeset
|
161 return _RegisterForm |
474
a3d9d24acbec
Implemented password reset(forms/models/ tasks) and mailing tasks.
Marcin Kuzminski <marcin@python-works.com>
parents:
458
diff
changeset
|
162 |
1950
4ae17f819ee8
#344 optional firstname lastname on user creation
Marcin Kuzminski <marcin@python-works.com>
parents:
1898
diff
changeset
|
163 |
474
a3d9d24acbec
Implemented password reset(forms/models/ tasks) and mailing tasks.
Marcin Kuzminski <marcin@python-works.com>
parents:
458
diff
changeset
|
164 def PasswordResetForm(): |
a3d9d24acbec
Implemented password reset(forms/models/ tasks) and mailing tasks.
Marcin Kuzminski <marcin@python-works.com>
parents:
458
diff
changeset
|
165 class _PasswordResetForm(formencode.Schema): |
a3d9d24acbec
Implemented password reset(forms/models/ tasks) and mailing tasks.
Marcin Kuzminski <marcin@python-works.com>
parents:
458
diff
changeset
|
166 allow_extra_fields = True |
a3d9d24acbec
Implemented password reset(forms/models/ tasks) and mailing tasks.
Marcin Kuzminski <marcin@python-works.com>
parents:
458
diff
changeset
|
167 filter_extra_fields = True |
2467
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
168 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
|
169 return _PasswordResetForm |
a3d9d24acbec
Implemented password reset(forms/models/ tasks) and mailing tasks.
Marcin Kuzminski <marcin@python-works.com>
parents:
458
diff
changeset
|
170 |
1950
4ae17f819ee8
#344 optional firstname lastname on user creation
Marcin Kuzminski <marcin@python-works.com>
parents:
1898
diff
changeset
|
171 |
1112
6d0a7284949d
#109, added optional clone uri when creating repo.
Marcin Kuzminski <marcin@python-works.com>
parents:
1022
diff
changeset
|
172 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
|
173 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
|
174 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
|
175 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
|
176 filter_extra_fields = False |
2467
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
177 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
|
178 v.SlugifyName()) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
179 clone_uri = All(v.UnicodeString(strip=True, min=1, not_empty=False)) |
2835
faffec4abbda
Implemented permissions for writing to repo
Marcin Kuzminski <marcin@python-works.com>
parents:
2820
diff
changeset
|
180 repo_group = All(v.CanWriteGroup(), |
faffec4abbda
Implemented permissions for writing to repo
Marcin Kuzminski <marcin@python-works.com>
parents:
2820
diff
changeset
|
181 v.OneOf(repo_groups, hideList=True)) |
2467
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
182 repo_type = v.OneOf(supported_backends) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
183 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
|
184 private = v.StringBoolean(if_missing=False) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
185 enable_statistics = v.StringBoolean(if_missing=False) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
186 enable_downloads = v.StringBoolean(if_missing=False) |
2726
aa17c7a1b8a5
Implemented basic locking functionality.
Marcin Kuzminski <marcin@python-works.com>
parents:
2719
diff
changeset
|
187 enable_locking = v.StringBoolean(if_missing=False) |
2467
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
188 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
|
189 |
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
|
190 if edit: |
1014
6fdc3ff65fce
#56 added assignments of users groups into repository
Marcin Kuzminski <marcin@python-works.com>
parents:
1013
diff
changeset
|
191 #this is repo owner |
2467
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
192 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
|
193 |
2467
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
194 chained_validators = [v.ValidCloneUri(), |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
195 v.ValidRepoName(edit, old_data), |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
196 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
|
197 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
|
198 |
1950
4ae17f819ee8
#344 optional firstname lastname on user creation
Marcin Kuzminski <marcin@python-works.com>
parents:
1898
diff
changeset
|
199 |
2460
12fa0c19c42f
validating choices for landing_rev
Marcin Kuzminski <marcin@python-works.com>
parents:
2459
diff
changeset
|
200 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
|
201 repo_groups=[], landing_revs=[]): |
530
a08f610e545e
Implemented server side forks
Marcin Kuzminski <marcin@python-works.com>
parents:
529
diff
changeset
|
202 class _RepoForkForm(formencode.Schema): |
a08f610e545e
Implemented server side forks
Marcin Kuzminski <marcin@python-works.com>
parents:
529
diff
changeset
|
203 allow_extra_fields = True |
a08f610e545e
Implemented server side forks
Marcin Kuzminski <marcin@python-works.com>
parents:
529
diff
changeset
|
204 filter_extra_fields = False |
2467
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
205 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
|
206 v.SlugifyName()) |
2835
faffec4abbda
Implemented permissions for writing to repo
Marcin Kuzminski <marcin@python-works.com>
parents:
2820
diff
changeset
|
207 repo_group = All(v.CanWriteGroup(), |
faffec4abbda
Implemented permissions for writing to repo
Marcin Kuzminski <marcin@python-works.com>
parents:
2820
diff
changeset
|
208 v.OneOf(repo_groups, hideList=True)) |
2467
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
209 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
|
210 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
|
211 private = v.StringBoolean(if_missing=False) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
212 copy_permissions = v.StringBoolean(if_missing=False) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
213 update_after_clone = v.StringBoolean(if_missing=False) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
214 fork_parent_id = v.UnicodeString() |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
215 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
|
216 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
|
217 |
530
a08f610e545e
Implemented server side forks
Marcin Kuzminski <marcin@python-works.com>
parents:
529
diff
changeset
|
218 return _RepoForkForm |
a08f610e545e
Implemented server side forks
Marcin Kuzminski <marcin@python-works.com>
parents:
529
diff
changeset
|
219 |
1950
4ae17f819ee8
#344 optional firstname lastname on user creation
Marcin Kuzminski <marcin@python-works.com>
parents:
1898
diff
changeset
|
220 |
2467
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
221 def RepoSettingsForm(edit=False, old_data={}, |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
222 supported_backends=BACKENDS.keys(), repo_groups=[], |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
223 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
|
224 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
|
225 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
|
226 filter_extra_fields = False |
2467
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
227 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
|
228 v.SlugifyName()) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
229 description = v.UnicodeString(strip=True, min=1, not_empty=True) |
2986
f8d827686e9a
fixed missing permission for being able to write to group on repository settings ref #468
Marcin Kuzminski <marcin@python-works.com>
parents:
2952
diff
changeset
|
230 repo_group = All(v.CanWriteGroup(), |
f8d827686e9a
fixed missing permission for being able to write to group on repository settings ref #468
Marcin Kuzminski <marcin@python-works.com>
parents:
2952
diff
changeset
|
231 v.OneOf(repo_groups, hideList=True)) |
2467
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
232 private = v.StringBoolean(if_missing=False) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
233 landing_rev = v.OneOf(landing_revs, hideList=True) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
234 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
|
235 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
|
236 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
|
237 |
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
|
238 |
350
664a5b8c551a
Added application settings, are now customizable from database
Marcin Kuzminski <marcin@python-works.com>
parents:
347
diff
changeset
|
239 def ApplicationSettingsForm(): |
664a5b8c551a
Added application settings, are now customizable from database
Marcin Kuzminski <marcin@python-works.com>
parents:
347
diff
changeset
|
240 class _ApplicationSettingsForm(formencode.Schema): |
664a5b8c551a
Added application settings, are now customizable from database
Marcin Kuzminski <marcin@python-works.com>
parents:
347
diff
changeset
|
241 allow_extra_fields = True |
664a5b8c551a
Added application settings, are now customizable from database
Marcin Kuzminski <marcin@python-works.com>
parents:
347
diff
changeset
|
242 filter_extra_fields = False |
2467
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
243 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
|
244 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
|
245 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
|
246 |
350
664a5b8c551a
Added application settings, are now customizable from database
Marcin Kuzminski <marcin@python-works.com>
parents:
347
diff
changeset
|
247 return _ApplicationSettingsForm |
629
7e536d1af60d
Code refactoring,models renames
Marcin Kuzminski <marcin@python-works.com>
parents:
555
diff
changeset
|
248 |
1950
4ae17f819ee8
#344 optional firstname lastname on user creation
Marcin Kuzminski <marcin@python-works.com>
parents:
1898
diff
changeset
|
249 |
2674
a221706dab50
merged + fixed pull request #62: Implemented metatags and visualisation options.
Marcin Kuzminski <marcin@python-works.com>
parents:
2595
diff
changeset
|
250 def ApplicationVisualisationForm(): |
a221706dab50
merged + fixed pull request #62: Implemented metatags and visualisation options.
Marcin Kuzminski <marcin@python-works.com>
parents:
2595
diff
changeset
|
251 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
|
252 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
|
253 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
|
254 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
|
255 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
|
256 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
|
257 |
2936
62e493c7f436
Added lightweight dashboard option. ref #500
Marcin Kuzminski <marcin@python-works.com>
parents:
2893
diff
changeset
|
258 rhodecode_lightweight_dashboard = v.StringBoolean(if_missing=False) |
2952
029a40c58df7
Added lightweight journal option for visual
Marcin Kuzminski <marcin@python-works.com>
parents:
2936
diff
changeset
|
259 rhodecode_lightweight_journal = v.StringBoolean(if_missing=False) |
2936
62e493c7f436
Added lightweight dashboard option. ref #500
Marcin Kuzminski <marcin@python-works.com>
parents:
2893
diff
changeset
|
260 |
2674
a221706dab50
merged + fixed pull request #62: Implemented metatags and visualisation options.
Marcin Kuzminski <marcin@python-works.com>
parents:
2595
diff
changeset
|
261 return _ApplicationVisualisationForm |
a221706dab50
merged + fixed pull request #62: Implemented metatags and visualisation options.
Marcin Kuzminski <marcin@python-works.com>
parents:
2595
diff
changeset
|
262 |
a221706dab50
merged + fixed pull request #62: Implemented metatags and visualisation options.
Marcin Kuzminski <marcin@python-works.com>
parents:
2595
diff
changeset
|
263 |
388
3bcf9529d221
Added new application settings,Push ssl and repositories path
Marcin Kuzminski <marcin@python-works.com>
parents:
381
diff
changeset
|
264 def ApplicationUiSettingsForm(): |
3bcf9529d221
Added new application settings,Push ssl and repositories path
Marcin Kuzminski <marcin@python-works.com>
parents:
381
diff
changeset
|
265 class _ApplicationUiSettingsForm(formencode.Schema): |
3bcf9529d221
Added new application settings,Push ssl and repositories path
Marcin Kuzminski <marcin@python-works.com>
parents:
381
diff
changeset
|
266 allow_extra_fields = True |
3bcf9529d221
Added new application settings,Push ssl and repositories path
Marcin Kuzminski <marcin@python-works.com>
parents:
381
diff
changeset
|
267 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
|
268 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
|
269 paths_root_path = All( |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
270 v.ValidPath(), |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
271 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
|
272 ) |
2674
a221706dab50
merged + fixed pull request #62: Implemented metatags and visualisation options.
Marcin Kuzminski <marcin@python-works.com>
parents:
2595
diff
changeset
|
273 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
|
274 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
|
275 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
|
276 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
|
277 |
2708
9bce679a3f49
Added form for controlling mercurial extensions
Marcin Kuzminski <marcin@python-works.com>
parents:
2674
diff
changeset
|
278 extensions_largefiles = v.StringBoolean(if_missing=False) |
9bce679a3f49
Added form for controlling mercurial extensions
Marcin Kuzminski <marcin@python-works.com>
parents:
2674
diff
changeset
|
279 extensions_hgsubversion = v.StringBoolean(if_missing=False) |
9bce679a3f49
Added form for controlling mercurial extensions
Marcin Kuzminski <marcin@python-works.com>
parents:
2674
diff
changeset
|
280 extensions_hggit = v.StringBoolean(if_missing=False) |
9bce679a3f49
Added form for controlling mercurial extensions
Marcin Kuzminski <marcin@python-works.com>
parents:
2674
diff
changeset
|
281 |
388
3bcf9529d221
Added new application settings,Push ssl and repositories path
Marcin Kuzminski <marcin@python-works.com>
parents:
381
diff
changeset
|
282 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
|
283 |
1950
4ae17f819ee8
#344 optional firstname lastname on user creation
Marcin Kuzminski <marcin@python-works.com>
parents:
1898
diff
changeset
|
284 |
2709
d2d35cf2b351
RhodeCode now has a option to explicitly set forking permissions. ref #508
Marcin Kuzminski <marcin@python-works.com>
parents:
2708
diff
changeset
|
285 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
|
286 fork_choices): |
417
3ed2d46a2ca7
permission refactoring,
Marcin Kuzminski <marcin@python-works.com>
parents:
416
diff
changeset
|
287 class _DefaultPermissionsForm(formencode.Schema): |
3ed2d46a2ca7
permission refactoring,
Marcin Kuzminski <marcin@python-works.com>
parents:
416
diff
changeset
|
288 allow_extra_fields = True |
3ed2d46a2ca7
permission refactoring,
Marcin Kuzminski <marcin@python-works.com>
parents:
416
diff
changeset
|
289 filter_extra_fields = True |
2467
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
290 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
|
291 anonymous = v.StringBoolean(if_missing=False) |
2467
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
292 default_perm = v.OneOf(perms_choices) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
293 default_register = v.OneOf(register_choices) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
294 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
|
295 default_fork = v.OneOf(fork_choices) |
629
7e536d1af60d
Code refactoring,models renames
Marcin Kuzminski <marcin@python-works.com>
parents:
555
diff
changeset
|
296 |
417
3ed2d46a2ca7
permission refactoring,
Marcin Kuzminski <marcin@python-works.com>
parents:
416
diff
changeset
|
297 return _DefaultPermissionsForm |
705
9e9f1b919c0c
implements #60, ldap configuration and authentication.
Marcin Kuzminski <marcin@python-works.com>
parents:
699
diff
changeset
|
298 |
9e9f1b919c0c
implements #60, ldap configuration and authentication.
Marcin Kuzminski <marcin@python-works.com>
parents:
699
diff
changeset
|
299 |
2467
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
300 def LdapSettingsForm(tls_reqcert_choices, search_scope_choices, |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
301 tls_kind_choices): |
705
9e9f1b919c0c
implements #60, ldap configuration and authentication.
Marcin Kuzminski <marcin@python-works.com>
parents:
699
diff
changeset
|
302 class _LdapSettingsForm(formencode.Schema): |
9e9f1b919c0c
implements #60, ldap configuration and authentication.
Marcin Kuzminski <marcin@python-works.com>
parents:
699
diff
changeset
|
303 allow_extra_fields = True |
9e9f1b919c0c
implements #60, ldap configuration and authentication.
Marcin Kuzminski <marcin@python-works.com>
parents:
699
diff
changeset
|
304 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
|
305 #pre_validators = [LdapLibValidator] |
2467
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
306 ldap_active = v.StringBoolean(if_missing=False) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
307 ldap_host = v.UnicodeString(strip=True,) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
308 ldap_port = v.Number(strip=True,) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
309 ldap_tls_kind = v.OneOf(tls_kind_choices) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
310 ldap_tls_reqcert = v.OneOf(tls_reqcert_choices) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
311 ldap_dn_user = v.UnicodeString(strip=True,) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
312 ldap_dn_pass = v.UnicodeString(strip=True,) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
313 ldap_base_dn = v.UnicodeString(strip=True,) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
314 ldap_filter = v.UnicodeString(strip=True,) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
315 ldap_search_scope = v.OneOf(search_scope_choices) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
316 ldap_attr_login = All( |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
317 v.AttrLoginValidator(), |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
318 v.UnicodeString(strip=True,) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
319 ) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
320 ldap_attr_firstname = v.UnicodeString(strip=True,) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
321 ldap_attr_lastname = v.UnicodeString(strip=True,) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
322 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
|
323 |
9e9f1b919c0c
implements #60, ldap configuration and authentication.
Marcin Kuzminski <marcin@python-works.com>
parents:
699
diff
changeset
|
324 return _LdapSettingsForm |
2479
9225597688f4
Added validation into user email map
Marcin Kuzminski <marcin@python-works.com>
parents:
2467
diff
changeset
|
325 |
9225597688f4
Added validation into user email map
Marcin Kuzminski <marcin@python-works.com>
parents:
2467
diff
changeset
|
326 |
9225597688f4
Added validation into user email map
Marcin Kuzminski <marcin@python-works.com>
parents:
2467
diff
changeset
|
327 def UserExtraEmailForm(): |
9225597688f4
Added validation into user email map
Marcin Kuzminski <marcin@python-works.com>
parents:
2467
diff
changeset
|
328 class _UserExtraEmailForm(formencode.Schema): |
9225597688f4
Added validation into user email map
Marcin Kuzminski <marcin@python-works.com>
parents:
2467
diff
changeset
|
329 email = All(v.UniqSystemEmail(), v.Email) |
9225597688f4
Added validation into user email map
Marcin Kuzminski <marcin@python-works.com>
parents:
2467
diff
changeset
|
330 |
2480
cb9e73b29a87
User active flag should be default to True
Marcin Kuzminski <marcin@python-works.com>
parents:
2479
diff
changeset
|
331 return _UserExtraEmailForm |
2711
1de45f582f9d
added more validations when opening pull request
Marcin Kuzminski <marcin@python-works.com>
parents:
2709
diff
changeset
|
332 |
1de45f582f9d
added more validations when opening pull request
Marcin Kuzminski <marcin@python-works.com>
parents:
2709
diff
changeset
|
333 |
2893
eb180eb16c18
Fixed #585, checks for status of revision where to strict, and made opening pull request with those revision impossible due to previosly set status.
Marcin Kuzminski <marcin@python-works.com>
parents:
2835
diff
changeset
|
334 def PullRequestForm(repo_id): |
2711
1de45f582f9d
added more validations when opening pull request
Marcin Kuzminski <marcin@python-works.com>
parents:
2709
diff
changeset
|
335 class _PullRequestForm(formencode.Schema): |
1de45f582f9d
added more validations when opening pull request
Marcin Kuzminski <marcin@python-works.com>
parents:
2709
diff
changeset
|
336 allow_extra_fields = True |
1de45f582f9d
added more validations when opening pull request
Marcin Kuzminski <marcin@python-works.com>
parents:
2709
diff
changeset
|
337 filter_extra_fields = True |
1de45f582f9d
added more validations when opening pull request
Marcin Kuzminski <marcin@python-works.com>
parents:
2709
diff
changeset
|
338 |
1de45f582f9d
added more validations when opening pull request
Marcin Kuzminski <marcin@python-works.com>
parents:
2709
diff
changeset
|
339 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
|
340 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
|
341 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
|
342 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
|
343 other_ref = v.UnicodeString(strip=True, required=True) |
2893
eb180eb16c18
Fixed #585, checks for status of revision where to strict, and made opening pull request with those revision impossible due to previosly set status.
Marcin Kuzminski <marcin@python-works.com>
parents:
2835
diff
changeset
|
344 revisions = All(v.NotReviewedRevisions(repo_id)(), v.UniqueList(not_empty=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
|
345 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
|
346 |
1de45f582f9d
added more validations when opening pull request
Marcin Kuzminski <marcin@python-works.com>
parents:
2709
diff
changeset
|
347 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
|
348 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
|
349 |
2815
acc05c33cc0c
White space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
2749
diff
changeset
|
350 return _PullRequestForm |