Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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'])
Exemplo n.º 4
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'))
         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'))
Exemplo n.º 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
Exemplo n.º 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()
Exemplo n.º 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()
Exemplo n.º 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'))
Exemplo n.º 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)
Exemplo n.º 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'))
Exemplo n.º 11
0
 def on_create(self, docs):
     for doc in docs:
         update_dates_for(doc)
         doc['original_creator'] = get_user()
Exemplo n.º 12
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"))