def _update(self): """ Update """ updates = self._list_updates() for update in updates: data = update.get_data('Original') update.update_data(data) logger.debug('Fix photo %s: Original => %s', update.absolute_url(1), update.getId())
def _verify_doc(self, doc): """ Check for ZODB storage """ # Skip SEMIDE sitea as they have a different product for PhotoArchive if getattr(doc, '_old_id', None): return doc logger.debug('%-23s %s', 'Skip NyPhotoFolder', doc.absolute_url(1)) return None
def _update(self): updates = self._list_updates() for update in updates: update.submitted = 1 update.approved = 1 logger.debug('%-70s [UPDATED]', update.absolute_url(1)) for photo in update.objectValues('Naaya Photo'): self._update_photo(photo) logger.debug('%-70s [UPDATED]', photo.absolute_url(1))
def _update(self): """ Update """ updates = self._list_updates() for update in updates: parent = update.getParentNode() update_id = update.getId() update_new_id = update._old_id parent.manage_renameObject(update_id, update_new_id) logger.debug('Rename album in folder %s: %s => %s', parent.absolute_url(1), update_id, update_new_id) delattr(update, '_old_id')
def _update(self): """ Update """ updates = self._list_updates() for update in updates: update_id = update.getId() parent = update.getParentNode() parent.manage_renameObject(update_id, update_id + '.OLD') update = parent._getOb(update_id + '.OLD') folder_id = self._update_photo_folder(update, update_id) folder = parent._getOb(folder_id) logger.debug('Copy NaayaPhotoFolder %s => %s', update.absolute_url(1), folder.absolute_url(1)) for photo in update.objectValues('Naaya Photo'): self._update_photo(photo, folder) logger.debug('Delete old NaayaPhotoFolder %s', update.absolute_url(1)) parent.manage_delObjects([update.getId()])
def list_portal_objects(portal): from Products.naayaUpdater.updates import nyUpdateLogger as logger overview = {} query = {} brains = portal.getCatalogTool()(query) for brain in brains: try: ob = brain.getObject() except Exception, err: logger.debug( 'WARNING: brain: %s, brain id: %s, getPath: %s, err: %s', brain.absolute_url(), brain.data_record_id_, brain.getPath(), err) continue if ob is None: logger.debug('WARNING: Broken brain: %s, id %s, getPath: %s', brain.absolute_url(), brain.data_record_id_, brain.getPath()) continue langs = str(getattr(ob, '_languages', '[no translations]')) try: ob_info = { 'short_title': maxlen(ob.title_or_id(), 50), 'the_ob': ob, 'languages': langs, } except: # sometimes the wrong things get cataloged (e.g. methods) logger.debug('WARNING: Object is not a valid content type: %s' % ob) continue if langs not in overview: overview[langs] = [] overview[langs].append(ob_info)
def list_portal_objects(portal): from Products.naayaUpdater.updates import nyUpdateLogger as logger overview = {} query = {} brains = portal.getCatalogTool()(query) for brain in brains: try: ob = brain.getObject() except Exception, err: logger.debug( 'WARNING: brain: %s, brain id: %s, getPath: %s, err: %s', brain.absolute_url(), brain.data_record_id_, brain.getPath(), err) continue if ob is None: logger.debug( 'WARNING: Broken brain: %s, id %s, getPath: %s', brain.absolute_url(), brain.data_record_id_, brain.getPath()) continue langs = str(getattr(ob, '_languages', '[no translations]')) try: ob_info = { 'short_title': maxlen(ob.title_or_id(), 50), 'the_ob': ob, 'languages': langs, } except: # sometimes the wrong things get cataloged (e.g. methods) logger.debug( 'WARNING: Object is not a valid content type: %s' % ob) continue if langs not in overview: overview[langs] = [] overview[langs].append(ob_info)
def _verify_doc(self, doc): """ Check for ZODB storage """ # Skip SEMIDE sitea as they have a different product for PhotoArchive if doc.getSite().meta_type == "SEMIDE Site": logger.debug('%-23s %s', 'Skip NyPhotoFolder', doc.absolute_url(1)) return None if getattr(doc, '_old_id', None): logger.debug('%-23s %s', 'Skip NyPhotoFolder', doc.absolute_url(1)) return None children = doc.objectValues('Naaya Photo') # Handle empty photo folders if not children: return doc # Handle old images in photo folders for child in doc.objectValues('Naaya Photo'): if getattr(child, 'data', ''): return doc logger.debug('%-23s %s', 'Skip NyPhotoFolder', doc.absolute_url(1)) return None
def _update(self): updates = self._list_updates() for update in updates: logger.debug('%-15s %s', 'Update Survey', update.absolute_url()) setattr(update, 'allow_overtime', 0)
def _verify_doc(self, doc): # Verify ZODB storage if not hasattr(doc, 'allow_overtime'): return doc logger.debug('%-15s %s', 'Skip Survey', doc.absolute_url()) return None
def _update(self): for update in self._list_updates(): update.manage_configureSite() logger.debug('Updated %s' % (update.absolute_url(1), ))
def _verify_doc(self, doc): if not hasattr(doc, 'modification_time'): return doc logger.debug('Skipping %s' % (doc.absolute_url(1), )) return None
def _update(self): for update in self._list_updates(): update.manage_configureSite() logger.debug("Updated %s" % (update.absolute_url(1),))
def _update(self): """ Update """ updates = self._list_updates() for update in updates: logger.debug('Generate album display for image: %s', update.absolute_url(1)) update._getDisplay('Album')
def _update(self): updates = self._list_updates() for update in updates: logger.debug('Added survey tool to %s' % (update.absolute_url(1), )) manage_addSurveyTool(update)
def _update(self): updates = self._list_updates() for update in updates: logger.debug('Added survey tool to %s' % (update.absolute_url(1),)) manage_addSurveyTool(update)
def _update(self): for answer in self._list_updates(): answer.modification_time = answer.bobobase_modification_time() logger.debug('Updated %s' % (answer.absolute_url(1), ))