def create(self, action): data, errors = self.extractData() if errors: self.status = '\n'.join([error.error.__str__() for error in errors]) return context = aq_inner(self.context) total = create_subobjects(context, context, data, 0) addStatusMessage( self.request, 'Successfully created %d dummy objects.' % total, type='info') self.request.response.redirect(self.context.REQUEST.get('URL'))
def create(self, action): data, errors = self.extractData() if errors: self.status = '\n'.join([ error.error.__str__() for error in errors]) return context = aq_inner(self.context) total = create_subobjects(context, context, data, 0) addStatusMessage( self.request, _(u'Successfully created %d dummy objects.') % total, type='info') self.request.response.redirect(self.context.REQUEST.get('URL'))
def __call__(self, **kw): """ type: string - The portal_type of the content type to create amount: integer - The amount of objects to create ul: bool - Add unordered lists. ol: bool - Add numbered lists. dl: bool - Add description lists. bq: bool - Add blockquotes. code: bool - Add code samples. link: bool - Add links. prude: bool - Prude version. headers: bool - Add headers. allcaps: bool - Use ALL CAPS. decorate: bool - Add bold, italic and marked text. publish: bool - Should the objects be published recurse: bool - Should objects be created recursively? parnum: integer - The number of paragraphs to generate. (NOT USED) length: short, medium, long, verylong - The average length of a paragraph (NOT USED) """ request = self.request context = aq_inner(self.context) types = self.request.get('type') if isinstance(types, str): types = [types] # There are some formatting options that we want enabled by default. If # the user didn't specify them in the URL, we add them here. for key, default in OPTIONS.items(): if not request.has_key(key): request.set(key, default) total = create_subobjects(context, request, 0, types) addStatusMessage(request, _('%d objects successfully created' % total)) return request.RESPONSE.redirect('/'.join(context.getPhysicalPath()))