コード例 #1
0
    def _set_metadata(self, doc):
        """
        Adds metadata to doc.
        """

        update_dates_for(doc)
        generate_unique_id_and_name(doc)
        doc['guid'] = generate_guid(type=GUID_TAG)
        doc.setdefault(config.ID_FIELD, doc['guid'])
        doc[config.VERSION] = 1
        set_item_expiry({}, doc)

        if not doc.get('_import', None):
            set_original_creator(doc)

        doc.setdefault(ITEM_STATE, CONTENT_STATE.DRAFT)

        if not doc.get('ingest_provider'):
            doc['source'] = app.config.get('DEFAULT_SOURCE_VALUE_FOR_MANUAL_ARTICLES')

        copy_metadata_from_user_preferences(doc)
コード例 #2
0
    def _set_metadata(self, doc):
        """
        Adds metadata to doc.
        """

        update_dates_for(doc)
        generate_unique_id_and_name(doc)
        doc["guid"] = generate_guid(type=GUID_TAG)
        doc.setdefault(config.ID_FIELD, doc["guid"])
        doc[config.VERSION] = 1
        set_item_expiry({}, doc)

        if not doc.get("_import", None):
            set_original_creator(doc)

        doc.setdefault(ITEM_STATE, CONTENT_STATE.DRAFT)

        if not doc.get("ingest_provider"):
            doc["source"] = app.config.get("DEFAULT_SOURCE_VALUE_FOR_MANUAL_ARTICLES")

        copy_metadata_from_user_preferences(doc)