当前位置: 首页>>代码示例>>Python>>正文


Python Rosetta.acquire_storm_object方法代码示例

本文整理汇总了Python中globaleaks.utils.structures.Rosetta.acquire_storm_object方法的典型用法代码示例。如果您正苦于以下问题:Python Rosetta.acquire_storm_object方法的具体用法?Python Rosetta.acquire_storm_object怎么用?Python Rosetta.acquire_storm_object使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在globaleaks.utils.structures.Rosetta的用法示例。


在下文中一共展示了Rosetta.acquire_storm_object方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_receivertip_list

# 需要导入模块: from globaleaks.utils.structures import Rosetta [as 别名]
# 或者: from globaleaks.utils.structures.Rosetta import acquire_storm_object [as 别名]
def get_receivertip_list(store, receiver_id, language):
    rtip_summary_list = []

    for rtip in store.find(ReceiverTip, ReceiverTip.receiver_id == receiver_id):
        mo = Rosetta(rtip.internaltip.context.localized_keys)
        mo.acquire_storm_object(rtip.internaltip.context)

        rtip_summary_list.append({
            'id': rtip.id,
            'creation_date': datetime_to_ISO8601(rtip.internaltip.creation_date),
            'last_access': datetime_to_ISO8601(rtip.last_access),
            'update_date': datetime_to_ISO8601(rtip.internaltip.update_date),
            'expiration_date': datetime_to_ISO8601(rtip.internaltip.expiration_date),
            'progressive': rtip.internaltip.progressive,
            'new': rtip.access_counter == 0 or rtip.last_access < rtip.internaltip.update_date,
            'context_name': mo.dump_localized_key('name', language),
            'access_counter': rtip.access_counter,
            'file_counter': rtip.internaltip.internalfiles.count(),
            'comment_counter': rtip.internaltip.comments.count(),
            'message_counter': rtip.messages.count(),
            'tor2web': rtip.internaltip.tor2web,
            'questionnaire_hash': rtip.internaltip.questionnaire_hash,
            'preview_schema': db_get_archived_preview_schema(store, rtip.internaltip.questionnaire_hash, language),
            'preview': rtip.internaltip.preview,
            'total_score': rtip.internaltip.total_score,
            'label': rtip.label
        })

    return rtip_summary_list
开发者ID:comradekingu,项目名称:GlobaLeaks,代码行数:31,代码来源:receiver.py

示例2: anon_serialize_receiver

# 需要导入模块: from globaleaks.utils.structures import Rosetta [as 别名]
# 或者: from globaleaks.utils.structures.Rosetta import acquire_storm_object [as 别名]
def anon_serialize_receiver(receiver, language=GLSetting.memory_copy.default_language):
    """
    @param receiver: a valid Storm object
    @return: a dict describing the receivers available in the node
        (e.g. checks if almost one context is associated, or, in
         node where GPG encryption is enforced, that a valid key is registered)
    """
    receiver_dict = {
        "contexts": [],
    }

    for context in receiver.contexts:
        receiver_dict['contexts'].append(unicode(context.id))

    if not len(receiver_dict['contexts']):
        return None

    receiver_dict.update({
        "can_delete_submission": receiver.can_delete_submission,
        "creation_date": pretty_date_time(receiver.creation_date),
        "update_date": pretty_date_time(receiver.last_update),
        "name": unicode(receiver.name),
        "receiver_gus": unicode(receiver.id),
        "receiver_level": int(receiver.receiver_level),
        "tags": receiver.tags,
    })

    mo = Rosetta()
    mo.acquire_storm_object(receiver)
    receiver_dict['description'] = mo.dump_translated('description', language)

    return receiver_dict
开发者ID:rowanthorpe,项目名称:GLBackend,代码行数:34,代码来源:node.py

示例3: serialize_itip

