class _ApplicationVisualisationForm(formencode.Schema): allow_extra_fields = True filter_extra_fields = False show_public_icon = v.StringBoolean(if_missing=False) show_private_icon = v.StringBoolean(if_missing=False) stylify_metatags = v.StringBoolean(if_missing=False) repository_fields = v.StringBoolean(if_missing=False) lightweight_journal = v.StringBoolean(if_missing=False) dashboard_items = v.Int(min=5, not_empty=True) admin_grid_items = v.Int(min=5, not_empty=True) show_version = v.StringBoolean(if_missing=False) use_gravatar = v.StringBoolean(if_missing=False) gravatar_url = v.UnicodeString(min=3) clone_uri_tmpl = v.UnicodeString(min=3)
class _RepoForm(formencode.Schema): allow_extra_fields = True filter_extra_fields = False repo_name = All(v.UnicodeString(strip=True, min=1, not_empty=True), v.SlugifyName()) repo_group = All(v.CanWriteGroup(old_data), v.OneOf(repo_group_ids, hideList=True), v.Int(min=-1, not_empty=True)) repo_type = v.OneOf(supported_backends, required=False, if_missing=old_data.get('repo_type')) repo_description = v.UnicodeString(strip=True, min=1, not_empty=False) repo_private = v.StringBoolean(if_missing=False) repo_landing_rev = v.OneOf(landing_revs, hideList=True) repo_copy_permissions = v.StringBoolean(if_missing=False) clone_uri = All(v.UnicodeString(strip=True, min=1, not_empty=False)) repo_enable_statistics = v.StringBoolean(if_missing=False) repo_enable_downloads = v.StringBoolean(if_missing=False) repo_enable_locking = v.StringBoolean(if_missing=False) if edit: owner = All(v.UnicodeString(not_empty=True), v.ValidRepoUser()) # Not a real field - just for reference for validation: # clone_uri_hidden = v.UnicodeString(if_missing='') chained_validators = [ v.ValidCloneUri(), v.ValidRepoName(edit, old_data) ]
class _RepoGroupForm(formencode.Schema): allow_extra_fields = True filter_extra_fields = False group_name = All( v.UnicodeString(strip=True, min=1, not_empty=True), v.SlugifyName(), v.ValidRegex( msg=_('Name must not contain only digits'))(r'(?!^\d+$)^.+$')) group_description = v.UnicodeString(strip=True, min=1, not_empty=False) group_copy_permissions = v.StringBoolean(if_missing=False) if edit: #FIXME: do a special check that we cannot move a group to one of #its children pass parent_group_id = All( v.CanCreateGroup(can_create_in_root), v.OneOf(repo_group_ids, hideList=False, testValueList=True, if_missing=None, not_empty=True), v.Int(min=-1, not_empty=True)) enable_locking = v.StringBoolean(if_missing=False) chained_validators = [v.ValidRepoGroup(edit, old_data)]
class _RepoForkForm(formencode.Schema): allow_extra_fields = True filter_extra_fields = False repo_name = All(v.UnicodeString(strip=True, min=1, not_empty=True), v.SlugifyName()) repo_group = All(v.CanWriteGroup(), v.OneOf(repo_group_ids, hideList=True), v.Int(min=-1, not_empty=True)) repo_type = All(v.ValidForkType(old_data), v.OneOf(supported_backends)) description = v.UnicodeString(strip=True, min=1, not_empty=True) private = v.StringBoolean(if_missing=False) copy_permissions = v.StringBoolean(if_missing=False) update_after_clone = v.StringBoolean(if_missing=False) fork_parent_id = v.UnicodeString() chained_validators = [v.ValidForkName(edit, old_data)] landing_rev = v.OneOf(landing_revs, hideList=True)