_check_conf = ( ('morias', 'db', Sql), # database configuration ('attachments', 'path', str), ('attachments', 'thumb_path', str, ''), ('attachments', 'thumb_size', Size, '320x200', True) ) R_ADMIN = 'attachments_modify' module_rights = ['attachments_author', 'attachments_listall', R_ADMIN] rights.update(module_rights) system_menu.append(Item('/admin/attachments', label="Attachments", symbol='attachments', rights=module_rights)) app.set_filter('attachment', r'[\w\.]+', uni) time_format = "%a, %d %b %Y %X GMT" # TODO: core.test.sql.count (table) # .data () # none, number, float, string, unicode # .sqlinjection () # .dirs ((dir, dir)) def js_items(req, **kwargs): # size of thumb could be set from request thumb_size = req.args.getfirst('thumb_size', '320x200', str) pager = Pager(limit=-1) items = [] for item in Attachment.list(req, pager, **kwargs): item.webname = item.webname()
from morias.lib.pager import Pager from morias.lib.articles import Article, FORMAT_RST, ArticleComment from morias.lib.rst import check_rst, rst2html from morias.user import user_sections from morias.admin import content_menu from morias.codebooks import build_class _check_conf = ( # morias common block ('morias', 'db', Sql), ('articles', 'in_menu', bool, True), ('articles', 'is_root', bool, False) ) app.set_filter('tag', r'[\w\ \&\.]+', uni) def _call_conf(cfg, parser): if cfg.articles_in_menu: user_sections.append(Item('/articles', label="Articles")) if cfg.articles_is_root: app.set_route('/', articles_list_full) right_editor = 'articles_editor' right_author = 'articles_author' module_rights = (right_editor, right_author) rights.update(module_rights) content_menu.append(Item('/admin/articles', label="Articles", symbol="articles", rights=module_rights))