示例#1
0
 def on_create(self, docs):
     for doc in docs:
         update_dates_for(doc)
         doc["original_creator"] = str(get_user().get("_id"))
         # set the blog_preferences by merging given preferences with global_prefs
         global_prefs = get_resource_service("global_preferences").get_global_prefs()
         prefs = global_prefs.copy()
         prefs.update(doc.get("blog_preferences", {}))
         doc["blog_preferences"] = prefs
示例#2
0
 def on_create(self, docs):
     for doc in docs:
         update_dates_for(doc)
         doc['original_creator'] = str(get_user().get('_id'))
         # set the blog_preferences by merging given preferences with global_prefs
         global_prefs = get_resource_service(
             'global_preferences').get_global_prefs()
         prefs = global_prefs.copy()
         prefs.update(doc.get('blog_preferences', {}))
         doc['blog_preferences'] = prefs
示例#3
0
 def on_create(self, docs):
     for doc in docs:
         update_dates_for(doc)
         doc['original_creator'] = str(get_user().get('_id'))
         doc['guid'] = generate_guid(type=GUID_TAG)
         # set the blog_preferences by merging given preferences with global_prefs
         global_prefs = get_resource_service('global_preferences').get_global_prefs()
         prefs = global_prefs.copy()
         prefs.update(doc.get('blog_preferences', {}))
         doc['blog_preferences'] = prefs
         # save a snapshot of the theme in the `theme` field
         if 'theme' in prefs:
             doc['theme'] = self.get_theme_snapshot(prefs['theme'])
示例#4
0
文件: items.py 项目: sfcaru/liveblog
 def on_create(self, docs):
     super().on_create(docs)
     for doc in docs:
         update_dates_for(doc)
         doc['original_creator'] = str(get_user().get('_id'))
         if doc.get('item_type'):
             if doc['item_type'] == 'embed':
                 metadata = doc['meta']
                 set_filemeta(doc, metadata)
                 if get_filemeta(doc, 'version'):
                     metadata['version'] = str(metadata.get('version'))
                 if get_filemeta(doc, 'width'):
                     metadata['width'] = str(metadata.get('width'))
                 if get_filemeta(doc, 'height'):
                     metadata['height'] = str(metadata.get('height'))
示例#5
0
 def on_create(self, docs):
     for doc in docs:
         update_dates_for(doc)
         doc['original_creator'] = str(get_user().get('_id'))
         # set the blog_preferences by merging given preferences with global_prefs
         global_prefs = get_resource_service('global_preferences').get_global_prefs()
         prefs = global_prefs.copy()
         prefs.update(doc.get('blog_preferences', {}))
         doc['blog_preferences'] = prefs
         # find the theme that is assigned to the blog
         my_theme = get_resource_service('themes').find_one(req=None, name=doc['blog_preferences']['theme'])
         # retrieve the default settings of the theme
         default_theme_settings = get_resource_service('themes').get_default_settings(my_theme)
         # save the theme settings on the blog level
         doc['theme_settings'] = default_theme_settings
示例#6
0
    def on_create(self, docs):
        self._check_max_active(len(docs))
        for doc in docs:
            update_dates_for(doc)
            doc['original_creator'] = str(get_user().get('_id'))
            # Set the blog_preferences by merging given preferences with global_prefs.
            global_prefs = get_resource_service('global_preferences').get_global_prefs()
            prefs = global_prefs.copy()
            prefs.update(doc.get('blog_preferences', {}))
            doc['blog_preferences'] = prefs
            # find the theme that is assigned to the blog
            theme_name = doc['blog_preferences'].get('theme')
            if theme_name:
                self._update_theme_settings(doc, theme_name)

            # If "start_date" is set to None, change the value to utcnow().
            if doc['start_date'] is None:
                doc['start_date'] = utcnow()
示例#7
0
    def on_create(self, docs):
        self._check_max_active(len(docs))
        for doc in docs:
            update_dates_for(doc)
            doc['original_creator'] = str(get_user().get('_id'))
            # set the blog_preferences by merging given preferences with global_prefs
            global_prefs = get_resource_service('global_preferences').get_global_prefs()
            prefs = global_prefs.copy()
            prefs.update(doc.get('blog_preferences', {}))
            doc['blog_preferences'] = prefs
            # find the theme that is assigned to the blog
            my_theme = get_resource_service('themes').find_one(req=None, name=doc['blog_preferences']['theme'])
            # retrieve the default settings of the theme
            default_theme_settings = get_resource_service('themes').get_default_settings(my_theme)
            # save the theme settings on the blog level
            doc['theme_settings'] = default_theme_settings

            # If "start_date" is set to None, change the value to utcnow().
            if doc['start_date'] is None:
                doc['start_date'] = utcnow()
示例#8
0
 def on_create(self, docs):
     super().on_create(docs)
     for doc in docs:
         update_dates_for(doc)
         doc['original_creator'] = str(get_user().get('_id'))
示例#9
0
 def on_create(self, docs):
     for doc in docs:
         update_dates_for(doc)
         doc['original_creator'] = str(get_user().get('_id'))
         doc['guid'] = generate_guid(type=GUID_TAG)
示例#10
0
 def on_create(self, docs):
     super().on_create(docs)
     for doc in docs:
         update_dates_for(doc)
         doc['original_creator'] = str(get_user().get('_id'))
示例#11
0
 def on_create(self, docs):
     for doc in docs:
         update_dates_for(doc)
         doc['original_creator'] = get_user()
示例#12
0
文件: items.py 项目: hlmnrmr/liveblog
 def on_create(self, docs):
     super().on_create(docs)
     for doc in docs:
         update_dates_for(doc)
         doc["original_creator"] = str(get_user().get("_id"))