def setup(): """Setup for upstream plugin""" models.setup() utils.setup() addbook.setup() covers.setup() merge_authors.setup() import data data.setup() # setup template globals from openlibrary.i18n import ugettext, ungettext, gettext_territory web.template.Template.globals.update({ "gettext": ugettext, "ugettext": ugettext, "_": ugettext, "ungettext": ungettext, "gettext_territory": gettext_territory, "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()
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()