# 需要导入模块: from globaleaks.utils.structures import Rosetta [as 别名]
# 或者: from globaleaks.utils.structures.Rosetta import acquire_storm_object [as 别名]
def serialize_itip(store, internaltip, language):
    context = internaltip.context
    mo = Rosetta(context.localized_keys)
    mo.acquire_storm_object(context)

    return {
        "id": internaltip.id,
        "creation_date": datetime_to_ISO8601(internaltip.creation_date),
        "update_date": datetime_to_ISO8601(internaltip.update_date),
        "expiration_date": datetime_to_ISO8601(internaltip.expiration_date),
        "progressive": internaltip.progressive,
        "context_id": internaltip.context_id,
        "context_name": mo.dump_localized_key("name", language),
        "questionnaire": db_get_archived_questionnaire_schema(store, internaltip.questionnaire_hash, language),
        "tor2web": internaltip.tor2web,
        "timetolive": context.tip_timetolive,
        "enable_comments": context.enable_comments,
        "enable_messages": context.enable_messages,
        "enable_two_way_comments": internaltip.enable_two_way_comments,
        "enable_two_way_messages": internaltip.enable_two_way_messages,
        "enable_attachments": internaltip.enable_attachments,
        "enable_whistleblower_identity": internaltip.enable_whistleblower_identity,
        "identity_provided": internaltip.identity_provided,
        "identity_provided_date": datetime_to_ISO8601(internaltip.identity_provided_date),
        "show_receivers": context.show_receivers,
    }
开发者ID:tempbottle,项目名称:GlobaLeaks,代码行数:28,代码来源:submission.py

示例4: serialize_itip

# 需要导入模块: from globaleaks.utils.structures import Rosetta [as 别名]
# 或者: from globaleaks.utils.structures.Rosetta import acquire_storm_object [as 别名]
def serialize_itip(store, internaltip, language):
    context = internaltip.context
    mo = Rosetta(context.localized_keys)
    mo.acquire_storm_object(context)

    return {
        'id': internaltip.id,
        'creation_date': datetime_to_ISO8601(internaltip.creation_date),
        'update_date': datetime_to_ISO8601(internaltip.update_date),
        'expiration_date': datetime_to_ISO8601(internaltip.expiration_date),
        'progressive': internaltip.progressive,
        'context_id': internaltip.context_id,
        'context_name': mo.dump_localized_key('name', language),
        'questionnaire': db_get_archived_questionnaire_schema(store, internaltip.questionnaire_hash, language),
        'tor2web': internaltip.tor2web,
        'timetolive': context.tip_timetolive,
        'enable_comments': context.enable_comments,
        'enable_messages': context.enable_messages,
        'enable_two_way_comments': internaltip.enable_two_way_comments,
        'enable_two_way_messages': internaltip.enable_two_way_messages,
        'enable_attachments': internaltip.enable_attachments,
        'enable_whistleblower_identity': internaltip.enable_whistleblower_identity,
        'identity_provided': internaltip.identity_provided,
        'identity_provided_date': datetime_to_ISO8601(internaltip.identity_provided_date),
        'show_receivers': context.show_receivers
    }
开发者ID:br1n0,项目名称:GlobaLeaks,代码行数:28,代码来源:submission.py

示例5: get_receiver_list_wb

# 需要导入模块: from globaleaks.utils.structures import Rosetta [as 别名]
# 或者: from globaleaks.utils.structures.Rosetta import acquire_storm_object [as 别名]
def get_receiver_list_wb(store, wb_tip_id, language):
    """
    @return:
        This function contain the serialization of the receiver, this function is
        used only by /wbtip/receivers API

        The returned struct contain information on read/unread messages
    """
    receiver_list = []

    wb_tip = store.find(WhistleblowerTip,
                        WhistleblowerTip.id == unicode(wb_tip_id)).one()

    if not wb_tip:
        raise errors.TipReceiptNotFound

    for rtip in wb_tip.internaltip.receivertips:
        message_counter = store.find(Message,
                                     Message.receivertip_id == rtip.id).count()

        receiver_desc = {
            "name": rtip.receiver.name,
            "id": rtip.receiver.id,
            "pgp_key_status": rtip.receiver.pgp_key_status,
            "access_counter": rtip.access_counter,
            "message_counter": message_counter,
            "creation_date": datetime_to_ISO8601(datetime_now()),
        }

        mo = Rosetta(rtip.receiver.localized_strings)
        mo.acquire_storm_object(rtip.receiver)
        receiver_desc["description"] = mo.dump_localized_key("description", language)
        receiver_list.append(receiver_desc)

    return receiver_list
开发者ID:nsfw,项目名称:GlobaLeaks,代码行数:37,代码来源:wbtip.py

示例6: receiver_serialize_internal_tip

