Mercurial > kallithea
annotate rhodecode/model/forms.py @ 3852:eae62e28343e beta
handle case of rewrite without an gistid in nginx example
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Sun, 12 May 2013 17:19:21 +0200 |
parents | 2576a20d94ca |
children | 794e6eaad4aa |
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 |
3417
fa6ba6727475
further cleanup of UsersGroup
Mads Kiilerich <madski@unity3d.com>
parents:
3308
diff
changeset
|
97 def UserGroupForm(edit=False, old_data={}, available_members=[]): |
fa6ba6727475
further cleanup of UsersGroup
Mads Kiilerich <madski@unity3d.com>
parents:
3308
diff
changeset
|
98 class _UserGroupForm(formencode.Schema): |
959
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), |
3417
fa6ba6727475
further cleanup of UsersGroup
Mads Kiilerich <madski@unity3d.com>
parents:
3308
diff
changeset
|
104 v.ValidUserGroup(edit, old_data) |
2467
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 |
3417
fa6ba6727475
further cleanup of UsersGroup
Mads Kiilerich <madski@unity3d.com>
parents:
3308
diff
changeset
|
115 return _UserGroupForm |
959
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 |
3222
b4daef4cc26d
Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents:
3175
diff
changeset
|
118 def ReposGroupForm(edit=False, old_data={}, available_groups=[], |
b4daef4cc26d
Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents:
3175
diff
changeset
|
119 can_create_in_root=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
|
120 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
|
121 allow_extra_fields = True |
1982
87f0800abc7b
#227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents:
1976
diff
changeset
|
122 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
|
123 |
2467
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
124 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
|
125 v.SlugifyName()) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
126 group_description = v.UnicodeString(strip=True, min=1, |
3222
b4daef4cc26d
Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents:
3175
diff
changeset
|
127 not_empty=False) |
b4daef4cc26d
Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents:
3175
diff
changeset
|
128 if edit: |
b4daef4cc26d
Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents:
3175
diff
changeset
|
129 #FIXME: do a special check that we cannot move a group to one of |
b4daef4cc26d
Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents:
3175
diff
changeset
|
130 #it's children |
b4daef4cc26d
Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents:
3175
diff
changeset
|
131 pass |
b4daef4cc26d
Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents:
3175
diff
changeset
|
132 group_parent_id = All(v.CanCreateGroup(can_create_in_root), |
b4daef4cc26d
Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents:
3175
diff
changeset
|
133 v.OneOf(available_groups, hideList=False, |
b4daef4cc26d
Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents:
3175
diff
changeset
|
134 testValueList=True, |
b4daef4cc26d
Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents:
3175
diff
changeset
|
135 if_missing=None, not_empty=True)) |
2749
3ed4dae499d0
Recursive set locking on all children of a group.
Marcin Kuzminski <marcin@python-works.com>
parents:
2726
diff
changeset
|
136 enable_locking = v.StringBoolean(if_missing=False) |
3714
7e3d89d9d3a2
- Manage User’s Groups: create, delete, rename, add/remove users inside.
Marcin Kuzminski <marcin@python-works.com>
parents:
3674
diff
changeset
|
137 chained_validators = [v.ValidReposGroup(edit, old_data)] |
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
|
138 |
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
|
139 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
|
140 |
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
|
141 |
722
02bdf2f296ff
fixes #69 password confirmation for register dialog.
Marcin Kuzminski <marcin@python-works.com>
parents:
710
diff
changeset
|
142 def RegisterForm(edit=False, old_data={}): |
02bdf2f296ff
fixes #69 password confirmation for register dialog.
Marcin Kuzminski <marcin@python-works.com>
parents:
710
diff
changeset
|
143 class _RegisterForm(formencode.Schema): |
02bdf2f296ff
fixes #69 password confirmation for register dialog.
Marcin Kuzminski <marcin@python-works.com>
parents:
710
diff
changeset
|
144 allow_extra_fields = True |
02bdf2f296ff
fixes #69 password confirmation for register dialog.
Marcin Kuzminski <marcin@python-works.com>
parents:
710
diff
changeset
|
145 filter_extra_fields = True |
2467
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
146 username = All( |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
147 v.ValidUsername(edit, old_data), |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
148 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
|
149 ) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
150 password = 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 password_confirmation = All( |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
155 v.ValidPassword(), |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
156 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
|
157 ) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
158 active = v.StringBoolean(if_missing=False) |
2595
6c83dc0226d2
renamed some leftover name -> firstname
Marcin Kuzminski <marcin@python-works.com>
parents:
2544
diff
changeset
|
159 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
|
160 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
|
161 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
|
162 |
2467
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
163 chained_validators = [v.ValidPasswordsMatch()] |
722
02bdf2f296ff
fixes #69 password confirmation for register dialog.
Marcin Kuzminski <marcin@python-works.com>
parents:
710
diff
changeset
|
164 |
02bdf2f296ff
fixes #69 password confirmation for register dialog.
Marcin Kuzminski <marcin@python-works.com>
parents:
710
diff
changeset
|
165 return _RegisterForm |
474
a3d9d24acbec
Implemented password reset(forms/models/ tasks) and mailing tasks.
Marcin Kuzminski <marcin@python-works.com>
parents:
458
diff
changeset
|
166 |
1950
4ae17f819ee8
#344 optional firstname lastname on user creation
Marcin Kuzminski <marcin@python-works.com>
parents:
1898
diff
changeset
|
167 |
474
a3d9d24acbec
Implemented password reset(forms/models/ tasks) and mailing tasks.
Marcin Kuzminski <marcin@python-works.com>
parents:
458
diff
changeset
|
168 def PasswordResetForm(): |
a3d9d24acbec
Implemented password reset(forms/models/ tasks) and mailing tasks.
Marcin Kuzminski <marcin@python-works.com>
parents:
458
diff
changeset
|
169 class _PasswordResetForm(formencode.Schema): |
a3d9d24acbec
Implemented password reset(forms/models/ tasks) and mailing tasks.
Marcin Kuzminski <marcin@python-works.com>
parents:
458
diff
changeset
|
170 allow_extra_fields = True |
a3d9d24acbec
Implemented password reset(forms/models/ tasks) and mailing tasks.
Marcin Kuzminski <marcin@python-works.com>
parents:
458
diff
changeset
|
171 filter_extra_fields = True |
2467
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
172 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
|
173 return _PasswordResetForm |
a3d9d24acbec
Implemented password reset(forms/models/ tasks) and mailing tasks.
Marcin Kuzminski <marcin@python-works.com>
parents:
458
diff
changeset
|
174 |
1950
4ae17f819ee8
#344 optional firstname lastname on user creation
Marcin Kuzminski <marcin@python-works.com>
parents:
1898
diff
changeset
|
175 |
1112
6d0a7284949d
#109, added optional clone uri when creating repo.
Marcin Kuzminski <marcin@python-works.com>
parents:
1022
diff
changeset
|
176 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
|
177 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
|
178 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
|
179 allow_extra_fields = True |
3089
4cc9bb83ecb4
Fixed some issues with edit form
Marcin Kuzminski <marcin@python-works.com>
parents:
3056
diff
changeset
|
180 filter_extra_fields = False |
2467
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
181 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
|
182 v.SlugifyName()) |
3524
af96fb19b53a
Pass in old groups data to CanWriteToGroup validator for later skipping group checks.
Marcin Kuzminski <marcin@python-works.com>
parents:
3486
diff
changeset
|
183 repo_group = All(v.CanWriteGroup(old_data), |
2835
faffec4abbda
Implemented permissions for writing to repo
Marcin Kuzminski <marcin@python-works.com>
parents:
2820
diff
changeset
|
184 v.OneOf(repo_groups, hideList=True)) |
2467
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
185 repo_type = v.OneOf(supported_backends) |
3056
6104dfd35b16
Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents:
3052
diff
changeset
|
186 repo_description = v.UnicodeString(strip=True, min=1, not_empty=False) |
6104dfd35b16
Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents:
3052
diff
changeset
|
187 repo_private = v.StringBoolean(if_missing=False) |
3089
4cc9bb83ecb4
Fixed some issues with edit form
Marcin Kuzminski <marcin@python-works.com>
parents:
3056
diff
changeset
|
188 repo_landing_rev = v.OneOf(landing_revs, hideList=True) |
4cc9bb83ecb4
Fixed some issues with edit form
Marcin Kuzminski <marcin@python-works.com>
parents:
3056
diff
changeset
|
189 clone_uri = All(v.UnicodeString(strip=True, min=1, not_empty=False)) |
4cc9bb83ecb4
Fixed some issues with edit form
Marcin Kuzminski <marcin@python-works.com>
parents:
3056
diff
changeset
|
190 |
3056
6104dfd35b16
Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents:
3052
diff
changeset
|
191 repo_enable_statistics = v.StringBoolean(if_missing=False) |
6104dfd35b16
Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents:
3052
diff
changeset
|
192 repo_enable_downloads = v.StringBoolean(if_missing=False) |
6104dfd35b16
Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents:
3052
diff
changeset
|
193 repo_enable_locking = v.StringBoolean(if_missing=False) |
1112
6d0a7284949d
#109, added optional clone uri when creating repo.
Marcin Kuzminski <marcin@python-works.com>
parents:
1022
diff
changeset
|
194 |
265
0e5455fda8fd
Implemented basic repository managment. Implemented repo2db mappings, model, helpers updates and code cleanups
Marcin Kuzminski <marcin@python-works.com>
parents:
242
diff
changeset
|
195 if edit: |
1014
6fdc3ff65fce
#56 added assignments of users groups into repository
Marcin Kuzminski <marcin@python-works.com>
parents:
1013
diff
changeset
|
196 #this is repo owner |
2467
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
197 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
|
198 |
2467
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
199 chained_validators = [v.ValidCloneUri(), |
3628
c734686b3cf2
moved permission management into separate entity.
Marcin Kuzminski <marcin@python-works.com>
parents:
3524
diff
changeset
|
200 v.ValidRepoName(edit, old_data)] |
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
|
201 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
|
202 |
1950
4ae17f819ee8
#344 optional firstname lastname on user creation
Marcin Kuzminski <marcin@python-works.com>
parents:
1898
diff
changeset
|
203 |
3628
c734686b3cf2
moved permission management into separate entity.
Marcin Kuzminski <marcin@python-works.com>
parents:
3524
diff
changeset
|
204 def RepoPermsForm(): |
c734686b3cf2
moved permission management into separate entity.
Marcin Kuzminski <marcin@python-works.com>
parents:
3524
diff
changeset
|
205 class _RepoPermsForm(formencode.Schema): |
c734686b3cf2
moved permission management into separate entity.
Marcin Kuzminski <marcin@python-works.com>
parents:
3524
diff
changeset
|
206 allow_extra_fields = True |
c734686b3cf2
moved permission management into separate entity.
Marcin Kuzminski <marcin@python-works.com>
parents:
3524
diff
changeset
|
207 filter_extra_fields = False |
3714
7e3d89d9d3a2
- Manage User’s Groups: create, delete, rename, add/remove users inside.
Marcin Kuzminski <marcin@python-works.com>
parents:
3674
diff
changeset
|
208 chained_validators = [v.ValidPerms(type_='repo')] |
3628
c734686b3cf2
moved permission management into separate entity.
Marcin Kuzminski <marcin@python-works.com>
parents:
3524
diff
changeset
|
209 return _RepoPermsForm |
c734686b3cf2
moved permission management into separate entity.
Marcin Kuzminski <marcin@python-works.com>
parents:
3524
diff
changeset
|
210 |
c734686b3cf2
moved permission management into separate entity.
Marcin Kuzminski <marcin@python-works.com>
parents:
3524
diff
changeset
|
211 |
3714
7e3d89d9d3a2
- Manage User’s Groups: create, delete, rename, add/remove users inside.
Marcin Kuzminski <marcin@python-works.com>
parents:
3674
diff
changeset
|
212 def RepoGroupPermsForm(): |
7e3d89d9d3a2
- Manage User’s Groups: create, delete, rename, add/remove users inside.
Marcin Kuzminski <marcin@python-works.com>
parents:
3674
diff
changeset
|
213 class _RepoGroupPermsForm(formencode.Schema): |
7e3d89d9d3a2
- Manage User’s Groups: create, delete, rename, add/remove users inside.
Marcin Kuzminski <marcin@python-works.com>
parents:
3674
diff
changeset
|
214 allow_extra_fields = True |
7e3d89d9d3a2
- Manage User’s Groups: create, delete, rename, add/remove users inside.
Marcin Kuzminski <marcin@python-works.com>
parents:
3674
diff
changeset
|
215 filter_extra_fields = False |
7e3d89d9d3a2
- Manage User’s Groups: create, delete, rename, add/remove users inside.
Marcin Kuzminski <marcin@python-works.com>
parents:
3674
diff
changeset
|
216 recursive = v.StringBoolean(if_missing=False) |
7e3d89d9d3a2
- Manage User’s Groups: create, delete, rename, add/remove users inside.
Marcin Kuzminski <marcin@python-works.com>
parents:
3674
diff
changeset
|
217 chained_validators = [v.ValidPerms(type_='repo_group')] |
7e3d89d9d3a2
- Manage User’s Groups: create, delete, rename, add/remove users inside.
Marcin Kuzminski <marcin@python-works.com>
parents:
3674
diff
changeset
|
218 return _RepoGroupPermsForm |
7e3d89d9d3a2
- Manage User’s Groups: create, delete, rename, add/remove users inside.
Marcin Kuzminski <marcin@python-works.com>
parents:
3674
diff
changeset
|
219 |
7e3d89d9d3a2
- Manage User’s Groups: create, delete, rename, add/remove users inside.
Marcin Kuzminski <marcin@python-works.com>
parents:
3674
diff
changeset
|
220 |
7e3d89d9d3a2
- Manage User’s Groups: create, delete, rename, add/remove users inside.
Marcin Kuzminski <marcin@python-works.com>
parents:
3674
diff
changeset
|
221 def UserGroupPermsForm(): |
7e3d89d9d3a2
- Manage User’s Groups: create, delete, rename, add/remove users inside.
Marcin Kuzminski <marcin@python-works.com>
parents:
3674
diff
changeset
|
222 class _UserPermsForm(formencode.Schema): |
7e3d89d9d3a2
- Manage User’s Groups: create, delete, rename, add/remove users inside.
Marcin Kuzminski <marcin@python-works.com>
parents:
3674
diff
changeset
|
223 allow_extra_fields = True |
7e3d89d9d3a2
- Manage User’s Groups: create, delete, rename, add/remove users inside.
Marcin Kuzminski <marcin@python-works.com>
parents:
3674
diff
changeset
|
224 filter_extra_fields = False |
7e3d89d9d3a2
- Manage User’s Groups: create, delete, rename, add/remove users inside.
Marcin Kuzminski <marcin@python-works.com>
parents:
3674
diff
changeset
|
225 chained_validators = [v.ValidPerms(type_='user_group')] |
7e3d89d9d3a2
- Manage User’s Groups: create, delete, rename, add/remove users inside.
Marcin Kuzminski <marcin@python-works.com>
parents:
3674
diff
changeset
|
226 return _UserPermsForm |
7e3d89d9d3a2
- Manage User’s Groups: create, delete, rename, add/remove users inside.
Marcin Kuzminski <marcin@python-works.com>
parents:
3674
diff
changeset
|
227 |
7e3d89d9d3a2
- Manage User’s Groups: create, delete, rename, add/remove users inside.
Marcin Kuzminski <marcin@python-works.com>
parents:
3674
diff
changeset
|
228 |
3308
72a91632b731
repository extra fields implementation
Marcin Kuzminski <marcin@python-works.com>
parents:
3222
diff
changeset
|
229 def RepoFieldForm(): |
72a91632b731
repository extra fields implementation
Marcin Kuzminski <marcin@python-works.com>
parents:
3222
diff
changeset
|
230 class _RepoFieldForm(formencode.Schema): |
72a91632b731
repository extra fields implementation
Marcin Kuzminski <marcin@python-works.com>
parents:
3222
diff
changeset
|
231 filter_extra_fields = True |
72a91632b731
repository extra fields implementation
Marcin Kuzminski <marcin@python-works.com>
parents:
3222
diff
changeset
|
232 allow_extra_fields = True |
72a91632b731
repository extra fields implementation
Marcin Kuzminski <marcin@python-works.com>
parents:
3222
diff
changeset
|
233 |
72a91632b731
repository extra fields implementation
Marcin Kuzminski <marcin@python-works.com>
parents:
3222
diff
changeset
|
234 new_field_key = All(v.FieldKey(), |
72a91632b731
repository extra fields implementation
Marcin Kuzminski <marcin@python-works.com>
parents:
3222
diff
changeset
|
235 v.UnicodeString(strip=True, min=3, not_empty=True)) |
72a91632b731
repository extra fields implementation
Marcin Kuzminski <marcin@python-works.com>
parents:
3222
diff
changeset
|
236 new_field_value = v.UnicodeString(not_empty=False, if_missing='') |
72a91632b731
repository extra fields implementation
Marcin Kuzminski <marcin@python-works.com>
parents:
3222
diff
changeset
|
237 new_field_type = v.OneOf(['str', 'unicode', 'list', 'tuple'], |
72a91632b731
repository extra fields implementation
Marcin Kuzminski <marcin@python-works.com>
parents:
3222
diff
changeset
|
238 if_missing='str') |
72a91632b731
repository extra fields implementation
Marcin Kuzminski <marcin@python-works.com>
parents:
3222
diff
changeset
|
239 new_field_label = v.UnicodeString(not_empty=False) |
72a91632b731
repository extra fields implementation
Marcin Kuzminski <marcin@python-works.com>
parents:
3222
diff
changeset
|
240 new_field_desc = v.UnicodeString(not_empty=False) |
72a91632b731
repository extra fields implementation
Marcin Kuzminski <marcin@python-works.com>
parents:
3222
diff
changeset
|
241 |
72a91632b731
repository extra fields implementation
Marcin Kuzminski <marcin@python-works.com>
parents:
3222
diff
changeset
|
242 return _RepoFieldForm |
72a91632b731
repository extra fields implementation
Marcin Kuzminski <marcin@python-works.com>
parents:
3222
diff
changeset
|
243 |
72a91632b731
repository extra fields implementation
Marcin Kuzminski <marcin@python-works.com>
parents:
3222
diff
changeset
|
244 |
2460
12fa0c19c42f
validating choices for landing_rev
Marcin Kuzminski <marcin@python-works.com>
parents:
2459
diff
changeset
|
245 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
|
246 repo_groups=[], landing_revs=[]): |
530
a08f610e545e
Implemented server side forks
Marcin Kuzminski <marcin@python-works.com>
parents:
529
diff
changeset
|
247 class _RepoForkForm(formencode.Schema): |
a08f610e545e
Implemented server side forks
Marcin Kuzminski <marcin@python-works.com>
parents:
529
diff
changeset
|
248 allow_extra_fields = True |
a08f610e545e
Implemented server side forks
Marcin Kuzminski <marcin@python-works.com>
parents:
529
diff
changeset
|
249 filter_extra_fields = False |
2467
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
250 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
|
251 v.SlugifyName()) |
2835
faffec4abbda
Implemented permissions for writing to repo
Marcin Kuzminski <marcin@python-works.com>
parents:
2820
diff
changeset
|
252 repo_group = All(v.CanWriteGroup(), |
faffec4abbda
Implemented permissions for writing to repo
Marcin Kuzminski <marcin@python-works.com>
parents:
2820
diff
changeset
|
253 v.OneOf(repo_groups, hideList=True)) |
2467
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
254 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
|
255 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
|
256 private = v.StringBoolean(if_missing=False) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
257 copy_permissions = v.StringBoolean(if_missing=False) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
258 update_after_clone = v.StringBoolean(if_missing=False) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
259 fork_parent_id = v.UnicodeString() |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
260 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
|
261 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
|
262 |
530
a08f610e545e
Implemented server side forks
Marcin Kuzminski <marcin@python-works.com>
parents:
529
diff
changeset
|
263 return _RepoForkForm |
a08f610e545e
Implemented server side forks
Marcin Kuzminski <marcin@python-works.com>
parents:
529
diff
changeset
|
264 |
1950
4ae17f819ee8
#344 optional firstname lastname on user creation
Marcin Kuzminski <marcin@python-works.com>
parents:
1898
diff
changeset
|
265 |
350
664a5b8c551a
Added application settings, are now customizable from database
Marcin Kuzminski <marcin@python-works.com>
parents:
347
diff
changeset
|
266 def ApplicationSettingsForm(): |
664a5b8c551a
Added application settings, are now customizable from database
Marcin Kuzminski <marcin@python-works.com>
parents:
347
diff
changeset
|
267 class _ApplicationSettingsForm(formencode.Schema): |
664a5b8c551a
Added application settings, are now customizable from database
Marcin Kuzminski <marcin@python-works.com>
parents:
347
diff
changeset
|
268 allow_extra_fields = True |
664a5b8c551a
Added application settings, are now customizable from database
Marcin Kuzminski <marcin@python-works.com>
parents:
347
diff
changeset
|
269 filter_extra_fields = False |
2467
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
270 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
|
271 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
|
272 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
|
273 |
350
664a5b8c551a
Added application settings, are now customizable from database
Marcin Kuzminski <marcin@python-works.com>
parents:
347
diff
changeset
|
274 return _ApplicationSettingsForm |
629
7e536d1af60d
Code refactoring,models renames
Marcin Kuzminski <marcin@python-works.com>
parents:
555
diff
changeset
|
275 |
1950
4ae17f819ee8
#344 optional firstname lastname on user creation
Marcin Kuzminski <marcin@python-works.com>
parents:
1898
diff
changeset
|
276 |
2674
a221706dab50
merged + fixed pull request #62: Implemented metatags and visualisation options.
Marcin Kuzminski <marcin@python-works.com>
parents:
2595
diff
changeset
|
277 def ApplicationVisualisationForm(): |
a221706dab50
merged + fixed pull request #62: Implemented metatags and visualisation options.
Marcin Kuzminski <marcin@python-works.com>
parents:
2595
diff
changeset
|
278 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
|
279 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
|
280 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
|
281 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
|
282 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
|
283 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
|
284 |
3308
72a91632b731
repository extra fields implementation
Marcin Kuzminski <marcin@python-works.com>
parents:
3222
diff
changeset
|
285 rhodecode_repository_fields = v.StringBoolean(if_missing=False) |
2952
029a40c58df7
Added lightweight journal option for visual
Marcin Kuzminski <marcin@python-works.com>
parents:
2936
diff
changeset
|
286 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
|
287 |
2674
a221706dab50
merged + fixed pull request #62: Implemented metatags and visualisation options.
Marcin Kuzminski <marcin@python-works.com>
parents:
2595
diff
changeset
|
288 return _ApplicationVisualisationForm |
a221706dab50
merged + fixed pull request #62: Implemented metatags and visualisation options.
Marcin Kuzminski <marcin@python-works.com>
parents:
2595
diff
changeset
|
289 |
a221706dab50
merged + fixed pull request #62: Implemented metatags and visualisation options.
Marcin Kuzminski <marcin@python-works.com>
parents:
2595
diff
changeset
|
290 |
388
3bcf9529d221
Added new application settings,Push ssl and repositories path
Marcin Kuzminski <marcin@python-works.com>
parents:
381
diff
changeset
|
291 def ApplicationUiSettingsForm(): |
3bcf9529d221
Added new application settings,Push ssl and repositories path
Marcin Kuzminski <marcin@python-works.com>
parents:
381
diff
changeset
|
292 class _ApplicationUiSettingsForm(formencode.Schema): |
3bcf9529d221
Added new application settings,Push ssl and repositories path
Marcin Kuzminski <marcin@python-works.com>
parents:
381
diff
changeset
|
293 allow_extra_fields = True |
3bcf9529d221
Added new application settings,Push ssl and repositories path
Marcin Kuzminski <marcin@python-works.com>
parents:
381
diff
changeset
|
294 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
|
295 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
|
296 paths_root_path = All( |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
297 v.ValidPath(), |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
298 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
|
299 ) |
2674
a221706dab50
merged + fixed pull request #62: Implemented metatags and visualisation options.
Marcin Kuzminski <marcin@python-works.com>
parents:
2595
diff
changeset
|
300 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
|
301 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
|
302 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
|
303 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
|
304 |
2708
9bce679a3f49
Added form for controlling mercurial extensions
Marcin Kuzminski <marcin@python-works.com>
parents:
2674
diff
changeset
|
305 extensions_largefiles = v.StringBoolean(if_missing=False) |
9bce679a3f49
Added form for controlling mercurial extensions
Marcin Kuzminski <marcin@python-works.com>
parents:
2674
diff
changeset
|
306 extensions_hgsubversion = v.StringBoolean(if_missing=False) |
9bce679a3f49
Added form for controlling mercurial extensions
Marcin Kuzminski <marcin@python-works.com>
parents:
2674
diff
changeset
|
307 extensions_hggit = v.StringBoolean(if_missing=False) |
9bce679a3f49
Added form for controlling mercurial extensions
Marcin Kuzminski <marcin@python-works.com>
parents:
2674
diff
changeset
|
308 |
388
3bcf9529d221
Added new application settings,Push ssl and repositories path
Marcin Kuzminski <marcin@python-works.com>
parents:
381
diff
changeset
|
309 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
|
310 |
1950
4ae17f819ee8
#344 optional firstname lastname on user creation
Marcin Kuzminski <marcin@python-works.com>
parents:
1898
diff
changeset
|
311 |
3056
6104dfd35b16
Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents:
3052
diff
changeset
|
312 def DefaultPermissionsForm(repo_perms_choices, group_perms_choices, |
3734
a8f520540ab0
New default permissions definition for user group create
Marcin Kuzminski <marcin@python-works.com>
parents:
3714
diff
changeset
|
313 user_group_perms_choices, create_choices, |
a8f520540ab0
New default permissions definition for user group create
Marcin Kuzminski <marcin@python-works.com>
parents:
3714
diff
changeset
|
314 repo_group_create_choices, user_group_create_choices, |
3786
222e6769e7b5
Added separate default permission for external_auth account
Marcin Kuzminski <marcin@python-works.com>
parents:
3752
diff
changeset
|
315 fork_choices, register_choices, extern_activate_choices): |
417
3ed2d46a2ca7
permission refactoring,
Marcin Kuzminski <marcin@python-works.com>
parents:
416
diff
changeset
|
316 class _DefaultPermissionsForm(formencode.Schema): |
3ed2d46a2ca7
permission refactoring,
Marcin Kuzminski <marcin@python-works.com>
parents:
416
diff
changeset
|
317 allow_extra_fields = True |
3ed2d46a2ca7
permission refactoring,
Marcin Kuzminski <marcin@python-works.com>
parents:
416
diff
changeset
|
318 filter_extra_fields = True |
3052
d3200c58764e
implemented #663 Admin/permission: specify default repogroup perms
Marcin Kuzminski <marcin@python-works.com>
parents:
2986
diff
changeset
|
319 overwrite_default_repo = v.StringBoolean(if_missing=False) |
d3200c58764e
implemented #663 Admin/permission: specify default repogroup perms
Marcin Kuzminski <marcin@python-works.com>
parents:
2986
diff
changeset
|
320 overwrite_default_group = v.StringBoolean(if_missing=False) |
3735
8a40028eaf73
fixed overwrite default user group permission flag
Marcin Kuzminski <marcin@python-works.com>
parents:
3734
diff
changeset
|
321 overwrite_default_user_group = 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
|
322 anonymous = v.StringBoolean(if_missing=False) |
3052
d3200c58764e
implemented #663 Admin/permission: specify default repogroup perms
Marcin Kuzminski <marcin@python-works.com>
parents:
2986
diff
changeset
|
323 default_repo_perm = v.OneOf(repo_perms_choices) |
d3200c58764e
implemented #663 Admin/permission: specify default repogroup perms
Marcin Kuzminski <marcin@python-works.com>
parents:
2986
diff
changeset
|
324 default_group_perm = v.OneOf(group_perms_choices) |
3734
a8f520540ab0
New default permissions definition for user group create
Marcin Kuzminski <marcin@python-works.com>
parents:
3714
diff
changeset
|
325 default_user_group_perm = v.OneOf(user_group_perms_choices) |
a8f520540ab0
New default permissions definition for user group create
Marcin Kuzminski <marcin@python-works.com>
parents:
3714
diff
changeset
|
326 |
a8f520540ab0
New default permissions definition for user group create
Marcin Kuzminski <marcin@python-works.com>
parents:
3714
diff
changeset
|
327 default_repo_create = v.OneOf(create_choices) |
a8f520540ab0
New default permissions definition for user group create
Marcin Kuzminski <marcin@python-works.com>
parents:
3714
diff
changeset
|
328 default_user_group_create = v.OneOf(user_group_create_choices) |
a8f520540ab0
New default permissions definition for user group create
Marcin Kuzminski <marcin@python-works.com>
parents:
3714
diff
changeset
|
329 #default_repo_group_create = v.OneOf(repo_group_create_choices) #not impl. yet |
2709
d2d35cf2b351
RhodeCode now has a option to explicitly set forking permissions. ref #508
Marcin Kuzminski <marcin@python-works.com>
parents:
2708
diff
changeset
|
330 default_fork = v.OneOf(fork_choices) |
629
7e536d1af60d
Code refactoring,models renames
Marcin Kuzminski <marcin@python-works.com>
parents:
555
diff
changeset
|
331 |
3734
a8f520540ab0
New default permissions definition for user group create
Marcin Kuzminski <marcin@python-works.com>
parents:
3714
diff
changeset
|
332 default_register = v.OneOf(register_choices) |
3786
222e6769e7b5
Added separate default permission for external_auth account
Marcin Kuzminski <marcin@python-works.com>
parents:
3752
diff
changeset
|
333 default_extern_activate = v.OneOf(extern_activate_choices) |
417
3ed2d46a2ca7
permission refactoring,
Marcin Kuzminski <marcin@python-works.com>
parents:
416
diff
changeset
|
334 return _DefaultPermissionsForm |
705
9e9f1b919c0c
implements #60, ldap configuration and authentication.
Marcin Kuzminski <marcin@python-works.com>
parents:
699
diff
changeset
|
335 |
9e9f1b919c0c
implements #60, ldap configuration and authentication.
Marcin Kuzminski <marcin@python-works.com>
parents:
699
diff
changeset
|
336 |
3736
87e6960e250b
Iteration on default permissions
Marcin Kuzminski <marcin@python-works.com>
parents:
3735
diff
changeset
|
337 def CustomDefaultPermissionsForm(): |
87e6960e250b
Iteration on default permissions
Marcin Kuzminski <marcin@python-works.com>
parents:
3735
diff
changeset
|
338 class _CustomDefaultPermissionsForm(formencode.Schema): |
87e6960e250b
Iteration on default permissions
Marcin Kuzminski <marcin@python-works.com>
parents:
3735
diff
changeset
|
339 filter_extra_fields = True |
87e6960e250b
Iteration on default permissions
Marcin Kuzminski <marcin@python-works.com>
parents:
3735
diff
changeset
|
340 allow_extra_fields = True |
87e6960e250b
Iteration on default permissions
Marcin Kuzminski <marcin@python-works.com>
parents:
3735
diff
changeset
|
341 inherit_default_permissions = v.StringBoolean(if_missing=False) |
87e6960e250b
Iteration on default permissions
Marcin Kuzminski <marcin@python-works.com>
parents:
3735
diff
changeset
|
342 |
87e6960e250b
Iteration on default permissions
Marcin Kuzminski <marcin@python-works.com>
parents:
3735
diff
changeset
|
343 create_repo_perm = v.StringBoolean(if_missing=False) |
87e6960e250b
Iteration on default permissions
Marcin Kuzminski <marcin@python-works.com>
parents:
3735
diff
changeset
|
344 create_user_group_perm = v.StringBoolean(if_missing=False) |
87e6960e250b
Iteration on default permissions
Marcin Kuzminski <marcin@python-works.com>
parents:
3735
diff
changeset
|
345 #create_repo_group_perm Impl. later |
87e6960e250b
Iteration on default permissions
Marcin Kuzminski <marcin@python-works.com>
parents:
3735
diff
changeset
|
346 |
87e6960e250b
Iteration on default permissions
Marcin Kuzminski <marcin@python-works.com>
parents:
3735
diff
changeset
|
347 fork_repo_perm = v.StringBoolean(if_missing=False) |
87e6960e250b
Iteration on default permissions
Marcin Kuzminski <marcin@python-works.com>
parents:
3735
diff
changeset
|
348 |
87e6960e250b
Iteration on default permissions
Marcin Kuzminski <marcin@python-works.com>
parents:
3735
diff
changeset
|
349 return _CustomDefaultPermissionsForm |
87e6960e250b
Iteration on default permissions
Marcin Kuzminski <marcin@python-works.com>
parents:
3735
diff
changeset
|
350 |
87e6960e250b
Iteration on default permissions
Marcin Kuzminski <marcin@python-works.com>
parents:
3735
diff
changeset
|
351 |
3056
6104dfd35b16
Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents:
3052
diff
changeset
|
352 def DefaultsForm(edit=False, old_data={}, supported_backends=BACKENDS.keys()): |
6104dfd35b16
Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents:
3052
diff
changeset
|
353 class _DefaultsForm(formencode.Schema): |
6104dfd35b16
Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents:
3052
diff
changeset
|
354 allow_extra_fields = True |
6104dfd35b16
Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents:
3052
diff
changeset
|
355 filter_extra_fields = True |
6104dfd35b16
Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents:
3052
diff
changeset
|
356 default_repo_type = v.OneOf(supported_backends) |
6104dfd35b16
Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents:
3052
diff
changeset
|
357 default_repo_private = v.StringBoolean(if_missing=False) |
6104dfd35b16
Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents:
3052
diff
changeset
|
358 default_repo_enable_statistics = v.StringBoolean(if_missing=False) |
6104dfd35b16
Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents:
3052
diff
changeset
|
359 default_repo_enable_downloads = v.StringBoolean(if_missing=False) |
6104dfd35b16
Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents:
3052
diff
changeset
|
360 default_repo_enable_locking = v.StringBoolean(if_missing=False) |
6104dfd35b16
Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents:
3052
diff
changeset
|
361 |
6104dfd35b16
Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents:
3052
diff
changeset
|
362 return _DefaultsForm |
6104dfd35b16
Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents:
3052
diff
changeset
|
363 |
6104dfd35b16
Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents:
3052
diff
changeset
|
364 |
2467
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
365 def LdapSettingsForm(tls_reqcert_choices, search_scope_choices, |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
366 tls_kind_choices): |
705
9e9f1b919c0c
implements #60, ldap configuration and authentication.
Marcin Kuzminski <marcin@python-works.com>
parents:
699
diff
changeset
|
367 class _LdapSettingsForm(formencode.Schema): |
9e9f1b919c0c
implements #60, ldap configuration and authentication.
Marcin Kuzminski <marcin@python-works.com>
parents:
699
diff
changeset
|
368 allow_extra_fields = True |
9e9f1b919c0c
implements #60, ldap configuration and authentication.
Marcin Kuzminski <marcin@python-works.com>
parents:
699
diff
changeset
|
369 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
|
370 #pre_validators = [LdapLibValidator] |
2467
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
371 ldap_active = v.StringBoolean(if_missing=False) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
372 ldap_host = v.UnicodeString(strip=True,) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
373 ldap_port = v.Number(strip=True,) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
374 ldap_tls_kind = v.OneOf(tls_kind_choices) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
375 ldap_tls_reqcert = v.OneOf(tls_reqcert_choices) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
376 ldap_dn_user = v.UnicodeString(strip=True,) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
377 ldap_dn_pass = v.UnicodeString(strip=True,) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
378 ldap_base_dn = v.UnicodeString(strip=True,) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
379 ldap_filter = v.UnicodeString(strip=True,) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
380 ldap_search_scope = v.OneOf(search_scope_choices) |
3674
ff2ea58debb5
fixed ldap tests when ldap lib is installed
Marcin Kuzminski <marcin@python-works.com>
parents:
3629
diff
changeset
|
381 ldap_attr_login = v.AttrLoginValidator()(not_empty=True) |
2467
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
382 ldap_attr_firstname = v.UnicodeString(strip=True,) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
383 ldap_attr_lastname = v.UnicodeString(strip=True,) |
4419551b2915
Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents:
2460
diff
changeset
|
384 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
|
385 |
9e9f1b919c0c
implements #60, ldap configuration and authentication.
Marcin Kuzminski <marcin@python-works.com>
parents:
699
diff
changeset
|
386 return _LdapSettingsForm |
2479
9225597688f4
Added validation into user email map
Marcin Kuzminski <marcin@python-works.com>
parents:
2467
diff
changeset
|
387 |
9225597688f4
Added validation into user email map
Marcin Kuzminski <marcin@python-works.com>
parents:
2467
diff
changeset
|
388 |
9225597688f4
Added validation into user email map
Marcin Kuzminski <marcin@python-works.com>
parents:
2467
diff
changeset
|
389 def UserExtraEmailForm(): |
9225597688f4
Added validation into user email map
Marcin Kuzminski <marcin@python-works.com>
parents:
2467
diff
changeset
|
390 class _UserExtraEmailForm(formencode.Schema): |
3125
9b92cf5a0cca
Added UserIpMap interface for allowed IP addresses and IP restriction access
Marcin Kuzminski <marcin@python-works.com>
parents:
3089
diff
changeset
|
391 email = All(v.UniqSystemEmail(), v.Email(not_empty=True)) |
9b92cf5a0cca
Added UserIpMap interface for allowed IP addresses and IP restriction access
Marcin Kuzminski <marcin@python-works.com>
parents:
3089
diff
changeset
|
392 return _UserExtraEmailForm |
9b92cf5a0cca
Added UserIpMap interface for allowed IP addresses and IP restriction access
Marcin Kuzminski <marcin@python-works.com>
parents:
3089
diff
changeset
|
393 |
2479
9225597688f4
Added validation into user email map
Marcin Kuzminski <marcin@python-works.com>
parents:
2467
diff
changeset
|
394 |
3125
9b92cf5a0cca
Added UserIpMap interface for allowed IP addresses and IP restriction access
Marcin Kuzminski <marcin@python-works.com>
parents:
3089
diff
changeset
|
395 def UserExtraIpForm(): |
9b92cf5a0cca
Added UserIpMap interface for allowed IP addresses and IP restriction access
Marcin Kuzminski <marcin@python-works.com>
parents:
3089
diff
changeset
|
396 class _UserExtraIpForm(formencode.Schema): |
9b92cf5a0cca
Added UserIpMap interface for allowed IP addresses and IP restriction access
Marcin Kuzminski <marcin@python-works.com>
parents:
3089
diff
changeset
|
397 ip = v.ValidIp()(not_empty=True) |
9b92cf5a0cca
Added UserIpMap interface for allowed IP addresses and IP restriction access
Marcin Kuzminski <marcin@python-works.com>
parents:
3089
diff
changeset
|
398 return _UserExtraIpForm |
2711
1de45f582f9d
added more validations when opening pull request
Marcin Kuzminski <marcin@python-works.com>
parents:
2709
diff
changeset
|
399 |
1de45f582f9d
added more validations when opening pull request
Marcin Kuzminski <marcin@python-works.com>
parents:
2709
diff
changeset
|
400 |
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
|
401 def PullRequestForm(repo_id): |
2711
1de45f582f9d
added more validations when opening pull request
Marcin Kuzminski <marcin@python-works.com>
parents:
2709
diff
changeset
|
402 class _PullRequestForm(formencode.Schema): |
1de45f582f9d
added more validations when opening pull request
Marcin Kuzminski <marcin@python-works.com>
parents:
2709
diff
changeset
|
403 allow_extra_fields = True |
1de45f582f9d
added more validations when opening pull request
Marcin Kuzminski <marcin@python-works.com>
parents:
2709
diff
changeset
|
404 filter_extra_fields = True |
1de45f582f9d
added more validations when opening pull request
Marcin Kuzminski <marcin@python-works.com>
parents:
2709
diff
changeset
|
405 |
1de45f582f9d
added more validations when opening pull request
Marcin Kuzminski <marcin@python-works.com>
parents:
2709
diff
changeset
|
406 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
|
407 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
|
408 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
|
409 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
|
410 other_ref = v.UnicodeString(strip=True, required=True) |
3175
5d1d25c1c700
set the status of changesets initially on pull request, and make sure we care of version collisions.
Marcin Kuzminski <marcin@python-works.com>
parents:
3125
diff
changeset
|
411 revisions = All(#v.NotReviewedRevisions(repo_id)(), |
5d1d25c1c700
set the status of changesets initially on pull request, and make sure we care of version collisions.
Marcin Kuzminski <marcin@python-works.com>
parents:
3125
diff
changeset
|
412 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
|
413 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
|
414 |
1de45f582f9d
added more validations when opening pull request
Marcin Kuzminski <marcin@python-works.com>
parents:
2709
diff
changeset
|
415 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
|
416 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
|
417 |
3486
2053053e0882
compare/pullrequest: introduce merge parameter
Mads Kiilerich <madski@unity3d.com>
parents:
3417
diff
changeset
|
418 ancestor_rev = v.UnicodeString(strip=True, required=True) |
2053053e0882
compare/pullrequest: introduce merge parameter
Mads Kiilerich <madski@unity3d.com>
parents:
3417
diff
changeset
|
419 merge_rev = v.UnicodeString(strip=True, required=True) |
2053053e0882
compare/pullrequest: introduce merge parameter
Mads Kiilerich <madski@unity3d.com>
parents:
3417
diff
changeset
|
420 |
2815
acc05c33cc0c
White space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
2749
diff
changeset
|
421 return _PullRequestForm |
3840
dc4644865e8b
Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents:
3786
diff
changeset
|
422 |
dc4644865e8b
Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents:
3786
diff
changeset
|
423 |
dc4644865e8b
Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents:
3786
diff
changeset
|
424 def GistForm(lifetime_options): |
dc4644865e8b
Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents:
3786
diff
changeset
|
425 class _GistForm(formencode.Schema): |
dc4644865e8b
Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents:
3786
diff
changeset
|
426 |
3846
2576a20d94ca
Gist: don't allow files inside directories when creating gists
Marcin Kuzminski <marcin@python-works.com>
parents:
3840
diff
changeset
|
427 filename = All(v.BasePath()(), |
2576a20d94ca
Gist: don't allow files inside directories when creating gists
Marcin Kuzminski <marcin@python-works.com>
parents:
3840
diff
changeset
|
428 v.UnicodeString(strip=True, required=False)) |
3840
dc4644865e8b
Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents:
3786
diff
changeset
|
429 description = v.UnicodeString(required=False, if_missing='') |
dc4644865e8b
Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents:
3786
diff
changeset
|
430 lifetime = v.OneOf(lifetime_options) |
dc4644865e8b
Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents:
3786
diff
changeset
|
431 content = v.UnicodeString(required=True, not_empty=True) |
dc4644865e8b
Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents:
3786
diff
changeset
|
432 public = v.UnicodeString(required=False, if_missing='') |
dc4644865e8b
Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents:
3786
diff
changeset
|
433 private = v.UnicodeString(required=False, if_missing='') |
dc4644865e8b
Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents:
3786
diff
changeset
|
434 |
dc4644865e8b
Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents:
3786
diff
changeset
|
435 return _GistForm |