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
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
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'])
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'))
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
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()
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()
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'))
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)
def on_create(self, docs): for doc in docs: update_dates_for(doc) doc['original_creator'] = get_user()
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"))