# 需要导入模块: from globaleaks.utils.structures import Rosetta [as 别名]
# 或者: from globaleaks.utils.structures.Rosetta import acquire_storm_object [as 别名]
def receiver_serialize_internal_tip(internaltip, language=GLSetting.memory_copy.default_language):

    itip_dict = {
        'context_id': internaltip.context.id,
        'creation_date' : datetime_to_ISO8601(internaltip.creation_date),
        'expiration_date' : datetime_to_ISO8601(internaltip.expiration_date),
        'download_limit' : internaltip.download_limit,
        'access_limit' : internaltip.access_limit,
        'mark' : internaltip.mark,
        'pertinence' : internaltip.pertinence_counter,
        'escalation_threshold' : internaltip.escalation_threshold,
        'fields' : internaltip.wb_fields,

        # these two fields are at the moment unsent by the client, but kept
        # maintained in unitTest. (tickets in wishlist)
        'is_pertinent' : False,
        'global_delete' : False,
        # this field "inform" the receiver of the new expiration date that can
        # be set, only if PUT with extend = True is updated
        'potential_expiration_date' : \
            datetime_to_ISO8601(utc_future_date(seconds=internaltip.context.tip_timetolive)),
        'extend' : False,
        'enable_private_messages': internaltip.context.enable_private_messages
    }

    # context_name and context_description are localized field
    mo = Rosetta()
    mo.acquire_storm_object(internaltip.context)
    for attr in ['name', 'description' ]:
        key = "context_%s" % attr
        itip_dict[key] = mo.dump_translated(attr, language)

    return itip_dict
开发者ID:globaleaks,项目名称:GLBackend-outdated,代码行数:35,代码来源:rtip.py

示例7: receiver_serialize_receiver

# 需要导入模块: from globaleaks.utils.structures import Rosetta [as 别名]
# 或者: from globaleaks.utils.structures.Rosetta import acquire_storm_object [as 别名]
def receiver_serialize_receiver(receiver, language=GLSetting.memory_copy.default_language):
    receiver_dict = {
        "receiver_gus": receiver.id,
        "name": receiver.name,
        "update_date": pretty_date_time(receiver.last_update),
        "creation_date": pretty_date_time(receiver.creation_date),
        "receiver_level": receiver.receiver_level,
        "can_delete_submission": receiver.can_delete_submission,
        "username": receiver.user.username,
        "gpg_key_info": receiver.gpg_key_info,
        "gpg_key_fingerprint": receiver.gpg_key_fingerprint,
        "gpg_key_remove": False,
        "gpg_key_armor": receiver.gpg_key_armor,
        "gpg_key_status": receiver.gpg_key_status,
        "gpg_enable_notification": receiver.gpg_enable_notification,
        "gpg_enable_files": receiver.gpg_enable_files,
        "tags": receiver.tags,
        "tip_notification" : receiver.tip_notification,
        "file_notification" : receiver.file_notification,
        "comment_notification" : receiver.comment_notification,
        "notification_fields": dict(receiver.notification_fields),
        "failed_login": receiver.user.failed_login_count,
        "contexts": []
    }

    mo = Rosetta()
    mo.acquire_storm_object(receiver)
    receiver_dict["description"] = mo.dump_translated('description', language)

    for context in receiver.contexts:
        receiver_dict['contexts'].append(context.id)

    return receiver_dict
开发者ID:rowanthorpe,项目名称:GLBackend,代码行数:35,代码来源:receiver.py

示例8: anon_serialize_receiver

# 需要导入模块: from globaleaks.utils.structures import Rosetta [as 别名]
# 或者: from globaleaks.utils.structures.Rosetta import acquire_storm_object [as 别名]
def anon_serialize_receiver(receiver, language=GLSetting.memory_copy.default_language):
    """
    @param receiver: a valid Storm object
    @return: a dict describing the receivers available in the node
        (e.g. checks if almost one context is associated, or, in
         node where GPG encryption is enforced, that a valid key is registered)
    """
    mo = Rosetta()
    mo.acquire_storm_object(receiver)

    receiver_dict = {
        "creation_date": datetime_to_ISO8601(receiver.creation_date),
        "update_date": datetime_to_ISO8601(receiver.last_update),
        "name": receiver.name,
        "description": mo.dump_translated('description', language),
        "id": receiver.id,
        "receiver_level": receiver.receiver_level,
        "tags": receiver.tags,
        "presentation_order": receiver.presentation_order,
        "gpg_key_status": receiver.gpg_key_status,
                    # list is needed because .values returns a generator
        "contexts": list(receiver.contexts.values(models.Context.id))
    }

    if not len(receiver_dict['contexts']):
        return None

    return receiver_dict
