def setup(): delegate.fakeload() from infogami.utils import types types.register_type('/i18n(/.*)?/strings.[^/]*', '/type/i18n') for site in db.get_all_sites(): load_strings(site)
def setup(): delegate.fakeload() load_all() from infogami.utils import types types.register_type('/templates/.*\.tmpl$', '/type/template') types.register_type('^/type/[^/]*$', '/type/type') types.register_type('/macros/.*$', '/type/macro')
def setup(): delegate.fakeload() load_all() from infogami.utils import types types.register_type(r'/templates/.*\.tmpl$', '/type/template') types.register_type('^/type/[^/]*$', '/type/type') types.register_type('/macros/.*$', '/type/macro')
def register_types(): """Register default types for various path patterns used in OL. """ from infogami.utils import types types.register_type('^/authors/[^/]*$', '/type/author') types.register_type('^/books/[^/]*$', '/type/edition') types.register_type('^/works/[^/]*$', '/type/work') types.register_type('^/languages/[^/]*$', '/type/language') types.register_type('^/usergroup/[^/]*$', '/type/usergroup') types.register_type('^/permission/[^/]*$', '/type/permission') types.register_type('^/(css|js)/[^/]*$', '/type/rawtext')
def register_types(): """Register default types for various path patterns used in OL. """ from infogami.utils import types types.register_type('^/authors/[^/]*$', '/type/author') types.register_type('^/books/[^/]*$', '/type/edition') types.register_type('^/works/[^/]*$', '/type/work') types.register_type('^/languages/[^/]*$', '/type/language') types.register_type('^/libraries/[^/]*$', '/type/library') types.register_type('^/usergroup/[^/]*$', '/type/usergroup') types.register_type('^/permission/[^/]*$', '/type/permission') types.register_type('^/(css|js)/[^/]*$', '/type/rawtext')
def setup(): """Setup for upstream plugin""" models.setup() utils.setup() addbook.setup() covers.setup() merge_authors.setup() import data data.setup() # Types for upstream paths types.register_type('^/authors/[^/]*$', '/type/author') types.register_type('^/books/[^/]*$', '/type/edition') types.register_type('^/languages/[^/]*$', '/type/language') types.register_type('^/subjects/places/[^/]*$', '/type/place') types.register_type('^/subjects/people/[^/]*$', '/type/person') types.register_type('^/subjects/[^/]*$', '/type/subject') # fix photo/cover url pattern ol_code.Author.photo_url_patten = "%s/photo" ol_code.Edition.cover_url_patten = "%s/cover" # setup template globals from openlibrary.i18n import ugettext, ungettext web.template.Template.globals.update({ "gettext": ugettext, "ugettext": ugettext, "_": ugettext, "ungettext": ungettext, "random": random.Random(), "commify": web.commify, "group": web.group, "storage": web.storage, "all": all, "any": any, "locals": locals }); import jsdef web.template.STATEMENT_NODES["jsdef"] = jsdef.JSDefNode setup_jquery_urls()
ol_infobase.init_plugin() try: from infogami.plugins.api import code as api except: api = None # http header extension for OL API infogami.config.http_ext_header_uri = "http://openlibrary.org/dev/docs/api" # setup special connection with caching support import connection client._connection_types['ol'] = connection.OLConnection infogami.config.infobase_parameters = dict(type="ol") types.register_type('^/a/[^/]*$', '/type/author') types.register_type('^/b/[^/]*$', '/type/edition') types.register_type('^/l/[^/]*$', '/type/language') types.register_type('^/works/[^/]*$', '/type/work') types.register_type('^/subjects/[^/]*$', '/type/subject') types.register_type('^/publishers/[^/]*$', '/type/publisher') types.register_type('^/usergroup/[^/]*$', '/type/usergroup') types.register_type('^/permission/[^/]*$', '/type/permision') types.register_type('^/(css|js)/[^/]*$', '/type/rawtext') # set up infobase schema. required when running in standalone mode. import schema dbstore.default_schema = schema.get_schema()
def setup(): """Setup for upstream plugin""" models.setup() utils.setup() addbook.setup() covers.setup() # overwrite ReadableUrlProcessor patterns for upstream ReadableUrlProcessor.patterns = [ (r'/books/OL\d+M', '/type/edition', 'title', 'untitled'), (r'/authors/OL\d+A', '/type/author', 'name', 'noname'), (r'/works/OL\d+W', '/type/work', 'title', 'untitled') ] # Types for upstream paths types.register_type('^/authors/[^/]*$', '/type/author') types.register_type('^/books/[^/]*$', '/type/edition') types.register_type('^/languages/[^/]*$', '/type/language') types.register_type('^/subjects/places/[^/]*$', '/type/place') types.register_type('^/subjects/people/[^/]*$', '/type/person') types.register_type('^/subjects/[^/]*$', '/type/subject') # fix photo/cover url pattern ol_code.Author.photo_url_patten = "%s/photo" ol_code.Edition.cover_url_patten = "%s/cover" # setup template globals from openlibrary.i18n import gettext as _ web.template.Template.globals.update({ "gettext": _, "_": _, "random": random.Random(), "commify": web.commify, "group": web.group, "storage": web.storage, "all": all, "any": any, "locals": locals }); setup_jquery_urls()
from infogami.infobase import client, dbstore try: from infogami.plugins.api import code as api except: api = None # http header extension for OL API infogami.config.http_ext_header_uri = "http://openlibrary.org/dev/docs/api" # setup special connection with caching support import connection client._connection_types['ol'] = connection.OLConnection infogami.config.infobase_parameters = dict(type="ol") types.register_type('^/a/[^/]*$', '/type/author') types.register_type('^/b/[^/]*$', '/type/edition') # set up infobase schema. required when running in standalone mode. import schema dbstore.default_schema = schema.get_schema() # this adds /show-marc/xxx page to infogami import showmarc # add zip and tuple to the list of public functions public(zip) public(tuple) web.template.Template.globals['NEWLINE'] = "\n" @infogami.action
import infogami from infogami.utils import delegate, types from infogami.utils.storage import OrderedDict from infogami.utils.template import render from infogami.utils.view import public, thingview, thingrepr, require_login from infogami.infobase import client from infogami import config from telugu_months import months as te_months import datetime import utils import re import os import Image types.register_type('^/[0-9][0-9][0-9][0-9]/[0-9][0-9]$', '/type/issue') types.register_type('^/[0-9][0-9][0-9][0-9]/[0-9][0-9]/.*$', '/type/article') class Article(client.Thing): def get_issue(self): parent = self.key.rsplit('/', 1)[0] return web.ctx.site.get(parent) class Issue(client.Thing): @property def banner_url(self): _, yyyy, mm = self.key.split("/") prefix = os.path.join("static", "images", yyyy, mm, "banner") extensions = [".jpg", ".JPG", ".gif", ".GIF", ".png", ".PNG"] for ext in extensions: if os.path.exists(prefix + ext):