annotate rhodecode/model/forms.py @ 4147:1c8f818787b3 rhodecode-2.2.5-gpl

old style: show the full link box on summary page - no overlap or truncation
author Mads Kiilerich <madski@unity3d.com>
date Wed, 02 Jul 2014 19:03:23 -0400
parents ffd45b185016
children 7e5f8c12a3fc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4116
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
1 # -*- coding: utf-8 -*-
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
2 # This program is free software: you can redistribute it and/or modify
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
3 # it under the terms of the GNU General Public License as published by
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
4 # the Free Software Foundation, either version 3 of the License, or
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
5 # (at your option) any later version.
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
6 #
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
7 # This program is distributed in the hope that it will be useful,
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
8 # but WITHOUT ANY WARRANTY; without even the implied warranty of
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
9 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
10 # GNU General Public License for more details.
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
11 #
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
12 # You should have received a copy of the GNU General Public License
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
13 # along with this program. If not, see <http://www.gnu.org/licenses/>.
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
14 """
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
15 this is forms validation classes
0
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
16 http://formencode.org/module-formencode.validators.html
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
17 for list off all availible validators
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
18
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
19 we can create our own validators
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
20
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
21 The table below outlines the options which can be used in a schema in addition to the validators themselves
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
22 pre_validators [] These validators will be applied before the schema
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
23 chained_validators [] These validators will be applied after the schema
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
24 allow_extra_fields False If True, then it is not an error when keys that aren't associated with a validator are present
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
25 filter_extra_fields False If True, then keys that aren't associated with a validator are removed
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
26 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
27 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
28
6832ef664673 source code cleanup: remove trailing white space, normalize file endings
Marcin Kuzminski <marcin@python-works.com>
parents: 1159
diff changeset
29
0
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
30 <name> = formencode.validators.<name of validator>
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
31 <name> must equal form name
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
32 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
33 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
34
0
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
35 """
761
56c2850a5b5f ldap auth rewrite, moved split authfunc into two functions,
Marcin Kuzminski <marcin@python-works.com>
parents: 746
diff changeset
36 import logging
56c2850a5b5f ldap auth rewrite, moved split authfunc into two functions,
Marcin Kuzminski <marcin@python-works.com>
parents: 746
diff changeset
37
56c2850a5b5f ldap auth rewrite, moved split authfunc into two functions,
Marcin Kuzminski <marcin@python-works.com>
parents: 746
diff changeset
38 import formencode
242
5da4ef115006 Added lastlogin to user after login, model db update
Marcin Kuzminski <marcin@python-works.com>
parents: 238
diff changeset
39 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
40
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
41 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
42
4116
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
43 from rhodecode import BACKENDS
2467
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
44 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
45
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
46 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
47
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
48
45
a886f5eba757 implemented admin page login
marcink
parents: 0
diff changeset
49 class LoginForm(formencode.Schema):
a886f5eba757 implemented admin page login
marcink
parents: 0
diff changeset
50 allow_extra_fields = True
a886f5eba757 implemented admin page login
marcink
parents: 0
diff changeset
51 filter_extra_fields = True
2467
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
52 username = v.UnicodeString(
1950
4ae17f819ee8 #344 optional firstname lastname on user creation
Marcin Kuzminski <marcin@python-works.com>
parents: 1898
diff changeset
53 strip=True,
4ae17f819ee8 #344 optional firstname lastname on user creation
Marcin Kuzminski <marcin@python-works.com>
parents: 1898
diff changeset
54 min=1,
4ae17f819ee8 #344 optional firstname lastname on user creation
Marcin Kuzminski <marcin@python-works.com>
parents: 1898
diff changeset
55 not_empty=True,
4ae17f819ee8 #344 optional firstname lastname on user creation
Marcin Kuzminski <marcin@python-works.com>
parents: 1898
diff changeset
56 messages={
2467
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
57 'empty': _(u'Please enter a login'),
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
58 '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
59 )
0
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
60
2467
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
61 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
62 strip=False,
1950
4ae17f819ee8 #344 optional firstname lastname on user creation
Marcin Kuzminski <marcin@python-works.com>
parents: 1898
diff changeset
63 min=3,
4ae17f819ee8 #344 optional firstname lastname on user creation
Marcin Kuzminski <marcin@python-works.com>
parents: 1898
diff changeset
64 not_empty=True,
4ae17f819ee8 #344 optional firstname lastname on user creation
Marcin Kuzminski <marcin@python-works.com>
parents: 1898
diff changeset
65 messages={
2467
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
66 'empty': _(u'Please enter a password'),
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
67 '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
68 )
0
564e40829f80 initial commit.
Marcin Kuzminski
parents:
diff changeset
69
2467
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
70 remember = v.StringBoolean(if_missing=False)
1818
cf51bbfb120e auto white-space removal
Marcin Kuzminski <marcin@python-works.com>
parents: 1802
diff changeset
71
2467
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
72 chained_validators = [v.ValidAuth()]
629
7e536d1af60d Code refactoring,models renames
Marcin Kuzminski <marcin@python-works.com>
parents: 555
diff changeset
73
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
74
4116
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
75 def PasswordChangeForm(username):
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
76 class _PasswordChangeForm(formencode.Schema):
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
77 allow_extra_fields = True
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
78 filter_extra_fields = True
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
79
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
80 current_password = v.ValidOldPassword(username)(not_empty=True)
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
81 new_password = All(v.ValidPassword(), v.UnicodeString(strip=False, min=6))
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
82 new_password_confirmation = All(v.ValidPassword(), v.UnicodeString(strip=False, min=6))
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
83
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
84 chained_validators = [v.ValidPasswordsMatch('new_password',
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
85 'new_password_confirmation')]
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
86 return _PasswordChangeForm
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
87
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
88
357
ebdd1a89cdd9 Added extra validation in creating users.
Marcin Kuzminski <marcin@python-works.com>
parents: 356
diff changeset
89 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
90 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
91 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
92 filter_extra_fields = True
2467
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
93 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
94 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
95 if edit:
2467
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
96 new_password = All(
2544
6ce3387bf0ce Renamed name to firstname in forms
Marcin Kuzminski <marcin@python-works.com>
parents: 2485
diff changeset
97 v.ValidPassword(),
2467
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
98 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
99 )
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
100 password_confirmation = All(
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
101 v.ValidPassword(),
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
102 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
103 )
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
104 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
105 else:
2467
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
106 password = All(
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
107 v.ValidPassword(),
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
108 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
109 )
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
110 password_confirmation = All(
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
111 v.ValidPassword(),
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
112 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
113 )
1722
e7eef7a1db6a #235 forking page repo group selection
Marcin Kuzminski <marcin@python-works.com>
parents: 1633
diff changeset
114
2467
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
115 active = v.StringBoolean(if_missing=False)
2544
6ce3387bf0ce Renamed name to firstname in forms
Marcin Kuzminski <marcin@python-works.com>
parents: 2485
diff changeset
116 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
117 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
118 email = All(v.Email(not_empty=True), v.UniqSystemEmail(old_data))
4116
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
119 extern_name = v.UnicodeString(strip=True)
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
120 extern_type = v.UnicodeString(strip=True)
2467
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
121 chained_validators = [v.ValidPasswordsMatch()]
238
a55c17874486 Rewrite of user managment, improved forms, added some user info
Marcin Kuzminski <marcin@python-works.com>
parents: 234
diff changeset
122 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
123
959
fff21c9b075c #56 fixed found bugs, implemented adding of new group + forms+validators
Marcin Kuzminski <marcin@python-works.com>
parents: 891
diff changeset
124
3417
fa6ba6727475 further cleanup of UsersGroup
Mads Kiilerich <madski@unity3d.com>
parents: 3308
diff changeset
125 def UserGroupForm(edit=False, old_data={}, available_members=[]):
fa6ba6727475 further cleanup of UsersGroup
Mads Kiilerich <madski@unity3d.com>
parents: 3308
diff changeset
126 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
127 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
128 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
129
2467
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
130 users_group_name = All(
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
131 v.UnicodeString(strip=True, min=1, not_empty=True),
3417
fa6ba6727475 further cleanup of UsersGroup
Mads Kiilerich <madski@unity3d.com>
parents: 3308
diff changeset
132 v.ValidUserGroup(edit, old_data)
2467
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
133 )
4116
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
134 user_group_description = v.UnicodeString(strip=True, min=1,
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
135 not_empty=False)
959
fff21c9b075c #56 fixed found bugs, implemented adding of new group + forms+validators
Marcin Kuzminski <marcin@python-works.com>
parents: 891
diff changeset
136
2467
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
137 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
138
972
2c8fd84935a4 #56 implemented users groups editing,
Marcin Kuzminski <marcin@python-works.com>
parents: 962
diff changeset
139 if edit:
2467
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
140 users_group_members = v.OneOf(
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
141 available_members, hideList=False, testValueList=True,
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
142 if_missing=None, not_empty=False
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
143 )
972
2c8fd84935a4 #56 implemented users groups editing,
Marcin Kuzminski <marcin@python-works.com>
parents: 962
diff changeset
144
3417
fa6ba6727475 further cleanup of UsersGroup
Mads Kiilerich <madski@unity3d.com>
parents: 3308
diff changeset
145 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
146
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
147
4116
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
148 def RepoGroupForm(edit=False, old_data={}, available_groups=[],
3222
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3175
diff changeset
149 can_create_in_root=False):
4116
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
150 class _RepoGroupForm(formencode.Schema):
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
151 allow_extra_fields = True
1982
87f0800abc7b #227 Initial version of repository groups permissions system
Marcin Kuzminski <marcin@python-works.com>
parents: 1976
diff changeset
152 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
153
2467
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
154 group_name = All(v.UnicodeString(strip=True, min=1, not_empty=True),
4116
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
155 v.SlugifyName(),
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
156 v.ValidRegex(msg=_('Name must not contain only digits'))(r'(?!^\d+$)^.+$'))
2467
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
157 group_description = v.UnicodeString(strip=True, min=1,
4116
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
158 not_empty=False)
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
159 group_copy_permissions = v.StringBoolean(if_missing=False)
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
160
3222
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3175
diff changeset
161 if edit:
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3175
diff changeset
162 #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
163 #it's children
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3175
diff changeset
164 pass
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3175
diff changeset
165 group_parent_id = All(v.CanCreateGroup(can_create_in_root),
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3175
diff changeset
166 v.OneOf(available_groups, hideList=False,
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3175
diff changeset
167 testValueList=True,
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3175
diff changeset
168 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
169 enable_locking = v.StringBoolean(if_missing=False)
4116
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
170 chained_validators = [v.ValidRepoGroup(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
171
4116
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
172 return _RepoGroupForm
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
173
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
174
722
02bdf2f296ff fixes #69 password confirmation for register dialog.
Marcin Kuzminski <marcin@python-works.com>
parents: 710
diff changeset
175 def RegisterForm(edit=False, old_data={}):
02bdf2f296ff fixes #69 password confirmation for register dialog.
Marcin Kuzminski <marcin@python-works.com>
parents: 710
diff changeset
176 class _RegisterForm(formencode.Schema):
02bdf2f296ff fixes #69 password confirmation for register dialog.
Marcin Kuzminski <marcin@python-works.com>
parents: 710
diff changeset
177 allow_extra_fields = True
02bdf2f296ff fixes #69 password confirmation for register dialog.
Marcin Kuzminski <marcin@python-works.com>
parents: 710
diff changeset
178 filter_extra_fields = True
2467
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
179 username = All(
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
180 v.ValidUsername(edit, old_data),
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
181 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 )
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
183 password = All(
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
184 v.ValidPassword(),
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
185 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
186 )
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
187 password_confirmation = All(
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
188 v.ValidPassword(),
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
189 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
190 )
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
191 active = v.StringBoolean(if_missing=False)
2595
6c83dc0226d2 renamed some leftover name -> firstname
Marcin Kuzminski <marcin@python-works.com>
parents: 2544
diff changeset
192 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
193 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
194 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
195
2467
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
196 chained_validators = [v.ValidPasswordsMatch()]
722
02bdf2f296ff fixes #69 password confirmation for register dialog.
Marcin Kuzminski <marcin@python-works.com>
parents: 710
diff changeset
197
02bdf2f296ff fixes #69 password confirmation for register dialog.
Marcin Kuzminski <marcin@python-works.com>
parents: 710
diff changeset
198 return _RegisterForm
474
a3d9d24acbec Implemented password reset(forms/models/ tasks) and mailing tasks.
Marcin Kuzminski <marcin@python-works.com>
parents: 458
diff changeset
199
1950
4ae17f819ee8 #344 optional firstname lastname on user creation
Marcin Kuzminski <marcin@python-works.com>
parents: 1898
diff changeset
200
474
a3d9d24acbec Implemented password reset(forms/models/ tasks) and mailing tasks.
Marcin Kuzminski <marcin@python-works.com>
parents: 458
diff changeset
201 def PasswordResetForm():
a3d9d24acbec Implemented password reset(forms/models/ tasks) and mailing tasks.
Marcin Kuzminski <marcin@python-works.com>
parents: 458
diff changeset
202 class _PasswordResetForm(formencode.Schema):
a3d9d24acbec Implemented password reset(forms/models/ tasks) and mailing tasks.
Marcin Kuzminski <marcin@python-works.com>
parents: 458
diff changeset
203 allow_extra_fields = True
a3d9d24acbec Implemented password reset(forms/models/ tasks) and mailing tasks.
Marcin Kuzminski <marcin@python-works.com>
parents: 458
diff changeset
204 filter_extra_fields = True
2467
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
205 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
206 return _PasswordResetForm
a3d9d24acbec Implemented password reset(forms/models/ tasks) and mailing tasks.
Marcin Kuzminski <marcin@python-works.com>
parents: 458
diff changeset
207
1950
4ae17f819ee8 #344 optional firstname lastname on user creation
Marcin Kuzminski <marcin@python-works.com>
parents: 1898
diff changeset
208
1112
6d0a7284949d #109, added optional clone uri when creating repo.
Marcin Kuzminski <marcin@python-works.com>
parents: 1022
diff changeset
209 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
210 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
211 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
212 allow_extra_fields = True
3089
4cc9bb83ecb4 Fixed some issues with edit form
Marcin Kuzminski <marcin@python-works.com>
parents: 3056
diff changeset
213 filter_extra_fields = False
2467
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
214 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
215 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
216 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
217 v.OneOf(repo_groups, hideList=True))
3863
794e6eaad4aa fix required repo_type param on repo edit form
Marcin Kuzminski <marcin@python-works.com>
parents: 3846
diff changeset
218 repo_type = v.OneOf(supported_backends, required=False,
794e6eaad4aa fix required repo_type param on repo edit form
Marcin Kuzminski <marcin@python-works.com>
parents: 3846
diff changeset
219 if_missing=old_data.get('repo_type'))
3056
6104dfd35b16 Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents: 3052
diff changeset
220 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
221 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
222 repo_landing_rev = v.OneOf(landing_revs, hideList=True)
4116
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
223 repo_copy_permissions = v.StringBoolean(if_missing=False)
3089
4cc9bb83ecb4 Fixed some issues with edit form
Marcin Kuzminski <marcin@python-works.com>
parents: 3056
diff changeset
224 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
225
3056
6104dfd35b16 Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents: 3052
diff changeset
226 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
227 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
228 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
229
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
230 if edit:
1014
6fdc3ff65fce #56 added assignments of users groups into repository
Marcin Kuzminski <marcin@python-works.com>
parents: 1013
diff changeset
231 #this is repo owner
2467
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
232 user = All(v.UnicodeString(not_empty=True), v.ValidRepoUser())
4116
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
233 clone_uri_change = v.UnicodeString(not_empty=False, if_missing=v.Missing)
629
7e536d1af60d Code refactoring,models renames
Marcin Kuzminski <marcin@python-works.com>
parents: 555
diff changeset
234
2467
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
235 chained_validators = [v.ValidCloneUri(),
3628
c734686b3cf2 moved permission management into separate entity.
Marcin Kuzminski <marcin@python-works.com>
parents: 3524
diff changeset
236 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
237 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
238
1950
4ae17f819ee8 #344 optional firstname lastname on user creation
Marcin Kuzminski <marcin@python-works.com>
parents: 1898
diff changeset
239
3628
c734686b3cf2 moved permission management into separate entity.
Marcin Kuzminski <marcin@python-works.com>
parents: 3524
diff changeset
240 def RepoPermsForm():
c734686b3cf2 moved permission management into separate entity.
Marcin Kuzminski <marcin@python-works.com>
parents: 3524
diff changeset
241 class _RepoPermsForm(formencode.Schema):
c734686b3cf2 moved permission management into separate entity.
Marcin Kuzminski <marcin@python-works.com>
parents: 3524
diff changeset
242 allow_extra_fields = True
c734686b3cf2 moved permission management into separate entity.
Marcin Kuzminski <marcin@python-works.com>
parents: 3524
diff changeset
243 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
244 chained_validators = [v.ValidPerms(type_='repo')]
3628
c734686b3cf2 moved permission management into separate entity.
Marcin Kuzminski <marcin@python-works.com>
parents: 3524
diff changeset
245 return _RepoPermsForm
c734686b3cf2 moved permission management into separate entity.
Marcin Kuzminski <marcin@python-works.com>
parents: 3524
diff changeset
246
c734686b3cf2 moved permission management into separate entity.
Marcin Kuzminski <marcin@python-works.com>
parents: 3524
diff changeset
247
4116
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
248 def RepoGroupPermsForm(valid_recursive_choices):
3714
7e3d89d9d3a2 - Manage User’s Groups: create, delete, rename, add/remove users inside.
Marcin Kuzminski <marcin@python-works.com>
parents: 3674
diff changeset
249 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
250 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
251 filter_extra_fields = False
4116
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
252 recursive = v.OneOf(valid_recursive_choices)
3714
7e3d89d9d3a2 - Manage User’s Groups: create, delete, rename, add/remove users inside.
Marcin Kuzminski <marcin@python-works.com>
parents: 3674
diff changeset
253 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
254 return _RepoGroupPermsForm
7e3d89d9d3a2 - Manage User’s Groups: create, delete, rename, add/remove users inside.
Marcin Kuzminski <marcin@python-works.com>
parents: 3674
diff changeset
255
7e3d89d9d3a2 - Manage User’s Groups: create, delete, rename, add/remove users inside.
Marcin Kuzminski <marcin@python-works.com>
parents: 3674
diff changeset
256
7e3d89d9d3a2 - Manage User’s Groups: create, delete, rename, add/remove users inside.
Marcin Kuzminski <marcin@python-works.com>
parents: 3674
diff changeset
257 def UserGroupPermsForm():
7e3d89d9d3a2 - Manage User’s Groups: create, delete, rename, add/remove users inside.
Marcin Kuzminski <marcin@python-works.com>
parents: 3674
diff changeset
258 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
259 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
260 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
261 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
262 return _UserPermsForm
7e3d89d9d3a2 - Manage User’s Groups: create, delete, rename, add/remove users inside.
Marcin Kuzminski <marcin@python-works.com>
parents: 3674
diff changeset
263
7e3d89d9d3a2 - Manage User’s Groups: create, delete, rename, add/remove users inside.
Marcin Kuzminski <marcin@python-works.com>
parents: 3674
diff changeset
264
3308
72a91632b731 repository extra fields implementation
Marcin Kuzminski <marcin@python-works.com>
parents: 3222
diff changeset
265 def RepoFieldForm():
72a91632b731 repository extra fields implementation
Marcin Kuzminski <marcin@python-works.com>
parents: 3222
diff changeset
266 class _RepoFieldForm(formencode.Schema):
72a91632b731 repository extra fields implementation
Marcin Kuzminski <marcin@python-works.com>
parents: 3222
diff changeset
267 filter_extra_fields = True
72a91632b731 repository extra fields implementation
Marcin Kuzminski <marcin@python-works.com>
parents: 3222
diff changeset
268 allow_extra_fields = True
72a91632b731 repository extra fields implementation
Marcin Kuzminski <marcin@python-works.com>
parents: 3222
diff changeset
269
72a91632b731 repository extra fields implementation
Marcin Kuzminski <marcin@python-works.com>
parents: 3222
diff changeset
270 new_field_key = All(v.FieldKey(),
72a91632b731 repository extra fields implementation
Marcin Kuzminski <marcin@python-works.com>
parents: 3222
diff changeset
271 v.UnicodeString(strip=True, min=3, not_empty=True))
72a91632b731 repository extra fields implementation
Marcin Kuzminski <marcin@python-works.com>
parents: 3222
diff changeset
272 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
273 new_field_type = v.OneOf(['str', 'unicode', 'list', 'tuple'],
72a91632b731 repository extra fields implementation
Marcin Kuzminski <marcin@python-works.com>
parents: 3222
diff changeset
274 if_missing='str')
72a91632b731 repository extra fields implementation
Marcin Kuzminski <marcin@python-works.com>
parents: 3222
diff changeset
275 new_field_label = v.UnicodeString(not_empty=False)
72a91632b731 repository extra fields implementation
Marcin Kuzminski <marcin@python-works.com>
parents: 3222
diff changeset
276 new_field_desc = v.UnicodeString(not_empty=False)
72a91632b731 repository extra fields implementation
Marcin Kuzminski <marcin@python-works.com>
parents: 3222
diff changeset
277
72a91632b731 repository extra fields implementation
Marcin Kuzminski <marcin@python-works.com>
parents: 3222
diff changeset
278 return _RepoFieldForm
72a91632b731 repository extra fields implementation
Marcin Kuzminski <marcin@python-works.com>
parents: 3222
diff changeset
279
72a91632b731 repository extra fields implementation
Marcin Kuzminski <marcin@python-works.com>
parents: 3222
diff changeset
280
2460
12fa0c19c42f validating choices for landing_rev
Marcin Kuzminski <marcin@python-works.com>
parents: 2459
diff changeset
281 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
282 repo_groups=[], landing_revs=[]):
530
a08f610e545e Implemented server side forks
Marcin Kuzminski <marcin@python-works.com>
parents: 529
diff changeset
283 class _RepoForkForm(formencode.Schema):
a08f610e545e Implemented server side forks
Marcin Kuzminski <marcin@python-works.com>
parents: 529
diff changeset
284 allow_extra_fields = True
a08f610e545e Implemented server side forks
Marcin Kuzminski <marcin@python-works.com>
parents: 529
diff changeset
285 filter_extra_fields = False
2467
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
286 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
287 v.SlugifyName())
2835
faffec4abbda Implemented permissions for writing to repo
Marcin Kuzminski <marcin@python-works.com>
parents: 2820
diff changeset
288 repo_group = All(v.CanWriteGroup(),
faffec4abbda Implemented permissions for writing to repo
Marcin Kuzminski <marcin@python-works.com>
parents: 2820
diff changeset
289 v.OneOf(repo_groups, hideList=True))
2467
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
290 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
291 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
292 private = v.StringBoolean(if_missing=False)
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
293 copy_permissions = v.StringBoolean(if_missing=False)
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
294 update_after_clone = v.StringBoolean(if_missing=False)
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
295 fork_parent_id = v.UnicodeString()
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
296 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
297 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
298
530
a08f610e545e Implemented server side forks
Marcin Kuzminski <marcin@python-works.com>
parents: 529
diff changeset
299 return _RepoForkForm
a08f610e545e Implemented server side forks
Marcin Kuzminski <marcin@python-works.com>
parents: 529
diff changeset
300
1950
4ae17f819ee8 #344 optional firstname lastname on user creation
Marcin Kuzminski <marcin@python-works.com>
parents: 1898
diff changeset
301
350
664a5b8c551a Added application settings, are now customizable from database
Marcin Kuzminski <marcin@python-works.com>
parents: 347
diff changeset
302 def ApplicationSettingsForm():
664a5b8c551a Added application settings, are now customizable from database
Marcin Kuzminski <marcin@python-works.com>
parents: 347
diff changeset
303 class _ApplicationSettingsForm(formencode.Schema):
664a5b8c551a Added application settings, are now customizable from database
Marcin Kuzminski <marcin@python-works.com>
parents: 347
diff changeset
304 allow_extra_fields = True
664a5b8c551a Added application settings, are now customizable from database
Marcin Kuzminski <marcin@python-works.com>
parents: 347
diff changeset
305 filter_extra_fields = False
4116
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
306 rhodecode_title = v.UnicodeString(strip=True, not_empty=False)
2467
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
307 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
308 rhodecode_ga_code = v.UnicodeString(strip=True, min=1, not_empty=False)
4116
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
309 rhodecode_captcha_public_key = v.UnicodeString(strip=True, min=1, not_empty=False)
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
310 rhodecode_captcha_private_key = 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
311
350
664a5b8c551a Added application settings, are now customizable from database
Marcin Kuzminski <marcin@python-works.com>
parents: 347
diff changeset
312 return _ApplicationSettingsForm
629
7e536d1af60d Code refactoring,models renames
Marcin Kuzminski <marcin@python-works.com>
parents: 555
diff changeset
313
1950
4ae17f819ee8 #344 optional firstname lastname on user creation
Marcin Kuzminski <marcin@python-works.com>
parents: 1898
diff changeset
314
2674
a221706dab50 merged + fixed pull request #62: Implemented metatags and visualisation options.
Marcin Kuzminski <marcin@python-works.com>
parents: 2595
diff changeset
315 def ApplicationVisualisationForm():
a221706dab50 merged + fixed pull request #62: Implemented metatags and visualisation options.
Marcin Kuzminski <marcin@python-works.com>
parents: 2595
diff changeset
316 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
317 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
318 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
319 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
320 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
321 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
322
3308
72a91632b731 repository extra fields implementation
Marcin Kuzminski <marcin@python-works.com>
parents: 3222
diff changeset
323 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
324 rhodecode_lightweight_journal = v.StringBoolean(if_missing=False)
3949
3301fb05b494 Improve validation on dashboard items field
Marcin Kuzminski <marcin@python-works.com>
parents: 3910
diff changeset
325 rhodecode_dashboard_items = v.Int(min=5, not_empty=True)
4116
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
326 rhodecode_admin_grid_items = v.Int(min=5, not_empty=True)
3910
36f7562a5919 Implements #842 RhodeCode version disclosure.
Marcin Kuzminski <marcin@python-works.com>
parents: 3904
diff changeset
327 rhodecode_show_version = v.StringBoolean(if_missing=False)
4116
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
328 rhodecode_use_gravatar = v.StringBoolean(if_missing=False)
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
329 rhodecode_gravatar_url = v.UnicodeString(min=3)
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
330 rhodecode_clone_uri_tmpl = v.UnicodeString(min=3)
2936
62e493c7f436 Added lightweight dashboard option. ref #500
Marcin Kuzminski <marcin@python-works.com>
parents: 2893
diff changeset
331
2674
a221706dab50 merged + fixed pull request #62: Implemented metatags and visualisation options.
Marcin Kuzminski <marcin@python-works.com>
parents: 2595
diff changeset
332 return _ApplicationVisualisationForm
a221706dab50 merged + fixed pull request #62: Implemented metatags and visualisation options.
Marcin Kuzminski <marcin@python-works.com>
parents: 2595
diff changeset
333
a221706dab50 merged + fixed pull request #62: Implemented metatags and visualisation options.
Marcin Kuzminski <marcin@python-works.com>
parents: 2595
diff changeset
334
388
3bcf9529d221 Added new application settings,Push ssl and repositories path
Marcin Kuzminski <marcin@python-works.com>
parents: 381
diff changeset
335 def ApplicationUiSettingsForm():
3bcf9529d221 Added new application settings,Push ssl and repositories path
Marcin Kuzminski <marcin@python-works.com>
parents: 381
diff changeset
336 class _ApplicationUiSettingsForm(formencode.Schema):
3bcf9529d221 Added new application settings,Push ssl and repositories path
Marcin Kuzminski <marcin@python-works.com>
parents: 381
diff changeset
337 allow_extra_fields = True
3bcf9529d221 Added new application settings,Push ssl and repositories path
Marcin Kuzminski <marcin@python-works.com>
parents: 381
diff changeset
338 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
339 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
340 paths_root_path = All(
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
341 v.ValidPath(),
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
342 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
343 )
2674
a221706dab50 merged + fixed pull request #62: Implemented metatags and visualisation options.
Marcin Kuzminski <marcin@python-works.com>
parents: 2595
diff changeset
344 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
345 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
346 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
347 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
348
2708
9bce679a3f49 Added form for controlling mercurial extensions
Marcin Kuzminski <marcin@python-works.com>
parents: 2674
diff changeset
349 extensions_largefiles = v.StringBoolean(if_missing=False)
9bce679a3f49 Added form for controlling mercurial extensions
Marcin Kuzminski <marcin@python-works.com>
parents: 2674
diff changeset
350 extensions_hgsubversion = v.StringBoolean(if_missing=False)
9bce679a3f49 Added form for controlling mercurial extensions
Marcin Kuzminski <marcin@python-works.com>
parents: 2674
diff changeset
351 extensions_hggit = v.StringBoolean(if_missing=False)
9bce679a3f49 Added form for controlling mercurial extensions
Marcin Kuzminski <marcin@python-works.com>
parents: 2674
diff changeset
352
388
3bcf9529d221 Added new application settings,Push ssl and repositories path
Marcin Kuzminski <marcin@python-works.com>
parents: 381
diff changeset
353 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
354
1950
4ae17f819ee8 #344 optional firstname lastname on user creation
Marcin Kuzminski <marcin@python-works.com>
parents: 1898
diff changeset
355
3056
6104dfd35b16 Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents: 3052
diff changeset
356 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
357 user_group_perms_choices, create_choices,
4116
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
358 create_on_write_choices, repo_group_create_choices,
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
359 user_group_create_choices, fork_choices,
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
360 register_choices, extern_activate_choices):
417
3ed2d46a2ca7 permission refactoring,
Marcin Kuzminski <marcin@python-works.com>
parents: 416
diff changeset
361 class _DefaultPermissionsForm(formencode.Schema):
3ed2d46a2ca7 permission refactoring,
Marcin Kuzminski <marcin@python-works.com>
parents: 416
diff changeset
362 allow_extra_fields = True
3ed2d46a2ca7 permission refactoring,
Marcin Kuzminski <marcin@python-works.com>
parents: 416
diff changeset
363 filter_extra_fields = True
3052
d3200c58764e implemented #663 Admin/permission: specify default repogroup perms
Marcin Kuzminski <marcin@python-works.com>
parents: 2986
diff changeset
364 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
365 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
366 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
367 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
368 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
369 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
370 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
371
a8f520540ab0 New default permissions definition for user group create
Marcin Kuzminski <marcin@python-works.com>
parents: 3714
diff changeset
372 default_repo_create = v.OneOf(create_choices)
4116
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
373 create_on_write = v.OneOf(create_on_write_choices)
3734
a8f520540ab0 New default permissions definition for user group create
Marcin Kuzminski <marcin@python-works.com>
parents: 3714
diff changeset
374 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
375 #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
376 default_fork = v.OneOf(fork_choices)
629
7e536d1af60d Code refactoring,models renames
Marcin Kuzminski <marcin@python-works.com>
parents: 555
diff changeset
377
3734
a8f520540ab0 New default permissions definition for user group create
Marcin Kuzminski <marcin@python-works.com>
parents: 3714
diff changeset
378 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
379 default_extern_activate = v.OneOf(extern_activate_choices)
417
3ed2d46a2ca7 permission refactoring,
Marcin Kuzminski <marcin@python-works.com>
parents: 416
diff changeset
380 return _DefaultPermissionsForm
705
9e9f1b919c0c implements #60, ldap configuration and authentication.
Marcin Kuzminski <marcin@python-works.com>
parents: 699
diff changeset
381
9e9f1b919c0c implements #60, ldap configuration and authentication.
Marcin Kuzminski <marcin@python-works.com>
parents: 699
diff changeset
382
3736
87e6960e250b Iteration on default permissions
Marcin Kuzminski <marcin@python-works.com>
parents: 3735
diff changeset
383 def CustomDefaultPermissionsForm():
87e6960e250b Iteration on default permissions
Marcin Kuzminski <marcin@python-works.com>
parents: 3735
diff changeset
384 class _CustomDefaultPermissionsForm(formencode.Schema):
87e6960e250b Iteration on default permissions
Marcin Kuzminski <marcin@python-works.com>
parents: 3735
diff changeset
385 filter_extra_fields = True
87e6960e250b Iteration on default permissions
Marcin Kuzminski <marcin@python-works.com>
parents: 3735
diff changeset
386 allow_extra_fields = True
87e6960e250b Iteration on default permissions
Marcin Kuzminski <marcin@python-works.com>
parents: 3735
diff changeset
387 inherit_default_permissions = v.StringBoolean(if_missing=False)
87e6960e250b Iteration on default permissions
Marcin Kuzminski <marcin@python-works.com>
parents: 3735
diff changeset
388
87e6960e250b Iteration on default permissions
Marcin Kuzminski <marcin@python-works.com>
parents: 3735
diff changeset
389 create_repo_perm = v.StringBoolean(if_missing=False)
87e6960e250b Iteration on default permissions
Marcin Kuzminski <marcin@python-works.com>
parents: 3735
diff changeset
390 create_user_group_perm = v.StringBoolean(if_missing=False)
87e6960e250b Iteration on default permissions
Marcin Kuzminski <marcin@python-works.com>
parents: 3735
diff changeset
391 #create_repo_group_perm Impl. later
87e6960e250b Iteration on default permissions
Marcin Kuzminski <marcin@python-works.com>
parents: 3735
diff changeset
392
87e6960e250b Iteration on default permissions
Marcin Kuzminski <marcin@python-works.com>
parents: 3735
diff changeset
393 fork_repo_perm = v.StringBoolean(if_missing=False)
87e6960e250b Iteration on default permissions
Marcin Kuzminski <marcin@python-works.com>
parents: 3735
diff changeset
394
87e6960e250b Iteration on default permissions
Marcin Kuzminski <marcin@python-works.com>
parents: 3735
diff changeset
395 return _CustomDefaultPermissionsForm
87e6960e250b Iteration on default permissions
Marcin Kuzminski <marcin@python-works.com>
parents: 3735
diff changeset
396
87e6960e250b Iteration on default permissions
Marcin Kuzminski <marcin@python-works.com>
parents: 3735
diff changeset
397
3056
6104dfd35b16 Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents: 3052
diff changeset
398 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
399 class _DefaultsForm(formencode.Schema):
6104dfd35b16 Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents: 3052
diff changeset
400 allow_extra_fields = True
6104dfd35b16 Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents: 3052
diff changeset
401 filter_extra_fields = True
6104dfd35b16 Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents: 3052
diff changeset
402 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
403 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
404 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
405 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
406 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
407
6104dfd35b16 Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents: 3052
diff changeset
408 return _DefaultsForm
6104dfd35b16 Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents: 3052
diff changeset
409
6104dfd35b16 Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents: 3052
diff changeset
410
4116
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
411 def AuthSettingsForm(current_active_modules):
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
412 class _AuthSettingsForm(formencode.Schema):
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
413 allow_extra_fields = True
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
414 filter_extra_fields = True
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
415 auth_plugins = All(v.ValidAuthPlugins(),
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
416 v.UniqueListFromString()(not_empty=True))
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
417
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
418 def __init__(self, *args, **kwargs):
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
419 # The auth plugins tell us what form validators they use
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
420 if current_active_modules:
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
421 import rhodecode.lib.auth_modules
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
422 from rhodecode.lib.auth_modules import LazyFormencode
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
423 for module in current_active_modules:
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
424 plugin = rhodecode.lib.auth_modules.loadplugin(module)
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
425 plugin_name = plugin.name
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
426 for sv in plugin.plugin_settings():
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
427 newk = "auth_%s_%s" % (plugin_name, sv["name"])
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
428 # can be a LazyFormencode object from plugin settings
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
429 validator = sv["validator"]
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
430 if isinstance(validator, LazyFormencode):
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
431 validator = validator()
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
432 #init all lazy validators from formencode.All
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
433 if isinstance(validator, All):
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
434 init_validators = []
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
435 for validator in validator.validators:
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
436 if isinstance(validator, LazyFormencode):
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
437 validator = validator()
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
438 init_validators.append(validator)
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
439 validator.validators = init_validators
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
440
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
441 self.add_field(newk, validator)
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
442 formencode.Schema.__init__(self, *args, **kwargs)
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
443
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
444 return _AuthSettingsForm
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
445
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
446
2467
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
447 def LdapSettingsForm(tls_reqcert_choices, search_scope_choices,
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
448 tls_kind_choices):
705
9e9f1b919c0c implements #60, ldap configuration and authentication.
Marcin Kuzminski <marcin@python-works.com>
parents: 699
diff changeset
449 class _LdapSettingsForm(formencode.Schema):
9e9f1b919c0c implements #60, ldap configuration and authentication.
Marcin Kuzminski <marcin@python-works.com>
parents: 699
diff changeset
450 allow_extra_fields = True
9e9f1b919c0c implements #60, ldap configuration and authentication.
Marcin Kuzminski <marcin@python-works.com>
parents: 699
diff changeset
451 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
452 #pre_validators = [LdapLibValidator]
2467
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
453 ldap_active = v.StringBoolean(if_missing=False)
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
454 ldap_host = v.UnicodeString(strip=True,)
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
455 ldap_port = v.Number(strip=True,)
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
456 ldap_tls_kind = v.OneOf(tls_kind_choices)
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
457 ldap_tls_reqcert = v.OneOf(tls_reqcert_choices)
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
458 ldap_dn_user = v.UnicodeString(strip=True,)
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
459 ldap_dn_pass = v.UnicodeString(strip=True,)
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
460 ldap_base_dn = v.UnicodeString(strip=True,)
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
461 ldap_filter = v.UnicodeString(strip=True,)
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
462 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
463 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
464 ldap_attr_firstname = v.UnicodeString(strip=True,)
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
465 ldap_attr_lastname = v.UnicodeString(strip=True,)
4419551b2915 Switched forms to new validators
Marcin Kuzminski <marcin@python-works.com>
parents: 2460
diff changeset
466 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
467
9e9f1b919c0c implements #60, ldap configuration and authentication.
Marcin Kuzminski <marcin@python-works.com>
parents: 699
diff changeset
468 return _LdapSettingsForm
2479
9225597688f4 Added validation into user email map
Marcin Kuzminski <marcin@python-works.com>
parents: 2467
diff changeset
469
9225597688f4 Added validation into user email map
Marcin Kuzminski <marcin@python-works.com>
parents: 2467
diff changeset
470
9225597688f4 Added validation into user email map
Marcin Kuzminski <marcin@python-works.com>
parents: 2467
diff changeset
471 def UserExtraEmailForm():
9225597688f4 Added validation into user email map
Marcin Kuzminski <marcin@python-works.com>
parents: 2467
diff changeset
472 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
473 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
474 return _UserExtraEmailForm
9b92cf5a0cca Added UserIpMap interface for allowed IP addresses and IP restriction access
Marcin Kuzminski <marcin@python-works.com>
parents: 3089
diff changeset
475
2479
9225597688f4 Added validation into user email map
Marcin Kuzminski <marcin@python-works.com>
parents: 2467
diff changeset
476
3125
9b92cf5a0cca Added UserIpMap interface for allowed IP addresses and IP restriction access
Marcin Kuzminski <marcin@python-works.com>
parents: 3089
diff changeset
477 def UserExtraIpForm():
9b92cf5a0cca Added UserIpMap interface for allowed IP addresses and IP restriction access
Marcin Kuzminski <marcin@python-works.com>
parents: 3089
diff changeset
478 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
479 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
480 return _UserExtraIpForm
2711
1de45f582f9d added more validations when opening pull request
Marcin Kuzminski <marcin@python-works.com>
parents: 2709
diff changeset
481
1de45f582f9d added more validations when opening pull request
Marcin Kuzminski <marcin@python-works.com>
parents: 2709
diff changeset
482
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
483 def PullRequestForm(repo_id):
2711
1de45f582f9d added more validations when opening pull request
Marcin Kuzminski <marcin@python-works.com>
parents: 2709
diff changeset
484 class _PullRequestForm(formencode.Schema):
1de45f582f9d added more validations when opening pull request
Marcin Kuzminski <marcin@python-works.com>
parents: 2709
diff changeset
485 allow_extra_fields = True
1de45f582f9d added more validations when opening pull request
Marcin Kuzminski <marcin@python-works.com>
parents: 2709
diff changeset
486 filter_extra_fields = True
1de45f582f9d added more validations when opening pull request
Marcin Kuzminski <marcin@python-works.com>
parents: 2709
diff changeset
487
1de45f582f9d added more validations when opening pull request
Marcin Kuzminski <marcin@python-works.com>
parents: 2709
diff changeset
488 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
489 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
490 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
491 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
492 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
493 revisions = All(#v.NotReviewedRevisions(repo_id)(),
4116
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
494 v.UniqueList()(not_empty=True))
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4058
diff changeset
495 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
496
4058
a2218bdbf45d pull requests: make title optional - generate one automatically
Mads Kiilerich <madski@unity3d.com>
parents: 4030
diff changeset
497 pullrequest_title = v.UnicodeString(strip=True, required=True)
2711
1de45f582f9d added more validations when opening pull request
Marcin Kuzminski <marcin@python-works.com>
parents: 2709
diff changeset
498 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
499
3486
2053053e0882 compare/pullrequest: introduce merge parameter
Mads Kiilerich <madski@unity3d.com>
parents: 3417
diff changeset
500 ancestor_rev = v.UnicodeString(strip=True, required=True)
2053053e0882 compare/pullrequest: introduce merge parameter
Mads Kiilerich <madski@unity3d.com>
parents: 3417
diff changeset
501 merge_rev = v.UnicodeString(strip=True, required=True)
2053053e0882 compare/pullrequest: introduce merge parameter
Mads Kiilerich <madski@unity3d.com>
parents: 3417
diff changeset
502
2815
acc05c33cc0c White space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 2749
diff changeset
503 return _PullRequestForm
3840
dc4644865e8b Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents: 3786
diff changeset
504
dc4644865e8b Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents: 3786
diff changeset
505
dc4644865e8b Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents: 3786
diff changeset
506 def GistForm(lifetime_options):
dc4644865e8b Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents: 3786
diff changeset
507 class _GistForm(formencode.Schema):
dc4644865e8b Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents: 3786
diff changeset
508
3846
2576a20d94ca Gist: don't allow files inside directories when creating gists
Marcin Kuzminski <marcin@python-works.com>
parents: 3840
diff changeset
509 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
510 v.UnicodeString(strip=True, required=False))
3840
dc4644865e8b Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents: 3786
diff changeset
511 description = v.UnicodeString(required=False, if_missing='')
dc4644865e8b Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents: 3786
diff changeset
512 lifetime = v.OneOf(lifetime_options)
4030
647308db13ff Added codemirror syntax mode in gists.
Marcin Kuzminski <marcin@python-works.com>
parents: 3960
diff changeset
513 mimetype = v.UnicodeString(required=False, if_missing=None)
3840
dc4644865e8b Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents: 3786
diff changeset
514 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
515 public = v.UnicodeString(required=False, if_missing='')
dc4644865e8b Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents: 3786
diff changeset
516 private = v.UnicodeString(required=False, if_missing='')
dc4644865e8b Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents: 3786
diff changeset
517
dc4644865e8b Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents: 3786
diff changeset
518 return _GistForm