Esempio n. 1
0
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()
Esempio n. 2
0
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()
Esempio n. 3
0
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()
Esempio n. 4
0
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()