开发者ID:globaleaks,项目名称:GLBackend-outdated,代码行数:30,代码来源:node.py

示例9: anon_serialize_ahmia

# 需要导入模块: from globaleaks.utils.structures import Rosetta [as 别名]
# 或者: from globaleaks.utils.structures.Rosetta import acquire_storm_object [as 别名]
def anon_serialize_ahmia(store, language=GLSetting.memory_copy.default_language):
    """
    Request reaches only if ahmia is enabled
    """
    node = store.find(models.Node).one()

    mo = Rosetta()
    mo.acquire_storm_object(node)

    ahmia_description = {
        "title": node.name,
        "description": mo.dump_translated('description', language),

        # TODO support tags/keyword in Node.
        "keywords": "%s (GlobaLeaks instance)" % node.name,
        "relation": node.public_site,

        # TODO ask Ahmia to support a list of languages
        "language": node.default_language,

        # TODO say to the admin that its email will be public
        "contactInformation": u'',
        "type": "GlobaLeaks"
    }

    return ahmia_description
开发者ID:globaleaks,项目名称:GLBackend-outdated,代码行数:28,代码来源:node.py

示例10: get_receivertip_list

# 需要导入模块: from globaleaks.utils.structures import Rosetta [as 别名]
# 或者: from globaleaks.utils.structures.Rosetta import acquire_storm_object [as 别名]
def get_receivertip_list(store, receiver_id, language):
    rtip_summary_list = []

    for rtip in store.find(ReceiverTip, ReceiverTip.receiver_id == receiver_id):
        mo = Rosetta(rtip.internaltip.context.localized_keys)
        mo.acquire_storm_object(rtip.internaltip.context)

        rtip_summary_list.append(
            {
                "id": rtip.id,
                "creation_date": datetime_to_ISO8601(rtip.internaltip.creation_date),
                "last_access": datetime_to_ISO8601(rtip.last_access),
                "update_date": datetime_to_ISO8601(rtip.internaltip.update_date),
                "expiration_date": datetime_to_ISO8601(rtip.internaltip.expiration_date),
                "timetolive": rtip.internaltip.context.tip_timetolive,
                "progressive": rtip.internaltip.progressive,
                "new": rtip.access_counter == 0 or rtip.last_access < rtip.internaltip.update_date,
                "context_name": mo.dump_localized_key("name", language),
                "access_counter": rtip.access_counter,
                "file_counter": rtip.internaltip.internalfiles.count(),
                "comment_counter": rtip.internaltip.comments.count(),
                "message_counter": rtip.messages.count(),
                "tor2web": rtip.internaltip.tor2web,
                "questionnaire_hash": rtip.internaltip.questionnaire_hash,
                "preview_schema": db_get_archived_preview_schema(store, rtip.internaltip.questionnaire_hash, language),
                "preview": rtip.internaltip.preview,
                "total_score": rtip.internaltip.total_score,
                "label": rtip.label,
            }
        )

    return rtip_summary_list
开发者ID:globaleaks,项目名称:GlobaLeaks,代码行数:34,代码来源:receiver.py

示例11: receiver_serialize_receiver

# 需要导入模块: from globaleaks.utils.structures import Rosetta [as 别名]
# 或者: from globaleaks.utils.structures.Rosetta import acquire_storm_object [as 别名]
def receiver_serialize_receiver(receiver, language=GLSetting.memory_copy.default_language):
    receiver_dict = {
        "id": receiver.id,
        "name": receiver.name,
        "update_date": datetime_to_ISO8601(receiver.last_update),
        "creation_date": datetime_to_ISO8601(receiver.creation_date),
        "receiver_level": receiver.receiver_level,
        "can_delete_submission": receiver.can_delete_submission,
        "username": receiver.user.username,
        "gpg_key_info": receiver.gpg_key_info,
        "gpg_key_fingerprint": receiver.gpg_key_fingerprint,
        "gpg_key_remove": False,
        "gpg_key_armor": receiver.gpg_key_armor,
        "gpg_key_status": receiver.gpg_key_status,
        "gpg_enable_notification": receiver.gpg_enable_notification,
        "tags": receiver.tags,
        "tip_notification" : receiver.tip_notification,
        "file_notification" : receiver.file_notification,
        "comment_notification" : receiver.comment_notification,
        "message_notification" : receiver.message_notification,
        "mail_address": receiver.mail_address,
                    # list is needed because .values returns a generator
        "contexts": list(receiver.contexts.values(Context.id)),
        "password": u'',
        "old_password": u'',
    }

    mo = Rosetta()
    mo.acquire_storm_object(receiver)
    receiver_dict["description"] = mo.dump_translated('description', language)

    for context in receiver.contexts:
        receiver_dict['contexts'].append(context.id)

    return receiver_dict
