class RegisterJournalSchema(colander.MappingSchema): """Representa o schema de dados para registro de periĆ³dicos. """ title = colander.SchemaNode(colander.String()) mission = colander.SchemaNode(colander.Mapping(unknown="preserve")) title_iso = colander.SchemaNode(colander.String()) short_title = colander.SchemaNode(colander.String()) title_slug = colander.SchemaNode(colander.String()) acronym = colander.SchemaNode(colander.String()) scielo_issn = colander.SchemaNode(colander.String()) print_issn = colander.SchemaNode(colander.String()) electronic_issn = colander.SchemaNode(colander.String()) status = colander.SchemaNode(colander.Mapping(unknown="preserve")) subject_areas = colander.SchemaNode(colander.List()) sponsors = colander.SchemaNode(colander.List()) metrics = colander.SchemaNode(colander.Mapping(unknown="preserve")) subject_categories = colander.SchemaNode(colander.List()) institution_responsible_for = colander.SchemaNode(colander.List()) online_submission_url = colander.SchemaNode(colander.String(), validator=colander.url) next_journal = colander.SchemaNode(colander.Mapping(unknown="preserve")) logo_url = colander.SchemaNode(colander.String(), validator=colander.url) previous_journal = colander.SchemaNode( colander.Mapping(unknown="preserve")) contact = colander.SchemaNode(colander.Mapping(unknown="preserve"))
class AdminUserOUManage(colander.MappingSchema): ou_managed = colander.SchemaNode(colander.List(), title=_('This user can register workstation under these Organitation Units'), widget=deferred_choices_widget) ou_availables = colander.SchemaNode(colander.List(), title=_('Organitation Unit availables to register workstations by this user'), widget=deferred_choices_widget)
class OptListStatisticCriterion(BaseStatisticCriterion): """ An Statistic criterion pointing to options ids stored in another table """ __table_args__ = default_table_args __mapper_args__ = {'polymorphic_identity': 'optlist'} id = Column(ForeignKey('base_statistic_criterion.id'), primary_key=True) searches = Column(JsonEncodedList(), info={ 'colanderalchemy': { 'typ': colander.List(), 'validator': list_of_integers_validator, } }) def __json__(self, request): res = BaseStatisticCriterion.__json__(self, request) res.update(dict(searches=self.searches, )) return res def duplicate(self): return OptListStatisticCriterion( key=self.key, method=self.method, searches=self.searches, )
class ProposalSettingsSchema(colander.Schema): hide_proposal_states = colander.SchemaNode( colander.Set(), title=_("Hide proposal states"), description=_("hide_proposal_states_description", default="Proposals in these states will be hidden by " "default but can be shown by pressing " "the link below the other proposals. They're not " "by any means invisible to participants."), widget=proposal_states_widget, default=('retracted', 'denied', 'unhandled'), ) system_userids = colander.SchemaNode( colander.List(), widget=MeetingUserReferenceWidget(multiple=True), validator=existing_userids, title=_("System user accounts"), description=_("system_userids_description", default="Must be an existing userid. " "If they're added here, moderators can use them " "to add proposals in their name. " "It's good practice to add things like 'propositions', " "'board' or similar."), missing=(), ) proposal_id_method = colander.SchemaNode( colander.String(), title=_("Proposal naming method"), widget=proposal_naming_widget, missing="", )
class RoleAssignment(colander.Schema): role = colander.SchemaNode( colander.String(), widget=deform.widget.TextInputWidget(template="textinput-noedit"), ) members = colander.SchemaNode(colander.List(), widget=member_select_widget(request))
class DCMetadataSchema(colander.Schema): title = colander.SchemaNode(colander.String()) description = colander.SchemaNode( colander.String(), widget=deform.widget.TextAreaWidget(rows=5), missing=u"") tags = colander.SchemaNode(colander.List(), title=_("Tags or subjects"), missing="", tab='metadata', widget=tagging_widget) creator = colander.SchemaNode( colander.List(), tab='metadata', widget=ReferenceWidget(query_params={'type_name': 'User'}), missing=(), default=current_users_uid) contributor = colander.SchemaNode( colander.List(), widget=ReferenceWidget(query_params={'type_name': 'User'}), tab='metadata', missing=()) created = colander.SchemaNode(DateTime(), default=default_now, missing=colander.null, tab='metadata') relation = colander.SchemaNode( colander.List(), title=_(u"Related content"), description=_(u"Can be used to link to other content"), tab='metadata', missing=(), widget=ReferenceWidget()) publisher = colander.SchemaNode(colander.String(), missing="", tab='metadata') date = colander.SchemaNode( DateTime(), title=_(u"Date"), description=_(u"Publish date, or used for sorting"), default=default_now, missing=colander.null, tab='metadata') rights = colander.SchemaNode(colander.String(), title=_(u"Licensing"), missing=u"", tab='metadata')
class DuttSchema(colander.Schema): widget = deform.widget.FormWidget(template='form_modal', readonly_template='readonly/form_modal') proposals = colander.SchemaNode(colander.List(), widget=deferred_proposal_widget, title=deferred_proposal_title, description=deferred_proposal_description, validator=deferred_dutts_validator)
class Permissions(colander.Schema): eduPersonEntitlement = colander.SchemaNode( colander.List(), title='', validator=PermissionsValidator(), missing=[], default=[], widget=permissions_widget)
class SelectContentSchema(colander.Schema): selected_content = colander.SchemaNode(colander.List(), title=_(u"Select content to show"), missing=(), widget=ReferenceWidget()) show_body = colander.SchemaNode( colander.Bool(), title=_(u"Show content body, if any"), )
class IRVPollSchema(colander.Schema): widget = deform.widget.FormWidget(template='form_modal', readonly_template='readonly/form_modal') proposals = colander.SchemaNode( colander.List(), title=_("Proposals"), widget=proposals_ordering_widget, validator=n_must_be_picked_validator, )
class STVPollSchema(colander.Schema): widget = deform.widget.FormWidget( template = 'form_modal', readonly_template = 'readonly/form_modal' ) proposals = colander.SchemaNode( colander.List(), widget = proposals_ordering_widget, title = _("Proposals"), )
def dataclass_field_to_colander_schemanode( prop: dataclasses.Field, oid_prefix='deformField') -> colander.SchemaNode: t = dataclass_get_type(prop) if t['type'] == date: return colander.SchemaNode(typ=colander.Date(), name=prop.name, oid='%s-%s' % (oid_prefix, prop.name), missing=colander.required if t['required'] else colander.drop) if t['type'] == datetime: return colander.SchemaNode(typ=colander.DateTime(), name=prop.name, oid='%s-%s' % (oid_prefix, prop.name), missing=colander.required if t['required'] else colander.drop) if t['type'] == str: return colander.SchemaNode(typ=colander.String(), name=prop.name, oid='%s-%s' % (oid_prefix, prop.name), missing=colander.required if t['required'] else colander.drop) if t['type'] == int: return colander.SchemaNode(typ=colander.Integer(), name=prop.name, oid='%s-%s' % (oid_prefix, prop.name), missing=colander.required if t['required'] else colander.drop) if t['type'] == float: return colander.SchemaNode(typ=colander.Float(), name=prop.name, oid='%s-%s' % (oid_prefix, prop.name), missing=colander.required if t['required'] else colander.drop) if t['type'] == bool: return colander.SchemaNode(typ=colander.Boolean(), name=prop.name, oid='%s-%s' % (oid_prefix, prop.name), missing=colander.required if t['required'] else colander.drop) if dataclass_check_type(prop, ISchema): subtype = dataclass_to_colander( t['type'], colander_schema_type=colander.MappingSchema) return subtype() if t['type'] == dict: return colander.SchemaNode(typ=colander.Mapping(), name=prop.name, oid='%s-%s' % (oid_prefix, prop.name), missing=colander.required if t['required'] else colander.drop) if t['type'] == list: return colander.SchemaNode( typ=colander.List(), name=prop.name, oid='%s-%s' % (oid_prefix, prop.name), missing=colander.required if t['required'] else colander.drop) raise KeyError(prop)
class AdminUserOUPerm(colander.MappingSchema): ou_selected = colander.SchemaNode(colander.List(), title=_('Select an Organization Unit'), widget=deferred_choices_widget) permission = colander.SchemaNode( colander.Set(), title=_('Permissions'), validator=colander.All(colander.Length(min=1), PermissionValidator()), widget=deform.widget.CheckboxChoiceWidget(values=PERMISSIONS, inline=True))
class IRedmineWebProject(colander.MappingSchema): name = colander.SchemaNode( colander.String(), title="Projekt Titel:", missing=colander.required, ) identifier = colander.SchemaNode( colander.String(), title="Projekt Name (Fiona Name):", missing=colander.required, ) description = colander.SchemaNode( colander.String(), title="Beschreibung des Projekts:", required=False, widget=deform.widget.TextAreaWidget(), missing=colander.drop, ) parent = colander.SchemaNode( colander.String(), title="Unterprojekt von:", widget=deform.widget.SelectWidget( values=redmine_config.fiona_base_projects)) homepage = colander.SchemaNode( colander.String(), title="Ziel Domain:", missing=colander.drop, ) status = colander.SchemaNode( colander.String(), title="Status des Webauftritts:", default="offline", widget=deform.widget.RadioChoiceWidget( values=redmine_config.project_statuss, ), missing=colander.drop, ) lang = colander.SchemaNode( colander.List(), title="Sprache des Webauftritts:", widget=deform.widget.SelectWidget( values=redmine_config.langs, multiple=True, default='de', size=2, ), missing=colander.drop, )
class RequirementItem(colander.MappingSchema): """Specific requirement item of an Order.""" id = colander.SchemaNode(colander.String(), validator=colander.uuid, missing='') category = colander.SchemaNode(colander.String()) min_number_assets = colander.SchemaNode(colander.Int()) description = colander.SchemaNode(colander.String(), missing='') tags = colander.SchemaNode(colander.List()) created_at = colander.SchemaNode(colander.DateTime(), missing='') created_by = colander.SchemaNode(colander.String(), validator=colander.uuid) folder_id = colander.SchemaNode(colander.String(), missing=colander.drop) parent_folder_id = colander.SchemaNode(colander.String(), missing=colander.drop) folder_name = colander.SchemaNode(colander.String(), missing=colander.drop)
class BaseOrgSchema(colander.Schema): title = colander.SchemaNode(colander.String(), title=_("Title")) description = colander.SchemaNode( colander.String(), title=_("Description"), widget=deform.widget.TextAreaWidget(rows=3), missing=u"") tags = colander.SchemaNode(colander.List(), title=_("Tags or subjects"), missing="", widget=tagging_widget) image_data = colander.SchemaNode(deform.FileData(), missing=None, title=_(u"Image"), blob_key='image', validator=supported_thumbnail_mimetype, widget=FileAttachmentWidget())
class TaskSchema(colander.Schema): title = colander.SchemaNode(colander.String(), title=_("Title")) description = colander.SchemaNode( colander.String(), title=_("Description"), widget=deform.widget.TextAreaWidget(rows=3), missing="") trello_card = colander.SchemaNode( colander.String(), title=_('Trello card'), missing='', widget=trello_card_widget, ) tags = colander.SchemaNode(colander.List(), title=_("Tags or subjects"), missing="", widget=tagging_widget)
class ITicketSchema(colander.MappingSchema): activate = colander.SchemaNode( colander.Boolean(), title='Activate Ticket', default=True, ) status = colander.SchemaNode( colander.List(), title="Start Status", widget=deform.widget.SelectWidget( values=redmine_config.ticket_statuss, multiple=False, default='1', ), missing=colander.drop, )
class EditEffectsSchema(colander.Schema): widget = deform.widget.FormWidget(template='voteit_form_inline') effect_time = colander.SchemaNode( colander.String(), title="Genomfƶrandetid", description="NƤr det hƤr kommer fƄ huvudsaklig effekt?", widget=deform.widget.SelectWidget(values=( ("", "- Ingen vald -"), ("TidKort", "Kort (inom ett Ƅr)"), ("TidMedel", "Medel (1-3 Ƅr)"), ("TidLƄng", "LƄng (3-5 Ƅr)"), )), missing="", ) effect_actors = colander.SchemaNode( colander.List(), title="Aktƶr(er)", description= "VƤlj max 2 st. Om det Ƥr fler involverade kan det vara bra att " "formulera fƶrslag mer precist fƶr de olika aktƶrerna.", widget=effect_actors_widget, validator=colander.Length(max=2), missing=())
def dataclass_field_to_colander_schemanode( prop: dataclasses.Field, oid_prefix='deformField') -> colander.SchemaNode: t = dataclass_get_type(prop) if t['type'] == date: params = colander_params(prop, oid_prefix, typ=colander.Date()) return colander.SchemaNode(**params) if t['type'] == datetime: params = colander_params(prop, oid_prefix, typ=colander.DateTime()) return colander.SchemaNode(**params) if t['type'] == str: params = colander_params(prop, oid_prefix, typ=colander.String()) return colander.SchemaNode(**params) if t['type'] == int: params = colander_params(prop, oid_prefix, typ=colander.Integer()) return colander.SchemaNode(**params) if t['type'] == float: params = colander_params(prop, oid_prefix, typ=colander.Float()) return colander.SchemaNode(**params) if t['type'] == bool: params = colander_params(prop, oid_prefix, typ=colander.Boolean()) return colander.SchemaNode(**params) if dataclass_check_type(prop, ISchema): subtype = dataclass_to_colander( t['type'], colander_schema_type=colander.MappingSchema) return subtype() if t['type'] == dict: params = colander_params(prop, oid_prefix, typ=colander.Mapping()) return colander.SchemaNode(**params) if t['type'] == list: params = colander_params(prop, oid_prefix, typ=colander.List()) return colander.SchemaNode(**params) raise KeyError(prop)
def list_property(**kwargs): return colander.SchemaNode(colander.List(), **kwargs)
class Tree(colander.MappingSchema): id = colander.SchemaNode( colander.String(), missing=colander.drop, ) contents = colander.SchemaNode(colander.List(), )
def dataclass_field_to_colander_schemanode( prop: dataclasses.Field, schema, request, oid_prefix="deformField", mode=None, default_tzinfo=pytz.UTC, metadata=None, ) -> colander.SchemaNode: """ Converts ``dataclass.Field`` to ``colander.SchemaNode`` :param prop: ``dataclass.Field`` object :param schema: ``dataclass`` class :param request: request object :param oid_prefix: prefix for field OID, defaults to 'deformField' :param mode: One of the following: ``'default'``, ``'edit'``, ``'edit-process'`` :param default_tzinfo: Default timezone to use for ``datetime`` handling, defaults to ``pytz.UTC`` :param metadata: additional metadata override :return: converted ``colander.SchemaNode`` """ metadata = metadata or {} t = dataclass_get_type(prop) t["metadata"].update(metadata) field_factory = t["metadata"].get("colander.field_factory", None) if field_factory: params = colander_params( prop, oid_prefix, typ=field_factory(request), schema=schema, request=request, mode=mode, ) return SchemaNode(**params) if t["type"] == date: params = colander_params( prop, oid_prefix, typ=colander.Date(), schema=schema, request=request, mode=mode, ) return SchemaNode(**params) if t["type"] == datetime: params = colander_params( prop, oid_prefix, typ=colander.DateTime(default_tzinfo=default_tzinfo), schema=schema, request=request, mode=mode, ) return SchemaNode(**params) if t["type"] == str: params = colander_params( prop, oid_prefix, typ=String(allow_empty=True), schema=schema, request=request, mode=mode, ) return SchemaNode(**params) if t["type"] == int: params = colander_params( prop, oid_prefix, typ=colander.Integer(), schema=schema, request=request, mode=mode, ) return SchemaNode(**params) if t["type"] == float: params = colander_params( prop, oid_prefix, typ=colander.Float(), schema=schema, request=request, mode=mode, ) return SchemaNode(**params) if t["type"] == bool: params = colander_params( prop, oid_prefix, typ=Boolean(), schema=schema, request=request, mode=mode, ) return SchemaNode(**params) if is_dataclass_field(prop): subtype = dc2colander( t["type"], request=request, colander_schema_type=colander.MappingSchema, mode=mode, ) return subtype() if t["type"] == dict: params = colander_params( prop, oid_prefix, typ=Mapping(unknown="preserve"), schema=schema, request=request, mode=mode, ) return SchemaNode(**params) if t["type"] == list: params = colander_params( prop, oid_prefix, typ=colander.List(), schema=schema, request=request, mode=mode, ) return SchemaNode(**params) if t["type"] == deform.FileData: params = colander_params( prop, oid_prefix, typ=deform.FileData(), schema=schema, request=request, mode=mode, ) return SchemaNode(**params) if t["type"] == set: params = colander_params( prop, oid_prefix, typ=colander.Set(), schema=schema, request=request, mode=mode, ) return SchemaNode(**params) raise KeyError(prop)
""" profile_service = getUtility(IUserProfileQuery) return profile_service.get_data(user_id) _ID_COLANDER = { 'title': 'ID', 'validator': colander.uuid, 'missing': colander.drop, 'typ': colander.String() } _ID_COLANDER_LIST = { 'title': 'List of IDs', 'missing': colander.drop, 'typ': colander.List() } class UserProfileRolesMixin: """Local roles for the UserProfile context.""" __actors__ = ('owner', ) __colanderalchemy_config__ = { 'overrides': { 'owner': _ID_COLANDER_LIST, } }
class EmbeddedItemsSchema(MappingNode): items = colander.SchemaNode(colander.List(), title='List of items', missing=colander.drop)
class CustomerUserProfile(UserProfile): """A Customer on our system.""" __tablename__ = 'customeruserprofiles' _workflow = workflows.CustomerUserProfileWorkflow __summary_attributes__ = UserProfile.__summary_attributes__.copy() + [ 'customer_roles', 'project_roles', ] __listing_attributes__ = __summary_attributes__ + [ 'internal', 'company_name', ] __to_dict_additional_attributes__ = [ 'project_customer_pm', 'project_customer_qa', 'customer_roles' ] __raw_acl__ = ( ('create', ('g:briefy_bizdev', 'g:briefy_finance', 'g:briefy_pm', 'g:system')), ('list', ('g:briefy', 'g:system')), ('view', ('g:briefy', 'g:system')), ('edit', ('g:briefy_bizdev', 'g:briefy_finance', 'g:briefy_pm', 'g:system')), ('delete', ('g:briefy_finance', 'g:system')), ) __colanderalchemy_config__ = { 'overrides': { 'customer_roles': { 'title': 'User roles in the customer', 'typ': colander.List() }, 'project_customer_pm': { 'title': 'Projects with PM role', 'missing': colander.drop, 'typ': colander.List() }, 'project_customer_qa': { 'title': 'Projects with QA role', 'missing': colander.drop, 'typ': colander.List() }, 'owner': { 'title': 'Owner IDs', 'missing': colander.drop, 'typ': colander.List() }, } } id = sa.Column(UUIDType(), sa.ForeignKey('userprofiles.id'), index=True, unique=True, primary_key=True, info={ 'colanderalchemy': { 'title': 'User ID', 'validator': colander.uuid, 'missing': colander.drop, 'typ': colander.String() } }) customer_id = sa.Column(UUIDType(), sa.ForeignKey('customers.id'), index=True, info={ 'colanderalchemy': { 'title': 'Customer ID', 'validator': colander.uuid, 'missing': colander.drop, 'typ': colander.String() } }) @classmethod def create(cls, payload) -> object: """Factory that creates a new instance of this object. :param payload: Dictionary containing attributes and values :type payload: dict """ payload = deepcopy(payload) pop_attrs = [ 'project_customer_qa', 'project_customer_pm', 'customer_roles' ] update_kwargs = {} for attr in pop_attrs: value = payload.pop(attr, None) if value: update_kwargs[attr] = value obj = super().create(payload) obj.update(update_kwargs) return obj @hybrid_property def customer(self): """Customer object this user belongs.""" return Customer.get(self.customer_id) @property def _customer_roles(self) -> list: """Get customer roles for this user in the customer context.""" customer = Customer.get(self.customer_id) return [ r.role_name for r in customer.local_roles if str(r.principal_id) == str(self.id) ] @hybrid_property def customer_roles(self) -> list: """Return roles related to this customer user profile.""" return self._customer_roles @customer_roles.setter def customer_roles(self, roles: list): """Add customer_user role for this customer user profile.""" customer = self.customer set_local_roles_by_principal(customer, self.id, roles) @hybrid_property def project_ids(self): """Return a list of project ids related to the customer the user belongs.""" roles = LocalRole.query().filter(LocalRole.item_type == 'project', LocalRole.principal_id == self.id) return [lr.item_id for lr in roles] @hybrid_property def _project_roles(self): """Local roles of this user in the Customer context as project_user.""" roles = LocalRole.query().filter(LocalRole.item_type == 'project', LocalRole.principal_id == self.id) role_map = {lr.item_id: lr.role_name for lr in roles} result = {} for project_id, role_name in role_map.items(): if not result.get(str(project_id)): result[str(project_id)] = [role_name] else: result[str(project_id)].append(role_name) return result @hybrid_property def project_roles(self): """Return roles related to this project user profile.""" return self._project_roles @project_roles.setter def project_roles(self, roles_map: dict): """Update the Projects that this user has customer_user role.""" from briefy.leica.models import Project for project_id, new_roles in roles_map.items(): project = Project.get(project_id) set_local_roles_by_principal(project, self.id, new_roles) def _project_ids_by_role(self, role_name: str) -> list: """Return the list of projects ids the user has a local role.""" roles = LocalRole.query().filter(LocalRole.item_type == 'project', LocalRole.principal_id == self.id, LocalRole.role_name == role_name) return [str(lr.item_id) for lr in roles] def _update_projects_by_role(self, role_name: str, new_project_ids: list) -> list: """Update the list of projects the user has a local role.""" projects = self.customer.projects current_project_ids = self._project_ids_by_role(role_name) for project in projects: project_id = str(project.id) session = project.__session__ if project_id in new_project_ids and project_id not in current_project_ids: add_local_role(session, project, role_name, self.id) elif project_id not in new_project_ids and project_id in current_project_ids: for lr in project.local_roles: if lr.role_name == role_name and lr.principal_id == self.id: del_local_role(session, project, lr) @hybrid_property def project_customer_pm(self) -> list: """Return the list of projects ids the user has project_customer_pm local role.""" return self._project_ids_by_role('project_customer_pm') @project_customer_pm.setter def project_customer_pm(self, new_project_ids: list): """Update the list of projects that this user has project_customer_pm role.""" self._update_projects_by_role('project_customer_pm', new_project_ids) @hybrid_property def project_customer_qa(self) -> list: """Return the list of projects ids the user has project_customer_qa local role.""" return self._project_ids_by_role('project_customer_qa') @project_customer_qa.setter def project_customer_qa(self, new_project_ids: list): """Update the list of projects that this user has project_customer_qa role.""" self._update_projects_by_role('project_customer_qa', new_project_ids) @property def projects(self): """Return Projects attached to this profile.""" from briefy.leica.models import Project project_ids = self.project_ids return Project.query().filter(Project.id.in_(project_ids)).all() def summarize_relations(self, objs): """Return a summarized version of an object.""" response = [] for obj in objs: response.append({ 'id': obj.id, 'title': obj.title, 'state': obj.state, }) return response def to_dict(self, excludes: list = None, includes: list = None): """Return a dict representation of this object.""" data = super().to_dict(excludes=excludes, includes=includes) data['customers'] = self.summarize_relations([self.customer]) data['projects'] = self.summarize_relations(self.projects) return data
class Rmodel(colander.MappingSchema): arguments = Arguments(missing=colander.drop) options = Options() properties = Properties(missing=colander.drop) databases = colander.SchemaNode(colander.List(), missing=colander.drop) dbfarm = colander.SchemaNode(colander.String(), missing=colander.drop)
class Professional(UserProfile): """A Professional on our system.""" __tablename__ = 'professionals' _workflow = ProfessionalWorkflow __summary_attributes__ = [ 'id', 'title', 'description', 'created_at', 'updated_at', 'state', 'email', 'mobile', 'photo_path', 'slug', 'first_name', 'last_name', ] __summary_attributes_relations__ = ['links', 'main_location', 'locations', 'pools'] __exclude_attributes__ = ['comments', 'assets', 'assignments'] __listing_attributes__ = __summary_attributes__ + ['main_location'] __to_dict_additional_attributes__ = ['locations', 'links'] __colanderalchemy_config__ = { 'excludes': [ 'state_history', 'state', 'profiles', 'type', 'external_id', 'comments', '_owner', 'billing_info' ], 'overrides': { 'pools_ids': { 'title': 'pool ids', 'default': [], 'missing': colander.drop, 'typ': colander.List() }, 'mobile': { 'title': 'Mobile phone number', 'default': '', 'missing': colander.drop, 'typ': colander.String }, } } __raw_acl__ = ( ('create', ('g:briefy_scout', 'g:briefy_finance', 'g:briefy_qa', 'g:system')), ('list', ('g:briefy', 'g:system')), ('view', ('g:briefy', 'g:system')), ('edit', ('g:briefy_scout', 'g:briefy_finance', 'g:briefy_qa', 'g:system')), ('delete', ('g:briefy_finance', 'g:system')), ) id = sa.Column( UUIDType(), sa.ForeignKey('userprofiles.id'), index=True, unique=True, primary_key=True, info={'colanderalchemy': { 'title': 'Professional id', 'validator': colander.uuid, 'missing': colander.drop, 'typ': colander.String}} ) accept_travel = sa.Column(sa.Boolean(), default=False, index=True) """Accept travel to other locations to work.""" external_id = sa.Column( sa.String(255), nullable=True, info={'colanderalchemy': { 'title': 'External ID', 'missing': colander.drop, 'typ': colander.String}} ) """External ID from knack. Used as key in the Intercom integration for professionals created on Knack.""" # Profile information photo_path = sa.Column( sa.String(255), nullable=True, info={'colanderalchemy': { 'title': 'Photo Path', 'missing': colander.drop, 'typ': colander.String}} ) # assignments assignments = orm.relationship( 'Assignment', foreign_keys='Assignment.professional_id', lazy='dynamic' ) # Assets assets = orm.relationship( 'Asset', backref=orm.backref('professional'), lazy='dynamic' ) # Links _links = orm.relationship( 'Link', backref='professional', cascade='all, delete-orphan', info={ 'colanderalchemy': { 'title': 'Links', 'missing': colander.drop } } ) links = MultipleRelationshipWrapper( '_links', Link, 'professional_id' ) """Descriptor to handle multiple links get, set and delete.""" # Comments comments = orm.relationship( 'Comment', foreign_keys='Comment.entity_id', order_by='desc(Comment.created_at)', primaryjoin='Comment.entity_id == Professional.id', lazy='dynamic' ) """Comments connected to this professional. Collection of :class:`briefy.leica.models.comment.Comment`. """ # Locations _locations = orm.relationship( 'WorkingLocation', backref=orm.backref( 'professional', enable_typechecks=False, ), cascade='all, delete-orphan', info={ 'colanderalchemy': { 'title': 'Locations', 'missing': colander.drop } } ) locations = MultipleRelationshipWrapper( '_locations', WorkingLocation, 'professional_id' ) """Descriptor to handle multiple location get, set and delete.""" _main_location = orm.relationship( 'MainWorkingLocation', uselist=False, viewonly=False, cascade='all, delete-orphan', info={ 'colanderalchemy': { 'title': 'Main Location', 'missing': colander.drop } } ) """Professional Main working Location. Relationship with :class:`briefy.leica.models.professional.location.MainWorkingLocation`. """ main_location = UnaryRelationshipWrapper( '_main_location', MainWorkingLocation, 'professional_id' ) """Descriptor to handle main location get, set and delete.""" pools = orm.relationship( 'Pool', secondary='professionals_in_pool', back_populates='professionals', lazy='dynamic', ) billing_info = orm.relationship('ProfessionalBillingInfo', uselist=False) @declared_attr def _external_model_(cls): """Name of the model on Knack.""" return 'Photographer' def to_dict(self, excludes: list=None, includes: list=None): """Return a dict representation of this object.""" data = super().to_dict(excludes=excludes, includes=includes) data['billing_info_id'] = self.billing_info.id if self.billing_info else '' data['intercom'] = intercom_payload_professional(self) return data
class Django1_7ConfigurationSchema(colander.MappingSchema): """Configuration schema for Django 1.7.""" ABSOLUTE_URL_OVERRIDES = colander.SchemaNode( colander.Mapping(unknown='preserve'), missing=global_settings.ABSOLUTE_URL_OVERRIDES, default=global_settings.ABSOLUTE_URL_OVERRIDES, ) ADMIN_FOR = colander.SchemaNode( colander.Sequence(), missing=global_settings.ADMIN_FOR, default=global_settings.ADMIN_FOR, children=[ colander.SchemaNode(colander.String()), ] ) ADMINS = colander.SchemaNode( colander.Sequence(), missing=global_settings.ADMINS, default=global_settings.ADMINS, children=[ colander.SchemaNode( colander.Tuple(), children=[ colander.SchemaNode(colander.String()), colander.SchemaNode( colander.String(), validator=colander.Email(), ), ] ), ] ) ALLOWED_HOSTS = colander.SchemaNode( colander.Sequence(), missing=global_settings.ALLOWED_HOSTS, default=global_settings.ALLOWED_HOSTS, children=[ colander.SchemaNode(colander.String()), ] ) ALLOWED_INCLUDE_ROOTS = colander.SchemaNode( colander.Sequence(), missing=global_settings.ALLOWED_INCLUDE_ROOTS, default=global_settings.ALLOWED_INCLUDE_ROOTS, children=[ colander.SchemaNode(colander.String()), ] ) APPEND_SLASH = colander.SchemaNode( colander.Boolean(), missing=global_settings.APPEND_SLASH, default=global_settings.APPEND_SLASH, ) AUTHENTICATION_BACKENDS = colander.SchemaNode( colander.Sequence(), missing=global_settings.AUTHENTICATION_BACKENDS, default=global_settings.AUTHENTICATION_BACKENDS, children=[ colander.SchemaNode(colander.String()), ] ) AUTH_USER_MODEL = colander.SchemaNode( colander.String(), missing=global_settings.AUTH_USER_MODEL, default=global_settings.AUTH_USER_MODEL, ) CACHES = colander.SchemaNode( colander.Mapping(unknown='preserve'), missing=global_settings.CACHES, default=global_settings.CACHES, children=[ colander.SchemaNode( colander.Mapping(unknown='raise'), name='default', missing=colander.drop, children=[ colander.SchemaNode( colander.String(), name='BACKEND', missing=colander.required, default=colander.null, ), colander.SchemaNode( colander.String(), name='KEY_FUNCTION', missing=colander.drop, default='', ), colander.SchemaNode( colander.String(), name='KEY_PREFIX', missing=colander.drop, default='', ), colander.SchemaNode( colander.String(), name='LOCATION', missing=colander.drop, default='', ), colander.SchemaNode( colander.Mapping(unknown='preserve'), name='OPTIONS', missing=colander.drop, default={}, ), colander.SchemaNode( colander.Integer(), name='TIMEOUT', missing=colander.drop, default=300, ), colander.SchemaNode( colander.String(), name='VERSION', missing=colander.drop, default=1, ), ] ), ] ) CACHE_MIDDLEWARE_ALIAS = colander.SchemaNode( colander.String(), missing=global_settings.CACHE_MIDDLEWARE_ALIAS, default=global_settings.CACHE_MIDDLEWARE_ALIAS, ) CACHE_MIDDLEWARE_ANONYMOUS_ONLY = colander.SchemaNode( colander.Boolean(), missing=colander.drop, # Not in django.conf.global_settings. default=False, ) CACHE_MIDDLEWARE_KEY_PREFIX = colander.SchemaNode( colander.String(), missing=global_settings.CACHE_MIDDLEWARE_KEY_PREFIX, default=global_settings.CACHE_MIDDLEWARE_KEY_PREFIX, ) CACHE_MIDDLEWARE_SECONDS = colander.SchemaNode( colander.Integer(), missing=global_settings.CACHE_MIDDLEWARE_SECONDS, default=global_settings.CACHE_MIDDLEWARE_SECONDS, ) COMMENTS_ALLOW_PROFANITIES = colander.SchemaNode( colander.Boolean(), missing=False, default=False, ) CSRF_COOKIE_AGE = colander.SchemaNode( colander.Integer(), missing=global_settings.CSRF_COOKIE_AGE, default=global_settings.CSRF_COOKIE_AGE, ) CSRF_COOKIE_DOMAIN = colander.SchemaNode( colander.String(), missing=global_settings.CSRF_COOKIE_DOMAIN, default=global_settings.CSRF_COOKIE_DOMAIN, ) CSRF_COOKIE_HTTPONLY = colander.SchemaNode( colander.Boolean(), missing=global_settings.CSRF_COOKIE_HTTPONLY, default=global_settings.CSRF_COOKIE_HTTPONLY, ) CSRF_COOKIE_NAME = colander.SchemaNode( colander.String(), missing=global_settings.CSRF_COOKIE_NAME, default=global_settings.CSRF_COOKIE_NAME, ) CSRF_COOKIE_PATH = colander.SchemaNode( colander.String(), missing=global_settings.CSRF_COOKIE_PATH, default=global_settings.CSRF_COOKIE_PATH, ) CSRF_COOKIE_SECURE = colander.SchemaNode( colander.Boolean(), missing=global_settings.CSRF_COOKIE_SECURE, default=global_settings.CSRF_COOKIE_SECURE, ) CSRF_FAILURE_VIEW = colander.SchemaNode( colander.String(), missing=global_settings.CSRF_FAILURE_VIEW, default=global_settings.CSRF_FAILURE_VIEW, ) DATABASES = colander.SchemaNode( colander.Mapping(unknown='preserve'), missing=colander.required, default=colander.null, children=[ colander.SchemaNode( colander.Mapping(unknown='raise'), name='default', missing=None, children=[ # See django.db.utils.ConnectionHandler.ensure_defaults colander.SchemaNode( colander.String(), name='ENGINE', missing=colander.drop, default='', ), colander.SchemaNode( colander.String(), name='HOST', missing=colander.drop, default='', ), colander.SchemaNode( colander.String(), name='NAME', missing=colander.drop, default='', ), colander.SchemaNode( colander.Mapping(unknown='preserve'), name='OPTIONS', missing=colander.drop, default={}, ), colander.SchemaNode( colander.String(), name='PASSWORD', missing=colander.drop, default='', ), colander.SchemaNode( colander.String(), name='PORT', missing=colander.drop, default='', ), colander.SchemaNode( colander.String(), name='USER', missing=colander.drop, default='', ), colander.SchemaNode( colander.Boolean(), name='ATOMIC_REQUESTS', missing=colander.drop, default=False, ), colander.SchemaNode( colander.Boolean(), name='AUTOCOMMIT', missing=colander.drop, default=True, ), colander.SchemaNode( colander.Integer(), name='CONN_MAX_AGE', missing=colander.drop, default=0, ), colander.SchemaNode( colander.Mapping(unknown='raise'), name='default', missing=None, children=[ colander.SchemaNode( colander.String(), name='CHARSET', missing=colander.drop, default=None, ), colander.SchemaNode( colander.String(), name='COLLATION', missing=colander.drop, default=None, ), colander.SchemaNode( colander.Sequence(), name='DEPENDENCIES', missing=colander.drop, default=['default'], children=[ colander.SchemaNode(colander.String()), ] ), colander.SchemaNode( colander.String(), name='MIRROR', missing=colander.drop, default=None, ), colander.SchemaNode( colander.String(), name='NAME', missing=colander.drop, default=None, ), colander.SchemaNode( colander.Boolean(), name='CREATE_DB', missing=colander.drop, default=True, ), colander.SchemaNode( colander.String(), name='USER', missing=colander.drop, default=None, ), colander.SchemaNode( colander.Boolean(), name='CREATE_USER', missing=colander.drop, default=True, ), colander.SchemaNode( colander.String(), name='PASSWORD', missing=colander.drop, default=None, ), colander.SchemaNode( colander.String(), name='TBLSPACE', missing=colander.drop, default=None, ), colander.SchemaNode( colander.String(), name='TBLSPACE_TMP', missing=colander.drop, default=None, ), ] ), ] ), ] ) DATABASE_ROUTERS = colander.SchemaNode( colander.Sequence(), missing=global_settings.DATABASE_ROUTERS, default=global_settings.DATABASE_ROUTERS, children=[ colander.SchemaNode( colander.String(), ), ] ) DATE_FORMAT = colander.SchemaNode( colander.String(), missing=global_settings.DATE_FORMAT, default=global_settings.DATE_FORMAT, ) DATE_INPUT_FORMATS = colander.SchemaNode( colander.Sequence(), missing=global_settings.DATE_INPUT_FORMATS, default=global_settings.DATE_INPUT_FORMATS, children=[ colander.SchemaNode( colander.String(), ), ] ) DATETIME_FORMAT = colander.SchemaNode( colander.String(), missing=global_settings.DATETIME_FORMAT, default=global_settings.DATETIME_FORMAT, ) DATETIME_INPUT_FORMATS = colander.SchemaNode( colander.Sequence(), missing=global_settings.DATETIME_INPUT_FORMATS, default=global_settings.DATETIME_INPUT_FORMATS, children=[ colander.SchemaNode( colander.String(), ), ] ) DEBUG = colander.SchemaNode( colander.Boolean(), missing=global_settings.DEBUG, default=global_settings.DEBUG, ) DEBUG_PROPAGATE_EXCEPTIONS = colander.SchemaNode( colander.Boolean(), missing=global_settings.DEBUG, default=global_settings.DEBUG, ) DECIMAL_SEPARATOR = colander.SchemaNode( colander.String(), missing=global_settings.DECIMAL_SEPARATOR, default=global_settings.DECIMAL_SEPARATOR, ) DEFAULT_CHARSET = colander.SchemaNode( colander.String(), missing=global_settings.DEFAULT_CHARSET, default=global_settings.DEFAULT_CHARSET, ) DEFAULT_CONTENT_TYPE = colander.SchemaNode( colander.String(), missing=global_settings.DEFAULT_CONTENT_TYPE, default=global_settings.DEFAULT_CONTENT_TYPE, ) DEFAULT_EXCEPTION_REPORTER_FILTER = colander.SchemaNode( colander.String(), missing=global_settings.DEFAULT_EXCEPTION_REPORTER_FILTER, default=global_settings.DEFAULT_EXCEPTION_REPORTER_FILTER, ) DEFAULT_FILE_STORAGE = colander.SchemaNode( colander.String(), missing=global_settings.DEFAULT_FILE_STORAGE, default=global_settings.DEFAULT_FILE_STORAGE, ) DEFAULT_FROM_EMAIL = colander.SchemaNode( colander.String(), missing=global_settings.DEFAULT_FROM_EMAIL, default=global_settings.DEFAULT_FROM_EMAIL, validator=colander.Email(), ) DEFAULT_INDEX_TABLESPACE = colander.SchemaNode( colander.String(), missing=global_settings.DEFAULT_INDEX_TABLESPACE, default=global_settings.DEFAULT_INDEX_TABLESPACE, ) DEFAULT_TABLESPACE = colander.SchemaNode( colander.String(), missing=global_settings.DEFAULT_TABLESPACE, default=global_settings.DEFAULT_TABLESPACE, ) DISALLOWED_USER_AGENTS = colander.SchemaNode( colander.Sequence(), missing=global_settings.DISALLOWED_USER_AGENTS, default=global_settings.DISALLOWED_USER_AGENTS, children=[ colander.SchemaNode( colander.String(), ), ] ) EMAIL_BACKEND = colander.SchemaNode( colander.String(), missing=global_settings.EMAIL_BACKEND, default=global_settings.EMAIL_BACKEND, ) EMAIL_FILE_PATH = colander.SchemaNode( colander.String(), missing=colander.drop, # Not in djanco.conf.globalsettings default=colander.null, ) EMAIL_HOST = colander.SchemaNode( colander.String(), missing=global_settings.EMAIL_HOST, default=global_settings.EMAIL_HOST, ) EMAIL_HOST_PASSWORD = colander.SchemaNode( colander.String(), missing=global_settings.EMAIL_HOST_PASSWORD, default=global_settings.EMAIL_HOST_PASSWORD, ) EMAIL_HOST_USER = colander.SchemaNode( colander.String(), missing=global_settings.EMAIL_HOST_USER, default=global_settings.EMAIL_HOST_USER, ) EMAIL_PORT = colander.SchemaNode( colander.Integer(), missing=global_settings.EMAIL_PORT, default=global_settings.EMAIL_PORT, ) EMAIL_SUBJECT_PREFIX = colander.SchemaNode( colander.String(), missing=global_settings.EMAIL_SUBJECT_PREFIX, default=global_settings.EMAIL_SUBJECT_PREFIX, ) EMAIL_USE_TLS = colander.SchemaNode( colander.Boolean(), missing=global_settings.EMAIL_USE_TLS, default=global_settings.EMAIL_USE_TLS, ) EMAIL_USE_SSL = colander.SchemaNode( colander.Boolean(), missing=global_settings.EMAIL_USE_SSL, default=global_settings.EMAIL_USE_SSL, ) FORMAT_MODULE_PATH = colander.SchemaNode( colander.String(), missing=global_settings.FORMAT_MODULE_PATH, default=global_settings.FORMAT_MODULE_PATH, ) FILE_CHARSET = colander.SchemaNode( colander.String(), missing=global_settings.FILE_CHARSET, default=global_settings.FILE_CHARSET, ) FILE_UPLOAD_DIRECTORY_PERMISSIONS = colander.SchemaNode( colander.String(), missing=global_settings.FILE_UPLOAD_DIRECTORY_PERMISSIONS, default=global_settings.FILE_UPLOAD_DIRECTORY_PERMISSIONS, ) FILE_UPLOAD_HANDLERS = colander.SchemaNode( colander.Sequence(), missing=global_settings.FILE_UPLOAD_HANDLERS, default=global_settings.FILE_UPLOAD_HANDLERS, children=[ colander.SchemaNode( colander.String(), ), ] ) FILE_UPLOAD_MAX_MEMORY_SIZE = colander.SchemaNode( colander.Integer(), missing=global_settings.FILE_UPLOAD_MAX_MEMORY_SIZE, default=global_settings.FILE_UPLOAD_MAX_MEMORY_SIZE, ) FILE_UPLOAD_PERMISSIONS = colander.SchemaNode( colander.Integer(), missing=global_settings.FILE_UPLOAD_PERMISSIONS, default=global_settings.FILE_UPLOAD_PERMISSIONS, ) FILE_UPLOAD_TEMP_DIR = colander.SchemaNode( colander.String(), missing=global_settings.FILE_UPLOAD_TEMP_DIR, default=global_settings.FILE_UPLOAD_TEMP_DIR, ) FIRST_DAY_OF_WEEK = colander.SchemaNode( colander.Integer(), missing=global_settings.FIRST_DAY_OF_WEEK, default=global_settings.FIRST_DAY_OF_WEEK, ) FIXTURE_DIRS = colander.SchemaNode( colander.Sequence(), missing=global_settings.FIXTURE_DIRS, default=global_settings.FIXTURE_DIRS, children=[ colander.SchemaNode( colander.String(), ), ] ) FORCE_SCRIPT_NAME = colander.SchemaNode( colander.String(), missing=global_settings.FORCE_SCRIPT_NAME, default=global_settings.FORCE_SCRIPT_NAME, ) IGNORABLE_404_URLS = colander.SchemaNode( colander.Sequence(), missing=global_settings.IGNORABLE_404_URLS, default=global_settings.IGNORABLE_404_URLS, children=[ colander.SchemaNode( colander.String(), ), ] ) INSTALLED_APPS = colander.SchemaNode( colander.Sequence(), missing=colander.required, default=colander.null, children=[ colander.SchemaNode(colander.String()), ] ) INTERNAL_IPS = colander.SchemaNode( colander.Sequence(), missing=global_settings.INTERNAL_IPS, default=global_settings.INTERNAL_IPS, children=[ colander.SchemaNode(colander.String()), ] ) LANGUAGE_CODE = colander.SchemaNode( colander.String(), missing=global_settings.LANGUAGE_CODE, default=global_settings.LANGUAGE_CODE, ) LANGUAGE_COOKIE_AGE = colander.SchemaNode( colander.Integer(), missing=global_settings.LANGUAGE_COOKIE_AGE, default=global_settings.LANGUAGE_COOKIE_AGE, ) LANGUAGE_COOKIE_DOMAIN = colander.SchemaNode( colander.String(), missing=global_settings.LANGUAGE_COOKIE_DOMAIN, default=global_settings.LANGUAGE_COOKIE_DOMAIN, ) LANGUAGE_COOKIE_NAME = colander.SchemaNode( colander.String(), missing=global_settings.LANGUAGE_COOKIE_NAME, default=global_settings.LANGUAGE_COOKIE_NAME, ) LANGUAGE_COOKIE_PATH = colander.SchemaNode( colander.String(), missing=global_settings.LANGUAGE_COOKIE_PATH, default=global_settings.LANGUAGE_COOKIE_PATH, ) LANGUAGES = colander.SchemaNode( colander.Sequence(), missing=global_settings.LANGUAGES, default=global_settings.LANGUAGES, children=[ colander.SchemaNode( colander.Tuple(), children=[ colander.SchemaNode(colander.String()), colander.SchemaNode(colander.String()), ] ), ] ) LANGUAGES_BIDI = colander.SchemaNode( colander.Sequence(), missing=global_settings.LANGUAGES_BIDI, default=global_settings.LANGUAGES_BIDI, children=[ colander.SchemaNode(colander.String()), ] ) LOCALE_PATHS = colander.SchemaNode( colander.Sequence(), missing=global_settings.LOCALE_PATHS, default=global_settings.LOCALE_PATHS, children=[ colander.SchemaNode(colander.String()), ] ) LOGGING = colander.SchemaNode( colander.Mapping(unknown='preserve'), missing=global_settings.LOGGING, default=global_settings.LOGGING, ) LOGGING_CONFIG = colander.SchemaNode( colander.String(), missing=global_settings.LOGGING_CONFIG, default=global_settings.LOGGING_CONFIG, ) LOGIN_REDIRECT_URL = colander.SchemaNode( colander.String(), missing=global_settings.LOGIN_REDIRECT_URL, default=global_settings.LOGIN_REDIRECT_URL, ) LOGIN_URL = colander.SchemaNode( colander.String(), missing=global_settings.LOGIN_URL, default=global_settings.LOGIN_URL, ) LOGOUT_URL = colander.SchemaNode( colander.String(), missing=global_settings.LOGOUT_URL, default=global_settings.LOGOUT_URL, ) MANAGERS = colander.SchemaNode( colander.Sequence(), missing=global_settings.MANAGERS, default=global_settings.MANAGERS, children=[ colander.SchemaNode( colander.Tuple(), children=[ colander.SchemaNode(colander.String()), colander.SchemaNode( colander.String(), validator=colander.Email(), ), ] ), ] ) MEDIA_ROOT = colander.SchemaNode( colander.String(), missing=global_settings.MEDIA_ROOT, default=global_settings.MEDIA_ROOT, ) MEDIA_URL = colander.SchemaNode( colander.String(), missing=global_settings.MEDIA_URL, default=global_settings.MEDIA_URL, ) MESSAGE_LEVEL = colander.SchemaNode( colander.Integer(), missing=colander.drop, # Not in django.conf.global_settings default=messages.INFO, ) MESSAGE_STORAGE = colander.SchemaNode( colander.String(), missing=global_settings.MESSAGE_STORAGE, default=global_settings.MESSAGE_STORAGE, ) MESSAGE_TAGS = colander.SchemaNode( colander.Mapping(unknown='preserve'), missing=colander.drop, # Not in django.conf.global_settings default=messages.DEFAULT_TAGS, children=[ colander.SchemaNode( colander.String(), ), ] ) MIDDLEWARE_CLASSES = colander.SchemaNode( colander.Sequence(), missing=global_settings.MIDDLEWARE_CLASSES, default=global_settings.MIDDLEWARE_CLASSES, children=[ colander.SchemaNode(colander.String()), ] ) MIGRATION_MODULES = colander.SchemaNode( colander.Mapping(unknown='preserve'), missing=global_settings.MIGRATION_MODULES, default=global_settings.MIGRATION_MODULES, ) MONTH_DAY_FORMAT = colander.SchemaNode( colander.String(), missing=global_settings.MONTH_DAY_FORMAT, default=global_settings.MONTH_DAY_FORMAT, ) NUMBER_GROUPING = colander.SchemaNode( colander.Integer(), missing=global_settings.NUMBER_GROUPING, default=global_settings.NUMBER_GROUPING, ) PASSWORD_HASHERS = colander.SchemaNode( colander.Sequence(), missing=global_settings.PASSWORD_HASHERS, default=global_settings.PASSWORD_HASHERS, children=[ colander.SchemaNode( colander.String(), ), ] ) PASSWORD_RESET_TIMEOUT_DAYS = colander.SchemaNode( colander.Integer(), missing=global_settings.PASSWORD_RESET_TIMEOUT_DAYS, default=global_settings.PASSWORD_RESET_TIMEOUT_DAYS, ) PREPEND_WWW = colander.SchemaNode( colander.Boolean(), missing=global_settings.PREPEND_WWW, default=global_settings.PREPEND_WWW, ) PROFANITIES_LIST = colander.SchemaNode( colander.Sequence(), missing=global_settings.PROFANITIES_LIST, default=global_settings.PROFANITIES_LIST, children=[ colander.SchemaNode( colander.String(), ), ] ) RESTRUCTUREDTEXT_FILTER_SETTINGS = colander.SchemaNode( colander.Mapping(unknown='preserve'), missing=colander.drop, # Not in django.conf.global_settings default={}, ) ROOT_URLCONF = colander.SchemaNode( colander.String(), missing=colander.drop, # Not in django.conf.global_settings default=colander.null, ) SECRET_KEY = colander.SchemaNode( colander.String(), missing=colander.required, default=colander.null, ) SECURE_PROXY_SSL_HEADER = colander.SchemaNode( TupleOrNone(), missing=global_settings.SECURE_PROXY_SSL_HEADER, default=global_settings.SECURE_PROXY_SSL_HEADER, children=[ colander.SchemaNode(colander.String()), colander.SchemaNode(colander.String()), ] ) SEND_BROKEN_LINK_EMAILS = colander.SchemaNode( colander.Boolean(), missing=global_settings.SEND_BROKEN_LINK_EMAILS, default=global_settings.SEND_BROKEN_LINK_EMAILS, ) SERIALIZATION_MODULES = colander.SchemaNode( colander.Mapping(unknown='preserve'), missing=colander.drop, default={}, children=[ colander.SchemaNode( colander.String(), ), ] ) SERVER_EMAIL = colander.SchemaNode( colander.String(), missing=global_settings.SERVER_EMAIL, default=global_settings.SERVER_EMAIL, ) SESSION_COOKIE_AGE = colander.SchemaNode( colander.Integer(), missing=global_settings.SESSION_COOKIE_AGE, default=global_settings.SESSION_COOKIE_AGE, ) SESSION_COOKIE_DOMAIN = colander.SchemaNode( colander.String(), missing=global_settings.SESSION_COOKIE_DOMAIN, default=global_settings.SESSION_COOKIE_DOMAIN, ) SESSION_COOKIE_HTTPONLY = colander.SchemaNode( colander.Boolean(), missing=global_settings.SESSION_COOKIE_HTTPONLY, default=global_settings.SESSION_COOKIE_HTTPONLY, ) SESSION_COOKIE_NAME = colander.SchemaNode( colander.String(), missing=global_settings.SESSION_COOKIE_NAME, default=global_settings.SESSION_COOKIE_NAME, ) SESSION_COOKIE_PATH = colander.SchemaNode( colander.String(), missing=global_settings.SESSION_COOKIE_PATH, default=global_settings.SESSION_COOKIE_PATH, ) SESSION_CACHE_ALIAS = colander.SchemaNode( colander.String(), missing=global_settings.SESSION_CACHE_ALIAS, default=global_settings.SESSION_CACHE_ALIAS, ) SESSION_COOKIE_SECURE = colander.SchemaNode( colander.Boolean(), missing=global_settings.SESSION_COOKIE_SECURE, default=global_settings.SESSION_COOKIE_SECURE, ) SESSION_ENGINE = colander.SchemaNode( colander.String(), missing=global_settings.SESSION_ENGINE, default=global_settings.SESSION_ENGINE, ) SESSION_EXPIRE_AT_BROWSER_CLOSE = colander.SchemaNode( colander.Boolean(), missing=global_settings.SESSION_EXPIRE_AT_BROWSER_CLOSE, default=global_settings.SESSION_EXPIRE_AT_BROWSER_CLOSE, ) SESSION_FILE_PATH = colander.SchemaNode( colander.String(), missing=global_settings.SESSION_FILE_PATH, default=global_settings.SESSION_FILE_PATH, ) SESSION_SAVE_EVERY_REQUEST = colander.SchemaNode( colander.Boolean(), missing=global_settings.SESSION_SAVE_EVERY_REQUEST, default=global_settings.SESSION_SAVE_EVERY_REQUEST, ) SESSION_SERIALIZER = colander.SchemaNode( colander.String(), missing=global_settings.SESSION_SERIALIZER, default=global_settings.SESSION_SERIALIZER, ) SHORT_DATE_FORMAT = colander.SchemaNode( colander.String(), missing=global_settings.SHORT_DATE_FORMAT, default=global_settings.SHORT_DATE_FORMAT, ) SHORT_DATETIME_FORMAT = colander.SchemaNode( colander.String(), missing=global_settings.SHORT_DATETIME_FORMAT, default=global_settings.SHORT_DATETIME_FORMAT, ) SIGNING_BACKEND = colander.SchemaNode( colander.String(), missing=global_settings.SIGNING_BACKEND, default=global_settings.SIGNING_BACKEND, ) SILENCED_SYSTEM_CHECKS = colander.SchemaNode( colander.Sequence(), missing=global_settings.SILENCED_SYSTEM_CHECKS, default=global_settings.SILENCED_SYSTEM_CHECKS, children=[ colander.SchemaNode(colander.String()), ] ) SITE_ID = colander.SchemaNode( colander.Integer(), missing=colander.drop, default=colander.null, ) STATIC_ROOT = colander.SchemaNode( colander.String(), missing=global_settings.STATIC_ROOT, default=global_settings.STATIC_ROOT, ) STATIC_URL = colander.SchemaNode( colander.String(), missing=global_settings.STATIC_URL, default=global_settings.STATIC_URL, ) STATICFILES_DIRS = colander.SchemaNode( colander.Sequence(), missing=global_settings.STATICFILES_DIRS, default=global_settings.STATICFILES_DIRS, children=[ colander.SchemaNode(colander.String()), ] ) STATICFILES_FINDERS = colander.SchemaNode( colander.Sequence(), missing=global_settings.STATICFILES_FINDERS, default=global_settings.STATICFILES_FINDERS, children=[ colander.SchemaNode(colander.String()), ] ) STATICFILES_STORAGE = colander.SchemaNode( colander.String(), missing=global_settings.STATICFILES_STORAGE, default=global_settings.STATICFILES_STORAGE, ) TEMPLATE_CONTEXT_PROCESSORS = colander.SchemaNode( colander.Sequence(), missing=global_settings.TEMPLATE_CONTEXT_PROCESSORS, default=global_settings.TEMPLATE_CONTEXT_PROCESSORS, children=[ colander.SchemaNode(colander.String()), ] ) TEMPLATE_DEBUG = colander.SchemaNode( colander.Boolean(), missing=global_settings.TEMPLATE_DEBUG, default=global_settings.TEMPLATE_DEBUG, ) TEMPLATE_DIRS = colander.SchemaNode( colander.Sequence(), missing=global_settings.TEMPLATE_DIRS, default=global_settings.TEMPLATE_DIRS, children=[ colander.SchemaNode(colander.String()), ] ) TEMPLATE_LOADERS = colander.SchemaNode( colander.List(), missing=global_settings.TEMPLATE_LOADERS, default=global_settings.TEMPLATE_LOADERS, children=[ colander.SchemaNode(colander.String()), ] ) TEMPLATE_STRING_IF_INVALID = colander.SchemaNode( colander.String(), missing=global_settings.TEMPLATE_STRING_IF_INVALID, default=global_settings.TEMPLATE_STRING_IF_INVALID, ) TEST_NON_SERIALIZED_APPS = colander.SchemaNode( colander.Sequence(), missing=global_settings.TEST_NON_SERIALIZED_APPS, default=global_settings.TEST_NON_SERIALIZED_APPS, children=[ colander.SchemaNode(colander.String()), ] ) TEST_RUNNER = colander.SchemaNode( colander.String(), missing=global_settings.TEST_RUNNER, default=global_settings.TEST_RUNNER, ) THOUSAND_SEPARATOR = colander.SchemaNode( colander.String(), missing=global_settings.THOUSAND_SEPARATOR, default=global_settings.THOUSAND_SEPARATOR, ) TIME_FORMAT = colander.SchemaNode( colander.String(), missing=global_settings.TIME_FORMAT, default=global_settings.TIME_FORMAT, ) TIME_INPUT_FORMATS = colander.SchemaNode( colander.Sequence(), missing=global_settings.TIME_INPUT_FORMATS, default=global_settings.TIME_INPUT_FORMATS, children=[ colander.SchemaNode(colander.String()), ] ) TIME_ZONE = colander.SchemaNode( colander.String(), missing=global_settings.TIME_ZONE, default=global_settings.TIME_ZONE, ) TRANSACTIONS_MANAGED = colander.SchemaNode( colander.Boolean(), missing=global_settings.TRANSACTIONS_MANAGED, default=global_settings.TRANSACTIONS_MANAGED, ) USE_ETAGS = colander.SchemaNode( colander.Boolean(), missing=global_settings.USE_ETAGS, default=global_settings.USE_ETAGS, ) USE_I18N = colander.SchemaNode( colander.Boolean(), missing=global_settings.USE_I18N, default=global_settings.USE_I18N, ) USE_L10N = colander.SchemaNode( colander.Boolean(), missing=global_settings.USE_L10N, default=global_settings.USE_L10N, ) USE_THOUSAND_SEPARATOR = colander.SchemaNode( colander.Boolean(), missing=global_settings.USE_THOUSAND_SEPARATOR, default=global_settings.USE_THOUSAND_SEPARATOR, ) USE_TZ = colander.SchemaNode( colander.Boolean(), missing=global_settings.USE_TZ, default=global_settings.USE_TZ, ) USE_X_FORWARDED_HOST = colander.SchemaNode( colander.Boolean(), missing=global_settings.USE_X_FORWARDED_HOST, default=global_settings.USE_X_FORWARDED_HOST, ) WSGI_APPLICATION = colander.SchemaNode( colander.String(), missing=global_settings.WSGI_APPLICATION, default=global_settings.WSGI_APPLICATION, ) YEAR_MONTH_FORMAT = colander.SchemaNode( colander.String(), missing=global_settings.YEAR_MONTH_FORMAT, default=global_settings.YEAR_MONTH_FORMAT, ) X_FRAME_OPTIONS = colander.SchemaNode( colander.String(), missing=global_settings.X_FRAME_OPTIONS, default=global_settings.X_FRAME_OPTIONS, )
class GeoJSONSchema(colander.MappingSchema): """GeoJSON Point schema validator.""" type = colander.SchemaNode(colander.String()) coordinates = colander.SchemaNode(colander.List())