def setup(): register_admin_page('/admin/git-pull', gitpull, label='git-pull') register_admin_page('/admin/reload', reload, label='Reload Templates') register_admin_page('/admin/people', people, label='People') register_admin_page('/admin(/people/.*)', people_view, label='View People') register_admin_page('/admin/ip', ipaddress, label='IP') register_admin_page('/admin/ip/(.*)', ipaddress_view, label='View IP') register_admin_page('/admin/stats/(\d\d\d\d-\d\d-\d\d)', stats, label='Stats JSON') register_admin_page('/admin/ipstats', ipstats, label='IP Stats JSON') register_admin_page('/admin/block', block, label='') register_admin_page('/admin/loans', loans_admin, label='') register_admin_page('/admin/status', service_status, label = "Open Library services") register_admin_page('/admin/support', support.cases, label = "Support cases") register_admin_page('/admin/support/case/(case-\d+)', support.case, label = "Support cases") register_admin_page('/admin/inspect(?:/(.+))?', inspect, label="") support.setup() import mem for p in [mem._memory, mem._memory_type, mem._memory_id]: register_admin_page('/admin' + p.path, p) public(get_admin_stats) public(get_blocked_ips) delegate.app.add_processor(block_ip_processor)
def setup(): register_admin_page('/admin/git-pull', gitpull, label='git-pull') register_admin_page('/admin/reload', reload, label='Reload Templates') register_admin_page('/admin/people', people, label='People') register_admin_page('/admin/people/([^/]*)', people_view, label='View People') register_admin_page('/admin/people/([^/]*)/edits', people_edits, label='Edits') register_admin_page('/admin/ip', ipaddress, label='IP') register_admin_page('/admin/ip/(.*)', ipaddress_view, label='View IP') register_admin_page('/admin/stats/(\d\d\d\d-\d\d-\d\d)', stats, label='Stats JSON') register_admin_page('/admin/ipstats', ipstats, label='IP Stats JSON') register_admin_page('/admin/block', block, label='') register_admin_page('/admin/loans', loans_admin, label='') register_admin_page('/admin/waitinglists', waitinglists_admin, label='') register_admin_page('/admin/status', service_status, label = "Open Library services") register_admin_page('/admin/inspect(?:(/.+))?', inspect, label="") register_admin_page('/admin/graphs', _graphs, label="") register_admin_page('/admin/permissions', permissions, label="") register_admin_page('/admin/solr', solr, label="") register_admin_page('/admin/imports', imports_home, label="") register_admin_page('/admin/imports/add', imports_add, label="") register_admin_page('/admin/imports/(\d\d\d\d-\d\d-\d\d)', imports_by_date, label="") register_admin_page('/admin/spamwords', spamwords, label="") import mem for p in [mem._memory, mem._memory_type, mem._memory_id]: register_admin_page('/admin' + p.path, p) public(get_admin_stats) public(get_blocked_ips) delegate.app.add_processor(block_ip_processor) import graphs graphs.setup()
def setup(): register_admin_page('/admin/git-pull', gitpull, label='git-pull') register_admin_page('/admin/reload', reload, label='Reload Templates') register_admin_page('/admin/people', people, label='People') register_admin_page('/admin(/people/.*)', people_view, label='View People') register_admin_page('/admin/ip', ipaddress, label='IP') register_admin_page('/admin/ip/(.*)', ipaddress_view, label='View IP') register_admin_page('/admin/stats/(\d\d\d\d-\d\d-\d\d)', stats, label='Stats JSON') register_admin_page('/admin/ipstats', ipstats, label='IP Stats JSON') register_admin_page('/admin/block', block, label='') register_admin_page('/admin/loans', loans_admin, label='') register_admin_page('/admin/status', service_status, label="Open Library services") register_admin_page('/admin/support', support.cases, label="Support cases") register_admin_page('/admin/support/case/(case-\d+)', support.case, label="Support cases") register_admin_page('/admin/inspect(?:/(.+))?', inspect, label="") support.setup() import mem for p in [mem._memory, mem._memory_type, mem._memory_id]: register_admin_page('/admin' + p.path, p) public(get_admin_stats) public(get_blocked_ips) delegate.app.add_processor(block_ip_processor)
def setup(): register_admin_page('/admin/git-pull', gitpull, label='git-pull') register_admin_page('/admin/reload', reload, label='Reload Templates') register_admin_page('/admin/people', people, label='People') register_admin_page('/admin/people/(.*)', people_view, label='View People') register_admin_page('/admin/ip', ipaddress, label='IP') register_admin_page('/admin/ip/(.*)', ipaddress_view, label='View IP') register_admin_page('/admin/stats/(\d\d\d\d-\d\d-\d\d)', stats, label='Stats JSON') register_admin_page('/admin/ipstats', ipstats, label='IP Stats JSON') register_admin_page('/admin/block', block, label='') register_admin_page('/admin/loans', loans_admin, label='') register_admin_page('/admin/status', service_status, label = "Open Library services") register_admin_page('/admin/support', support.cases, label = "All Support cases") register_admin_page('/admin/support/(all|new|replied|closed)?', support.cases, label = "Filtered Support cases") register_admin_page('/admin/support/(\d+)', support.case, label = "Support cases") register_admin_page('/admin/inspect(?:(/.+))?', inspect, label="") register_admin_page('/admin/tasks', tasks.tasklist, label = "Task queue") register_admin_page('/admin/tasks/(.*)', tasks.tasks, label = "Task details") register_admin_page('/admin/deploy', deploy, label="") register_admin_page('/admin/graphs', _graphs, label="") inspect_thing.setup() support.setup() import mem for p in [mem._memory, mem._memory_type, mem._memory_id]: register_admin_page('/admin' + p.path, p) public(get_admin_stats) public(get_blocked_ips) delegate.app.add_processor(block_ip_processor) import graphs graphs.setup()
def setup(): register_admin_page('/admin/git-pull', gitpull, label='git-pull') register_admin_page('/admin/reload', reload, label='Reload Templates') register_admin_page('/admin/people', people, label='People') register_admin_page('/admin/people/([^/]*)', people_view, label='View People') register_admin_page('/admin/people/([^/]*)/edits', people_edits, label='Edits') register_admin_page('/admin/ip', ipaddress, label='IP') register_admin_page('/admin/ip/(.*)', ipaddress_view, label='View IP') register_admin_page(r'/admin/stats/(\d\d\d\d-\d\d-\d\d)', stats, label='Stats JSON') register_admin_page('/admin/ipstats', ipstats, label='IP Stats JSON') register_admin_page('/admin/block', block, label='') register_admin_page('/admin/attach_debugger', attach_debugger, label='Attach Debugger') register_admin_page('/admin/loans', loans_admin, label='') register_admin_page('/admin/waitinglists', waitinglists_admin, label='') register_admin_page('/admin/inspect(?:(/.+))?', inspect, label="") register_admin_page('/admin/graphs', _graphs, label="") register_admin_page('/admin/logs', show_log, label="") register_admin_page('/admin/permissions', permissions, label="") register_admin_page('/admin/solr', solr, label="", librarians=True) register_admin_page('/admin/sync', sync_ol_ia, label="", librarians=True) register_admin_page('/admin/staffpicks', add_work_to_staff_picks, label="", librarians=True) register_admin_page('/admin/imports', imports_home, label="") register_admin_page('/admin/imports/add', imports_add, label="") register_admin_page(r'/admin/imports/(\d\d\d\d-\d\d-\d\d)', imports_by_date, label="") register_admin_page('/admin/spamwords', spamwords, label="") register_admin_page('/admin/sponsorship', sponsorship_stats, label="Sponsorship") register_admin_page('/admin/sponsorship/sync', sync_sponsored_books, label="Sponsor Sync") from openlibrary.plugins.admin import mem for p in [mem._memory, mem._memory_type, mem._memory_id]: register_admin_page('/admin' + p.path, p) public(get_admin_stats) public(get_blocked_ips) delegate.app.add_processor(block_ip_processor) from openlibrary.plugins.admin import graphs graphs.setup()
def setup(): register_admin_page('/admin/git-pull', gitpull, label='git-pull') register_admin_page('/admin/reload', reload, label='Reload Templates') register_admin_page('/admin/people', people, label='People') register_admin_page('/admin(/people/.*)', people_view, label='View People') register_admin_page('/admin/ip', ipaddress, label='IP') register_admin_page('/admin/ip/(.*)', ipaddress_view, label='View IP') register_admin_page('/admin/stats/(\d\d\d\d-\d\d-\d\d)', stats, label='Stats JSON') register_admin_page('/admin/ipstats', ipstats, label='IP Stats JSON') public(get_admin_stats)
def setup(): register_admin_page('/admin/git-pull', gitpull, label='git-pull') register_admin_page('/admin/reload', reload, label='Reload Templates') register_admin_page('/admin/people', people, label='People') register_admin_page('/admin/people/([^/]*)', people_view, label='View People') register_admin_page('/admin/people/([^/]*)/edits', people_edits, label='Edits') register_admin_page('/admin/ip', ipaddress, label='IP') register_admin_page('/admin/ip/(.*)', ipaddress_view, label='View IP') register_admin_page('/admin/stats/(\d\d\d\d-\d\d-\d\d)', stats, label='Stats JSON') register_admin_page('/admin/ipstats', ipstats, label='IP Stats JSON') register_admin_page('/admin/block', block, label='') register_admin_page('/admin/loans', loans_admin, label='') register_admin_page('/admin/status', service_status, label="Open Library services") # register_admin_page('/admin/support', support.cases, label = "All Support cases") # register_admin_page('/admin/support/(all|new|replied|closed)?', support.cases, label = "Filtered Support cases") # register_admin_page('/admin/support/(\d+)', support.case, label = "Support cases") register_admin_page('/admin/inspect(?:(/.+))?', inspect, label="") register_admin_page('/admin/tasks', tasks.tasklist, label="Task queue") register_admin_page('/admin/tasks/(.*)', tasks.tasks, label="Task details") register_admin_page('/admin/deploy', deploy, label="") register_admin_page('/admin/graphs', _graphs, label="") register_admin_page('/admin/permissions', permissions, label="") register_admin_page('/admin/solr', solr, label="") register_admin_page('/admin/imports', imports, label="") register_admin_page('/admin/imports/(\d\d\d\d-\d\d-\d\d)', imports_by_date, label="") inspect_thing.setup() support.setup() import mem for p in [mem._memory, mem._memory_type, mem._memory_id]: register_admin_page('/admin' + p.path, p) public(get_admin_stats) public(get_blocked_ips) delegate.app.add_processor(block_ip_processor) import graphs graphs.setup()
def setup(): register_admin_page('/admin/git-pull', gitpull, label='git-pull') register_admin_page('/admin/reload', reload, label='Reload Templates') register_admin_page('/admin/people', people, label='People') register_admin_page('/admin(/people/.*)', people_view, label='View People') register_admin_page('/admin/ip', ipaddress, label='IP') register_admin_page('/admin/ip/(.*)', ipaddress_view, label='View IP') register_admin_page('/admin/stats/(\d\d\d\d-\d\d-\d\d)', stats, label='Stats JSON') register_admin_page('/admin/ipstats', ipstats, label='IP Stats JSON') register_admin_page('/admin/block', block, label='') import mem for p in [mem._memory, mem._memory_type, mem._memory_id]: register_admin_page('/admin' + p.path, p) public(get_admin_stats) delegate.app.add_processor(block_ip_processor)
def setup(): register_admin_page("/admin/git-pull", gitpull, label="git-pull") register_admin_page("/admin/reload", reload, label="Reload Templates") register_admin_page("/admin/people", people, label="People") register_admin_page("/admin/people/([^/]*)", people_view, label="View People") register_admin_page("/admin/people/([^/]*)/edits", people_edits, label="Edits") register_admin_page("/admin/ip", ipaddress, label="IP") register_admin_page("/admin/ip/(.*)", ipaddress_view, label="View IP") register_admin_page("/admin/stats/(\d\d\d\d-\d\d-\d\d)", stats, label="Stats JSON") register_admin_page("/admin/ipstats", ipstats, label="IP Stats JSON") register_admin_page("/admin/block", block, label="") register_admin_page("/admin/loans", loans_admin, label="") register_admin_page("/admin/status", service_status, label="Open Library services") register_admin_page("/admin/support", support.cases, label="All Support cases") register_admin_page("/admin/support/(all|new|replied|closed)?", support.cases, label="Filtered Support cases") register_admin_page("/admin/support/(\d+)", support.case, label="Support cases") register_admin_page("/admin/inspect(?:(/.+))?", inspect, label="") register_admin_page("/admin/tasks", tasks.tasklist, label="Task queue") register_admin_page("/admin/tasks/(.*)", tasks.tasks, label="Task details") register_admin_page("/admin/deploy", deploy, label="") register_admin_page("/admin/graphs", _graphs, label="") register_admin_page("/admin/permissions", permissions, label="") inspect_thing.setup() support.setup() import mem for p in [mem._memory, mem._memory_type, mem._memory_id]: register_admin_page("/admin" + p.path, p) public(get_admin_stats) public(get_blocked_ips) delegate.app.add_processor(block_ip_processor) import graphs graphs.setup()
print(('fullsearch index error', e, e.args), file=web.debug) pass timings.update('pagetext done (oca lookups: %.4f sec)'% t_ocaid) except IOError as e: errortext = 'fulltext search is temporarily unavailable (%s)' % \ str(e) return render.fullsearch(q, out, nums, timings.results(), errortext=errortext) GET = POST facet_token = view.public(facet_hash.facet_token) class Timestamp(object): def __init__(self): self.t0 = time.time() self.ts = [] def update(self, msg): self.ts.append((msg, time.time()-self.t0)) def results(self): return (time.ctime(self.t0), self.ts) # this is in progress, not used yet. class Timestamp1(object): def __init__(self, key=None): self.td = defaultdict(float) self.last_t = time.time()
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() # 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" # Remove movefiles install hook. openlibrary manages its own files. infogami._install_hooks = [h for h in infogami._install_hooks if h.__name__ != "movefiles"] class Author(client.Thing): photo_url_pattern = "%s?m=change_cover" def get_edition_count(self): return web.ctx.site._request('/count_editions_by_author', data={'key': self.key}) edition_count = property(get_edition_count) def photo_url(self): p = processors.ReadableUrlProcessor()
pass timings.update('pagetext done (oca lookups: %.4f sec)'% t_ocaid) except IOError as e: errortext = 'fulltext search is temporarily unavailable (%s)' % \ str(e) return render.fullsearch(q, out, nums, timings.results(), errortext=errortext) GET = POST import facet_hash facet_token = view.public(facet_hash.facet_token) class Timestamp(object): def __init__(self): self.t0 = time.time() self.ts = [] def update(self, msg): self.ts.append((msg, time.time()-self.t0)) def results(self): return (time.ctime(self.t0), self.ts) # this is in progress, not used yet. class Timestamp1(object): def __init__(self, key=None): self.td = defaultdict(float) self.last_t = time.time()
for k, v in i.items(): key = 'talks/' + web.numify(k) talk = store[key] if talk.get('status') != v: store[key] = dict(talk, status=v) raise web.seeother("/talks") def write(path, text): dirname = os.path.dirname(path) if not os.path.exists(dirname): os.makedirs(dirname) f = open(path, 'w') f.write(text) f.close() class Request: path = property(lambda self: web.ctx.path) home = property(lambda self: web.ctx.home) domain = property(lambda self: web.ctx.host) web.template.Template.globals['request'] = Request() @public def get_cfp_status(): return config.get("cfp_status") public(web.numify) public(parse_datetime)
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 # add zip and tuple to the list of public functions public(zip) public(tuple) public(isbn_13_to_isbn_10) public(time) public(web.input) public(simplejson.dumps) web.template.Template.globals['NEWLINE'] = "\n" # 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):