def update_field(session, tid, field_id, field, language): """ Update the specified field with the details. """ field = db_update_field(session, tid, field_id, field, language) return serialize_field(session, tid, field, language)
def create_field(store, field_dict, language, request_type=None): """ Transaction that perform db_create_field """ field = db_create_field(store, field_dict, language if request_type != 'import' else None) return serialize_field(store, field, language)
def create_field(session, tid, field_dict, language): """ Transaction that perform db_create_field """ field = db_create_field(session, tid, field_dict, language) return serialize_field(session, tid, field, language)
def get_fieldtemplate_list(session, tid, language): """ Serialize all the field templates localizing their content depending on the language. """ templates = session.query(models.Field).filter(models.Field.tid.in_(set([1, tid])), models.Field.instance == 'template', models.Field.fieldgroup_id == None) return [serialize_field(session, tid, f, language) for f in templates]
def get_fieldtemplate_list(session, tid, language): """ Serialize all the field templates localizing their content depending on the language. """ templates = session.query(models.Field).filter(models.Field.tid.in_(set([1, tid])), models.Field.instance == u'template', models.Field.fieldgroup_id == None) return [serialize_field(session, tid, f, language) for f in templates]
def update_field(session, tid, field_id, field, language): """ Transaction for updating a field :param session: An ORM session :param tid: The tenant ID :param request: The request data :param language: The language of the request :return: The serialized descriptor of the updated field """ field = db_update_field(session, tid, field_id, field, language) return serialize_field(session, tid, field, language)
def update_field(session, tid, field_id, field, language): """ Update the specified field with the details. :param session: the session on which perform queries. :param field_id: the field_id of the field to update :param field: the field definition dict :param language: the language of the field definition dict :return: a serialization of the object """ field = db_update_field(session, tid, field_id, field, language) return serialize_field(session, tid, field, language)
def get_fieldtemplate_list(store, language): """ Serialize all the field templates localizing their content depending on the language. :param store: the store on which perform queries. :param language: the language of the field definition dict :return: the current field list serialized. :rtype: list of dict """ templates = store.find(models.Field, instance=u'template', fieldgroup_id=None) return [serialize_field(store, f, language) for f in templates]
def get_fieldtemplate_list(session, tid, language): """ Transaction to retrieve the list of the field templates defined on a tenant :param session: An ORM session :param tid: The tenant ID on which perform the lookup :param language: The language of the request :return: The list of serialized field template descriptors """ templates = session.query(models.Field).filter(models.Field.tid.in_(set([1, tid])), models.Field.instance == 'template', models.Field.fieldgroup_id.is_(None)) return [serialize_field(session, tid, f, language) for f in templates]
def get_fieldtemplate_list(session, tid, language): """ Serialize all the field templates localizing their content depending on the language. :param session: the session on which perform queries. :param language: the language of the field definition dict :return: the current field list serialized. :rtype: list of dict """ templates = session.query(models.Field).filter( models.Field.tid.in_(set([1, tid])), models.Field.instance == u'template', models.Field.fieldgroup_id == None) return [serialize_field(session, tid, f, language) for f in templates]
def get_field(store, field_id, language): """ Serialize a specified field :param store: the store on which perform queries. :param field_id: the id corresponding to the field. :param language: the language in which to localize data :return: the currently configured field. :rtype: dict """ field = store.find(models.Field, models.Field.id == field_id).one() if not field: raise errors.FieldIdNotFound return serialize_field(store, field, language)
def update_field(store, field_id, field, language): """ Update the specified field with the details. raises :class:`globaleaks.errors.FieldIdNotFound` if the field does not exist. :param store: the store on which perform queries. :param field_id: the field_id of the field to update :param field: the field definition dict :param language: the language of the field definition dict :return: a serialization of the object """ field = db_update_field(store, field_id, field, language) return serialize_field(store, field, language)
def get_field(store, field_id, language, request_type=None): """ Serialize a specified field :param store: the store on which perform queries. :param field_id: the id corresponding to the field. :param language: the language in which to localize data :return: the currently configured field. :rtype: dict """ field = store.find(models.Field, models.Field.id == field_id).one() if not field: raise errors.FieldIdNotFound return serialize_field(store, field, language if request_type != 'export' else None)
def update_field(store, field_id, field, language, request_type=None): """ Update the specified field with the details. raises :class:`globaleaks.errors.FieldIdNotFound` if the field does not exist. :param store: the store on which perform queries. :param field_id: the field_id of the field to update :param field: the field definition dict :param language: the language of the field definition dict :return: a serialization of the object """ field = db_update_field(store, field_id, field, language if request_type != 'import' else None) return serialize_field(store, field, language)
def get_fieldtemplate_list(store, language, request_type=None): """ Serialize all the field templates localizing their content depending on the language. :param store: the store on which perform queries. :param language: the language of the field definition dict :return: the current field list serialized. :rtype: list of dict """ language = language if request_type != "export" else None ret = [] for f in store.find(models.Field, And(models.Field.instance == u"template", models.Field.fieldgroup_id == None)): ret.append(serialize_field(store, f, language)) return ret
def get_fieldtemplate_list(store, language, request_type=None): """ Serialize all the field templates localizing their content depending on the language. :param store: the store on which perform queries. :param language: the language of the field definition dict :return: the current field list serialized. :rtype: list of dict """ language = language if request_type != 'export' else None ret = [] for f in store.find( models.Field, And(models.Field.instance == u'template', models.Field.fieldgroup_id == None)): ret.append(serialize_field(store, f, language)) return ret