开发者ID:Acidburn0zzz,项目名称:GLBackend,代码行数:37,代码来源:receiver.py

示例12: collect_tip_overview

# 需要导入模块: from globaleaks.utils.structures import Rosetta [as 别名]
# 或者: from globaleaks.utils.structures.Rosetta import acquire_storm_object [as 别名]
def collect_tip_overview(store, language):
    tip_description_list = []

    all_itips = store.find(models.InternalTip)
    for itip in all_itips:
        tip_description = {
            'id': itip.id,
            'creation_date': datetime_to_ISO8601(itip.creation_date),
            'creation_lifetime': datetime_to_ISO8601(itip.creation_date),
            'expiration_date': datetime_to_ISO8601(itip.expiration_date),
            'context_id': itip.context_id,
            'receivertips': [],
            'internalfiles': [],
            'comments': [],
            'wb_access_counter': 0,
            'wb_last_access': u'Never'
        }

        mo = Rosetta(itip.context.localized_strings)
        mo.acquire_storm_object(itip.context)
        tip_description['context_name'] = mo.dump_localized_attr('name', language)

        for rtip in itip.receivertips:
            tip_description['receivertips'].append({
                'access_counter': rtip.access_counter,
                'notification_date': datetime_to_ISO8601(rtip.notification_date),
                # 'creation_date': datetime_to_ISO8601(rtip.creation_date),
                'receiver_id': rtip.receiver.id,
                'receiver_username': rtip.receiver.user.username,
                'receiver_name': rtip.receiver.name,
                # last_access censored willingly
            })

        for ifile in itip.internalfiles:
            tip_description['internalfiles'].append({
                'name': ifile.name,
                'size': ifile.size,
                'content_type': ifile.content_type
            })

        for comment in itip.comments:
            tip_description['comments'].append({
                'type': comment.type,
                'lifetime': datetime_to_ISO8601(comment.creation_date),
            })

        # whistleblower tip has not a reference from itip, then:
        wbtip = store.find(models.WhistleblowerTip,
                           models.WhistleblowerTip.internaltip_id == itip.id).one()

        if wbtip is not None:
            tip_description.update({
                'wb_access_counter': wbtip.access_counter,
                'wb_last_access': datetime_to_ISO8601(wbtip.last_access)
            })

        tip_description_list.append(tip_description)

    return tip_description_list
开发者ID:RuanAragao,项目名称:GlobaLeaks,代码行数:61,代码来源:overview.py

示例13: anon_serialize_node

# 需要导入模块: from globaleaks.utils.structures import Rosetta [as 别名]
# 或者: from globaleaks.utils.structures.Rosetta import acquire_storm_object [as 别名]
def anon_serialize_node(store, language=GLSetting.memory_copy.default_language):
    node = store.find(models.Node).one()

    # Contexts and Receivers relationship
    associated = store.find(models.ReceiverContext).count()

    custom_homepage = False

    try: 
        custom_homepage = os.path.isfile(os.path.join(GLSetting.static_path, "custom_homepage.html"))
    except:
        pass

    node_dict = {
      'name': node.name,
      'hidden_service': node.hidden_service,
      'public_site': node.public_site,
      'email': node.email,
      'languages_enabled': node.languages_enabled,
      'languages_supported': LANGUAGES_SUPPORTED,
      'default_language' : node.default_language,
      # extended settings info:
      'maximum_namesize': node.maximum_namesize,
      'maximum_textsize': node.maximum_textsize,
      'maximum_filesize': node.maximum_filesize,
      # public serialization use GLSetting memory var, and
      # not the real one, because needs to bypass
      # Tor2Web unsafe deny default settings
      'tor2web_admin': GLSetting.memory_copy.tor2web_admin,
      'tor2web_submission': GLSetting.memory_copy.tor2web_submission,
      'tor2web_receiver': GLSetting.memory_copy.tor2web_receiver,
      'tor2web_unauth': GLSetting.memory_copy.tor2web_unauth,
      'ahmia': node.ahmia,
      'postpone_superpower': node.postpone_superpower,
      'can_delete_submission': node.can_delete_submission,
      'wizard_done': node.wizard_done,
      'anomaly_checks': node.anomaly_checks,
      'allow_unencrypted': node.allow_unencrypted,
      'x_frame_options_mode': node.x_frame_options_mode,
      'x_frame_options_allow_from': node.x_frame_options_allow_from,
      'receipt_regexp': node.receipt_regexp,
      'configured': True if associated else False,
      'password': u"",
      'old_password': u"",
      'custom_homepage': custom_homepage,
      'disable_privacy_badge': node.disable_privacy_badge,
      'disable_security_awareness_badge': node.disable_security_awareness_badge,
      'disable_security_awareness_questions': node.disable_security_awareness_questions
    }

    mo = Rosetta()
    mo.acquire_storm_object(node)
    for attr in mo.get_localized_attrs():
        node_dict[attr] = mo.dump_translated(attr, language)

    return node_dict
