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()))
def get_rich_text(data): url = BASE_URL + '/3/short' for key, default in OPTIONS.items(): if key in data.get('formatting', []): url += '/%s' % key return urllib.urlopen(url).read().decode('utf-8')
def get_rich_text(self): url = BASE_URL + '/3/short' for key, default in OPTIONS.items(): if self.request.get(key, default): url += '/%s' % key return urllib.urlopen(url).read().decode('utf-8')