예제 #1
0
import connection
client._connection_types['ol'] = connection.OLConnection
infogami.config.infobase_parameters = dict(type="ol")

# set up infobase schema. required when running in standalone mode.
from openlibrary.core import schema
schema.register_schema()

if infogami.config.get('infobase_server') is None:
    # setup infobase hooks for OL
    from openlibrary.plugins import ol_infobase
    ol_infobase.init_plugin()

from openlibrary.core import models
models.register_models()
models.register_types()


# this adds /show-marc/xxx page to infogami
import showmarc

# Remove movefiles install hook. openlibrary manages its own files.
infogami._install_hooks = [h for h in infogami._install_hooks if h.__name__ != "movefiles"]

import lists
lists.setup()

class hooks(client.hook):
    def before_new_version(self, page):
        if page.key.startswith('/a/') or page.key.startswith('/authors/'):
            if page.type.key == '/type/author':
예제 #2
0
# http header extension for OL API
infogami.config.http_ext_header_uri = 'http://openlibrary.org/dev/docs/api'

# setup special connection with caching support
from openlibrary.plugins.openlibrary import connection
client._connection_types['ol'] = connection.OLConnection
infogami.config.infobase_parameters = dict(type='ol')

# set up infobase schema. required when running in standalone mode.
from openlibrary.core import schema
schema.register_schema()

from openlibrary.core import models
models.register_models()
models.register_types()

# Remove movefiles install hook. openlibrary manages its own files.
infogami._install_hooks = [h for h in infogami._install_hooks if h.__name__ != 'movefiles']

from openlibrary.plugins.openlibrary import lists
lists.setup()

logger = logging.getLogger('openlibrary')


class hooks(client.hook):
    def before_new_version(self, page):
        user = web.ctx.site.get_user()
        account = user and user.get_account()
        if account and account.is_blocked():