开发者ID:globaleaks,项目名称:GLBackend-outdated,代码行数:58,代码来源:node.py

示例14: get_receivertip_list

# 需要导入模块: from globaleaks.utils.structures import Rosetta [as 别名]
# 或者: from globaleaks.utils.structures.Rosetta import acquire_storm_object [as 别名]
def get_receivertip_list(store, receiver_id, language):
    rtiplist = store.find(ReceiverTip, ReceiverTip.receiver_id == receiver_id)
    rtiplist.order_by(Desc(ReceiverTip.creation_date))

    node = store.find(Node).one()

    rtip_summary_list = []

    for rtip in rtiplist:

        can_postpone_expiration = (node.can_postpone_expiration or
                                   rtip.internaltip.context.can_postpone_expiration or
                                   rtip.receiver.can_postpone_expiration)

        can_delete_submission = (node.can_delete_submission or
                                 rtip.internaltip.context.can_delete_submission or
                                 rtip.receiver.can_delete_submission)

        rfiles_n = store.find(ReceiverFile,
                              (ReceiverFile.internaltip_id == rtip.internaltip.id,
                               ReceiverFile.receiver_id == receiver_id)).count()

        message_counter = store.find(Message,
                                     Message.receivertip_id == rtip.id).count()

        single_tip_sum = dict({
            'id': rtip.id,
            'creation_date': datetime_to_ISO8601(rtip.creation_date),
            'last_access': datetime_to_ISO8601(rtip.last_access),
            'expiration_date': datetime_to_ISO8601(rtip.internaltip.expiration_date),
            'access_counter': rtip.access_counter,
            'file_counter': rfiles_n,
            'comment_counter': rtip.internaltip.comments.count(),
            'message_counter': message_counter,
            'can_postpone_expiration': can_postpone_expiration,
            'can_delete_submission': can_delete_submission,
        })

        mo = Rosetta(rtip.internaltip.context.localized_strings)
        mo.acquire_storm_object(rtip.internaltip.context)
        single_tip_sum["context_name"] = mo.dump_localized_attr('name', language)

        preview_data = []

        for s in rtip.internaltip.wb_steps:
            for f in s['children']:
                if f['preview']:
                    preview_data.append(f)

        single_tip_sum.update({'preview': preview_data})
        rtip_summary_list.append(single_tip_sum)

    return rtip_summary_list
开发者ID:RuanAragao,项目名称:GlobaLeaks,代码行数:55,代码来源:receiver.py

示例15: collect_tip_overview

# 需要导入模块: from globaleaks.utils.structures import Rosetta [as 别名]
# 或者: from globaleaks.utils.structures.Rosetta import acquire_storm_object [as 别名]
def collect_tip_overview(store, language):
    tip_description_list = []

    all_itips = store.find(models.InternalTip)
    for itip in all_itips:
        tip_description = {
            'id': itip.id,
            'creation_date': datetime_to_ISO8601(itip.creation_date),
            'expiration_date': datetime_to_ISO8601(itip.expiration_date),
            'context_id': itip.context_id
        }

        mo = Rosetta(itip.context.localized_keys)
        mo.acquire_storm_object(itip.context)
        tip_description['context_name'] = mo.dump_localized_key('name', language)

        tip_description_list.append(tip_description)

    return tip_description_list
开发者ID:Taipo,项目名称:GlobaLeaks,代码行数:21,代码来源:overview.py


注:本文中的globaleaks.utils.structures.Rosetta.acquire_storm_object方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。