def __call__(self): ''' View that call migrate method with dry_run mode set. Returns a json response with the result. This view is called by a js. ''' response = {} error_msg = _(u'Migrating to this content type is impossible with ' u'this configuration') try: results = self.migrate(dry_run=True) except Exception as e: trace = traceback.format_exc() msg = 'Test-Migration failed: {0}\n{1}\n'.format(e, trace) logger.error(msg) response['status'] = 'error' response['message'] = msg return json.dumps(response) migration_result = results[0] res_infos = migration_result.get('infos') if res_infos.get('errors'): response['status'] = 'error' response['message'] = error_msg else: response['status'] = 'success' response['message'] = 'Testing migration succesful' self.request.response.setHeader('Content-type', 'application/json') return json.dumps(response)
def get_terms(context, counter, ext_dict, show_extended): results = [] for k, v in counter.iteritems(): if not show_extended: if k not in ext_dict: display = u"{0} ({1})".format(context.translate(_(k)), v) term = SimpleVocabulary.createTerm(k, k, display) results.append(term) else: if k in ext_dict: ext = str(ext_dict[k]['fields']).\ replace("[", "").replace("]", "") display = u"{0} ({1}) - extended fields: {2}".\ format(context.translate(_(k)), v, ext) term = SimpleVocabulary.createTerm(k, k, display) results.append(term) results.sort(key=lambda x: x.title) return results
def get_terms(context, counter, ext_dict, show_extended): """Takes dicts of types and their numbers and their extended fields Returns a list of SimpleVocabularyTerms: value = meta_type, token = meta_type, title = translated_meta_type (number_of_instances) - extended fields: list """ results = [] for k, v in counter.iteritems(): if not show_extended: if k not in ext_dict: display = u'{0} ({1})'.format(context.translate(_(k)), v) term = SimpleVocabulary.createTerm(k, k, display) results.append(term) else: if k in ext_dict: ext = str(ext_dict[k]['fields']).\ replace('[', '').replace(']', '') display = u'{0} ({1}) - extended fields: {2}'.\ format(context.translate(_(k)), v, ext) term = SimpleVocabulary.createTerm(k, k, display) results.append(term) results.sort(key=lambda x: x.title) return results
def __call__(self): ''' View that call migrate method with dry_run mode set. Returns a json response with the result. This view is called by a js. ''' response = {} error_msg = _(u'Migrating to this content type is impossible with ' u'this configuration') try: results = self.migrate(dry_run=True) except Exception, e: trace = traceback.format_exc() msg = "Test-Migration failed: %s\n%s\n" % (e, trace) logger.error(msg) response['status'] = 'error' response['message'] = msg return json.dumps(response)
def no_items_message(self): return _( 'description_no_items_in_folder', default=u'There are currently no items in this folder.' )
def no_items_message(self): return _( 'description_no_results_found', default=u"No results were found." )
def no_items_message(self): return _('description_no_items_in_folder', default=u'There are currently no items in this folder.')
def viewTitle(self): viewTitle = _(u'Search') return viewTitle
def no_items_message(self): return _('description_no_results_found', default=u'No results were found.')
class ICollection(model.Schema): query = schema.List( title=_(u'Search terms'), description=_(u"Define the search terms for the items you want " u"to list by choosing what to match on. " u"The list of results will be dynamically updated"), value_type=schema.Dict(value_type=schema.Field(), key_type=schema.TextLine()), required=False, missing_value='') form.widget('query', QueryStringFieldWidget) sort_on = schema.TextLine( title=_(u'label_sort_on', default=u'Sort on'), description=_(u"Sort the collection on this index"), required=False, ) sort_reversed = schema.Bool( title=_(u'label_sort_reversed', default=u'Reversed order'), description=_(u'Sort the results in reversed order'), required=False, ) limit = schema.Int( title=_(u'Limit'), description=_(u'Limit Search Results'), required=False, default=1000, ) item_count = schema.Int( title=_(u'label_item_count', default=u'Item count'), description=_(u'Number of items that will show up in one batch.'), required=False, default=30, ) customViewFields = schema.List( title=_(u'Table Columns'), description=_(u"Select which fields to display when " u"'Tabular view' is selected in the display menu."), default=['Title', 'Creator', 'Type', 'ModificationDate'], value_type=schema.Choice( vocabulary='plone.app.contenttypes.metadatafields'), required=False, )
class IThumbIconHandling(model.Schema): model.fieldset('settings', label=_(u'Settings'), fields=[ 'thumb_scale_list', 'thumb_scale_table', 'thumb_scale_summary', 'suppress_icons', 'suppress_thumbs' ]) thumb_scale_list = schema.TextLine( title=_(u'Override thumb scale for list view'), description=_( u"Enter a valid scale name" u" (see 'Image Handling' control panel) to override" u" (e.g. icon, tile, thumb, mini, preview, ... )." u" Leave empty to use default (see 'Site' control panel)."), required=False, default=u'') thumb_scale_table = schema.TextLine( title=_(u'Override thumb scale for table view'), description=_( u"Enter a valid scale name" u" (see 'Image Handling' control panel) to override" u" (e.g. icon, tile, thumb, mini, preview, ... )." u" Leave empty to use default (see 'Site' control panel)."), required=False, default=u'') thumb_scale_summary = schema.TextLine( title=_(u'Override thumb scale for summary view'), description=_( u"Enter a valid scale name" u" (see 'Image Handling' control panel) to override" u" (e.g. icon, tile, thumb, mini, preview, ... )." u" Leave empty to use default (see 'Site' control panel)."), required=False, default=u'') suppress_icons = schema.Bool( title=_(u'Suppress icons in list, table or summary view'), description=_(u''), required=False, default=False, ) suppress_thumbs = schema.Bool( title=_(u'Suppress thumbs in list, table or summary view'), required=False, default=False, ) directives.omitted('thumb_scale_list', 'thumb_scale_table', 'thumb_scale_summary', 'suppress_icons', 'suppress_thumbs') directives.no_omit(IEditForm, 'thumb_scale_list', 'thumb_scale_table', 'thumb_scale_summary', 'suppress_icons', 'suppress_thumbs') directives.no_omit(IAddForm, 'thumb_scale_list', 'thumb_scale_table', 'thumb_scale_summary', 'suppress_icons', 'suppress_thumbs')