def get(self): per_page = 20 total_sql = "SELECT id FROM mod" cur_page, total_num, total_page, prev_page, next_page, offset, range_page, show_items = \ util.page(self, per_page, total_sql) pg = pgsql.Pgsql() ms = pg.fetchall( "SELECT id, name, describe, html FROM mod LIMIT %d OFFSET %d" % (per_page, offset)) mod_list = [] for m in ms: m['func_num'] = pg.fetch_num( "SELECT id FROM funcs WHERE mid = %d" % m['id']) mod_list.append(m) template_variables = dict(mod_list=mod_list, cur_page=cur_page, total_num=total_num, total_page=total_page, prev_page=prev_page, next_page=next_page, range_page=range_page, show_items=show_items, url="/mod/") self.render("mod_list.html", **template_variables)
def get(self, mid): uri = "/fun/" condition = "" current_mid = None if mid.isdigit(): condition = "WHERE mid = %s" % mid current_mid = mid uri += mid per_page = 50 total_sql = "SELECT id FROM funcs %s" % condition cur_page, total_num, total_page, prev_page, next_page, offset, range_page, show_items = \ util.page(self, per_page, total_sql) pg = pgsql.Pgsql() fs = pg.fetchall("SELECT id, name, mid, describe FROM funcs %s ORDER BY id DESC LIMIT %d OFFSET %d" % ( condition, per_page, offset)) i = len(fs) if i > 0: ms = pg.fetchall("SELECT id, name FROM mod ORDER BY name ASC") mod_name_dict = {} for m in ms: mod_name_dict[m['id']] = m['name'] rs = [] config_data = get_config_data() i = 1 for f in fs: f['index'] = i if f['mid'] == 0 or f['mid'] == "0": mod_name = "no_mod_name" else: mod_name = mod_name_dict[f['mid']] url = config_data['web_url'] + "modules/" + mod_name + "/" + \ f['name'].replace("/", "_") + ".html?search=" + mod_name + ":" f['mod_name'] = mod_name f['url'] = url rs.append(f) i += 1 else: rs = None template_variables = dict( rs=rs, current_mid=current_mid, cur_page=cur_page, total_num=total_num, total_page=total_page, prev_page=prev_page, next_page=next_page, range_page=range_page, show_items=show_items, url=uri ) self.render("fun_list.html", **template_variables)
def set_fasttext(self, data, mag): self.fasttext = True self.links = [] for n in range(4): nn = n*6 (p,e) = page(data[nn+3:nn+5]) ((s,m),e) = subcode_bcd(data[nn+5:nn+9]) m = (mag^m)&0x7 if m == 0: m = 8 self.links.append("%1d%02x" % (m,p))
def get(self, mid): uri = "/fun/" condition = "" current_mid = None if mid.isdigit(): condition = "WHERE mid = %s" % mid current_mid = mid uri += mid per_page = 50 total_sql = "SELECT id FROM funcs %s" % condition cur_page, total_num, total_page, prev_page, next_page, offset, range_page, show_items = \ util.page(self, per_page, total_sql) pg = pgsql.Pgsql() fs = pg.fetchall( "SELECT id, name, mid, describe FROM funcs %s ORDER BY id DESC LIMIT %d OFFSET %d" % (condition, per_page, offset)) i = len(fs) if i > 0: ms = pg.fetchall("SELECT id, name FROM mod ORDER BY name ASC") mod_name_dict = {} for m in ms: mod_name_dict[m['id']] = m['name'] rs = [] config_data = get_config_data() i = 1 for f in fs: f['index'] = i if f['mid'] == 0 or f['mid'] == "0": mod_name = "no_mod_name" else: mod_name = mod_name_dict[f['mid']] url = config_data['web_url'] + "modules/" + mod_name + "/" + \ f['name'].replace("/", "_") + ".html?search=" + mod_name + ":" f['mod_name'] = mod_name f['url'] = url rs.append(f) i += 1 else: rs = None template_variables = dict(rs=rs, current_mid=current_mid, cur_page=cur_page, total_num=total_num, total_page=total_page, prev_page=prev_page, next_page=next_page, range_page=range_page, show_items=show_items, url=uri) self.render("fun_list.html", **template_variables)
def do_print(tt): if type(tt) == type(''): tt = np.fromstring(tt, dtype=np.uint8) ret = "" ((m, r),e) = mrag(tt[:2]) ret += "%1d %2d" % (m, r) if r == 0: (p,e) = page(tt[2:4]) ((s,c),e) = subcode_bcd(tt[4:10]) ret += " P%1d%02x " % (m,p) ret += Printer(tt[10:]).string_ansi() ret += " %04x %x" % (s,c) elif r == 30: # broadcast service data # designation code (d,e) = unhamm84(tt[2]) # initial page (p,e) = page(tt[3:5]) ((s,m),e) = subcode_bcd(np.fromstring(tt[5:9], dtype=np.uint8)) ret += " %1d I%1d%02x:%04x " % (d, m, p, s) if d&2: ret += "(PDC) " else: ret += "(NET) " ret += Printer(tt[22:]).string_ansi() elif r == 27: # broadcast service data # designation code (d,e) = unhamm84(tt[2]) ret += " %1d " % (d) for n in range(6): nn = n*6 (p,e) = page(tt[nn+3:nn+5]) ((s,m),e) = subcode_bcd(tt[nn+5:nn+9]) ret += " %1d%02x:%04x " % (m,p,s) else: ret += Printer(tt[2:]).string_ansi() return ret
def __init__(self, a): self.array = a.reshape((26,42)) #do_print(self.array[0]) ((self.m,self.r),e) = mrag(self.array[0][:2]) (self.p,e) = page(self.array[0][2:4]) (self.s,self.c),self.e = subcode_bcd(self.array[0][4:10]) # remove parity self.array[2:,2:] &= 0x7f # check if row n-1 is double height self.no_double_on_prev = ((self.array[1:-1,2:]) != 0x0d).all(axis=1) # row 1 can't contain double but might due to not being printable self.no_double_on_prev[0] = True # calculate a target threshold for each line # based on the number of non-blank characters # first count non-blanks self.threshold = ((self.array[2:,2:] != ord(' ')).sum(axis=1)) # if non-blanks <= 5, don't require a match (set threshold to 0) # also ignore rows following a double height row self.threshold *= ((self.threshold > 5) & (self.no_double_on_prev)) # some proportion of non-blanks must match in the rest of the lines self.threshold *= 0.5 # sum required threshold for each line to get total threshold self.threshold_sum = self.threshold.sum() * 1.5 try: self.ds = int("%x" % self.s, 10) except ValueError: self.ds = 1000 rows = np.array([mrag(self.array[n][:2])[0][1] for n in range(26)]) self.goodrows = (rows == Page.rows)
def get(self): per_page = 20 total_sql = "SELECT id FROM mod" cur_page, total_num, total_page, prev_page, next_page, offset, range_page, show_items = \ util.page(self, per_page, total_sql) pg = pgsql.Pgsql() ms = pg.fetchall("SELECT id, name, describe, html FROM mod LIMIT %d OFFSET %d" % (per_page, offset)) mod_list = [] for m in ms: m['func_num'] = pg.fetch_num("SELECT id FROM funcs WHERE mid = %d" % m['id']) mod_list.append(m) template_variables = dict( mod_list=mod_list, cur_page=cur_page, total_num=total_num, total_page=total_page, prev_page=prev_page, next_page=next_page, range_page=range_page, show_items=show_items, url="/mod/" ) self.render("mod_list.html", **template_variables)
# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. from django.conf.urls.defaults import * from util import page import views urlpatterns = patterns( '', page("", "mozorg/home.html"), page('about', 'mozorg/about.html'), page('book', 'mozorg/book.html'), page('about/partnerships', 'mozorg/partnerships.html'), page('about/partnerships/distribution', 'mozorg/partnerships-distribution.html'), page('products', 'mozorg/products.html'), page('projects/mozilla-based', 'mozorg/projects/mozilla-based.html'), page('button', 'mozorg/button.html'), page('sandstone', 'mozorg/sandstone.html'), page('mission', 'mozorg/mission.html'), page('mobile', 'mozorg/mobile.html'), page('ITU', 'mozorg/itu.html'), url('^newsletter/hacks\.mozilla\.org/$', views.hacks_newsletter, name='mozorg.hacks_newsletter'), url('^contribute/$', views.contribute, name='mozorg.contribute', kwargs={ 'template': 'mozorg/contribute.html',
# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. from django.conf.urls.defaults import * from util import page import views urlpatterns = patterns('', page("", "mozorg/home.html"), page('about/manifesto', 'mozorg/about/manifesto.html'), page('about', 'mozorg/about.html'), page('book', 'mozorg/book.html'), url('^about/partnerships/$', views.partnerships, name='mozorg.partnerships'), page('about/partnerships/distribution', 'mozorg/partnerships-distribution.html'), page('about/history', 'mozorg/about/history.html'), page('products', 'mozorg/products.html'), page('about/mozilla-based', 'mozorg/projects/mozilla-based.html'), page('button', 'mozorg/button.html'), page('mission', 'mozorg/mission.html'), page('mobile', 'mozorg/mobile.html'), page('ITU', 'mozorg/itu.html'), page('about/powered-by', 'mozorg/powered-by.html'), page('about/governance', 'mozorg/about/governance/governance.html'), page('about/governance/roles', 'mozorg/about/governance/roles.html'), page('about/governance/policies', 'mozorg/about/governance/policies.html'), page('about/governance/organizations', 'mozorg/about/governance/organizations.html'), url('^contribute/$', views.contribute, name='mozorg.contribute',
def get_from_pools(): """ One of the main ``clusto`` operations. Parameters: * Required: at least one ``pool`` parameter * Optional: one or more ``driver`` parameter to filter out results * Optional: one or more ``type`` parameter to filter out results * Optional: a boolean ``children`` parameter to search for children recursively (True by default) Examples: .. code:: bash $ ${get} ${server_url}/from-pools "Provide at least one pool to get data from" HTTP: 412 Content-type: application/json $ ${get} -H 'Clusto-Page: notanint' -d 'pool=emptypool' ${server_url}/from-pools "invalid literal for int() with base 10: 'notanint'" HTTP: 400 Content-type: application/json $ ${get} -d 'pool=emptypool' ${server_url}/from-pools [] HTTP: 200 Content-type: application/json $ ${get} -d 'pool=singlepool' -d 'pool=multipool' ${server_url}/from-pools [ "/basicserver/testserver1" ] HTTP: 200 Content-type: application/json $ ${get} -H 'Clusto-Mode: expanded' -d 'pool=multipool' ${server_url}/from-pools [ { "attrs": [ { "datatype": "string", "key": "key1", "number": null, "subkey": "subkey1", "value": "value1" } ], "contents": [], "driver": "basicserver", "ips": [], "name": "testserver1", "parents": [ "/pool/singlepool", "/pool/multipool" ], "type": "server" }, { "attrs": [ { "datatype": "string", "key": "key1", "number": null, "subkey": "subkey2", "value": "value2" } ], "contents": [], "driver": "basicserver", "ips": [], "name": "testserver2", "parents": [ "/pool/multipool" ], "type": "server" } ] HTTP: 200 Content-type: application/json $ ${get} -H 'Clusto-Page: 1' -H 'Clusto-Per-Page: 1' -d 'pool=multipool' ${server_url}/from-pools [ "/basicserver/testserver1" ] HTTP: 200 Content-type: application/json $ ${get} -H 'Clusto-Page: 1' -H 'Clusto-Per-Page: 100' -d 'pool=multipool' ${server_url}/from-pools [ "/basicserver/testserver1", "/basicserver/testserver2" ] HTTP: 200 Content-type: application/json $ ${get} -H 'Clusto-Page: 100' -H 'Clusto-Per-Page: 100' -d 'pool=multipool' ${server_url}/from-pools [] HTTP: 200 Content-type: application/json $ ${get} -H 'Clusto-Minify: True' -d 'pool=multipool' ${server_url}/from-pools ["/basicserver/testserver1", "/basicserver/testserver2"] HTTP: 200 Content-type: application/json """ pools = bottle.request.params.getall('pool') if not pools: return util.dumps('Provide at least one pool to get data from', 412) types = bottle.request.params.getall('type') drivers = bottle.request.params.getall('driver') children = bottle.request.params.get('children', default=True, type=bool) mode = bottle.request.headers.get('Clusto-Mode', default='compact') headers = {} try: # Assignments are moved into the try block because of the int casting. current = int(bottle.request.headers.get('Clusto-Page', default='0')) per = int(bottle.request.headers.get('Clusto-Per-Page', default='50')) ents = clusto.get_from_pools( pools, clusto_types=types, clusto_drivers=drivers, search_children=children ) results = [] if current: ents, total = util.page(list(ents), current=current, per=per) headers['Clusto-Pages'] = total headers['Clusto-Per-Page'] = per headers['Clusto-Page'] = current for ent in ents: results.append(util.show(ent, mode)) return util.dumps(results, headers=headers) except ValueError as ve: return util.dumps('%s' % (ve,), 400) except TypeError as te: return util.dumps('%s' % (te,), 409) except LookupError as le: return util.dumps('%s' % (le,), 404) except Exception as e: return util.dumps('%s' % (e,), 500)
from django.conf.urls.defaults import * from util import page import views urlpatterns = patterns('', page("", "mozorg/home.html"), page('about', 'mozorg/about.html'), page('projects', 'mozorg/projects.html'), page('button', 'mozorg/button.html'), page('sandstone', 'mozorg/sandstone.html'), page('mission', 'mozorg/mission.html'), url('^contribute/$', views.contribute, name='mozorg.contribute'), )
from util import mrag, bitwise_mode, page def dump_headers(headers): if len(headers) > 1: ans = bitwise_mode([np.fromstring(h, dtype=np.uint8) for h in headers]) ans = "".join([chr(x) for x in ans]) else: ans = headers[0] sys.stdout.write(ans) if __name__=='__main__': headers = [] while(True): tt = sys.stdin.read(42) if len(tt) < 42: exit(0) ((m,r),e) = mrag(np.fromstring(tt[:2], dtype=np.uint8)) (p,e1) = page(np.fromstring(tt[2:4], dtype=np.uint8)) if r == 0: headers.append(tt) else: if len(headers) > 0: dump_headers(headers) headers = [] sys.stdout.write(tt) sys.stdout.flush()
# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. from django.conf.urls.defaults import * from util import page import views urlpatterns = patterns( '', page("", "mozorg/home.html"), page('about/manifesto', 'mozorg/about/manifesto.html'), page('about', 'mozorg/about.html'), page('book', 'mozorg/book.html'), url('^about/partnerships/$', views.partnerships, name='mozorg.partnerships'), page('about/partnerships/distribution', 'mozorg/partnerships-distribution.html'), page('about/history', 'mozorg/about/history.html'), page('products', 'mozorg/products.html'), page('about/mozilla-based', 'mozorg/projects/mozilla-based.html'), page('button', 'mozorg/button.html'), page('mission', 'mozorg/mission.html'), page('mobile', 'mozorg/mobile.html'), page('ITU', 'mozorg/itu.html'), page('about/powered-by', 'mozorg/powered-by.html'), url('^newsletter/hacks\.mozilla\.org/$', views.hacks_newsletter, name='mozorg.hacks_newsletter'), url('^contribute/$',
# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. from django.conf.urls import patterns, url from util import page import views urlpatterns = patterns( "", url("^$", views.HomeTestView.as_view(), name="mozorg.home"), page("about/manifesto", "mozorg/about/manifesto.html"), page("about", "mozorg/about.html"), page("book", "mozorg/book.html"), url("^about/partnerships/$", views.partnerships, name="mozorg.partnerships"), page("about/partnerships/distribution", "mozorg/partnerships-distribution.html"), page("about/history", "mozorg/about/history.html"), page("products", "mozorg/products.html"), page("about/mozilla-based", "mozorg/projects/mozilla-based.html"), page("projects/calendar", "mozorg/projects/calendar.html"), page("button", "mozorg/button.html"), page("mission", "mozorg/mission.html"), page("mobile", "mozorg/mobile.html"), page("ITU", "mozorg/itu.html"), page("about/powered-by", "mozorg/powered-by.html"), page("about/governance", "mozorg/about/governance/governance.html"), page("about/governance/roles", "mozorg/about/governance/roles.html"), page("about/governance/policies", "mozorg/about/governance/policies/policies.html"), page("about/governance/policies/security-group", "mozorg/about/governance/policies/security/group.html"), page("about/governance/policies/security-group/bugs", "mozorg/about/governance/policies/security/bugs.html"), page("about/governance/policies/security-group/tld-idn", "mozorg/about/governance/policies/security/tld-idn.html"),
from django.conf.urls.defaults import * from util import page import views urlpatterns = patterns('', page("", "mozorg/home.html"), page('about', 'mozorg/about.html'), page('about/partnerships', 'mozorg/partnerships.html'), page('about/partnerships/distribution', 'mozorg/partnerships-distribution.html'), page('projects', 'mozorg/projects.html'), page('button', 'mozorg/button.html'), page('sandstone', 'mozorg/sandstone.html'), page('mission', 'mozorg/mission.html'), url('^contribute/$', views.contribute, name='mozorg.contribute'), url('^contribute/page/$', views.contribute_page, name='mozorg.contribute_page'), )
# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. from django.conf.urls import patterns, url from util import page import views urlpatterns = patterns('', url('^$', views.home, name='mozorg.home'), page('about/manifesto', 'mozorg/about/manifesto.html'), page('about/manifesto/details', 'mozorg/about/manifesto-details.html'), page('about/leadership', 'mozorg/about/leadership.html'), page('about', 'mozorg/about.html'), page('book', 'mozorg/book.html'), url('^credits/$', views.credits_view, name='mozorg.credits'), page('credits/faq', 'mozorg/credits-faq.html'), url('^about/partnerships/$', views.partnerships, name='mozorg.partnerships'), page('about/partnerships/distribution', 'mozorg/partnerships-distribution.html'), page('about/partnerships/contentservices', 'mozorg/contentservices/index.html'), page('about/partnerships/contentservices/about', 'mozorg/contentservices/about.html'), page('about/partnerships/contentservices/faq', 'mozorg/contentservices/faq.html'), url('^about/partnerships/contentservices/start/$', views.content_services_start, name='mozorg.contentservices.start'), page('about/partnerships/contentservices/tiles', 'mozorg/contentservices/tiles.html'), page('about/partnerships/contentservices/user-respect', 'mozorg/contentservices/user-respect.html'), page('about/history', 'mozorg/about/history.html'), page('about/history/details', 'mozorg/about/history-details.html'), page('about/mozilla-based', 'mozorg/projects/mozilla-based.html'), page('projects/calendar', 'mozorg/projects/calendar.html'),
def get_from_pools(): """ One of the main ``clusto`` operations. Parameters: * Required: at least one ``pool`` parameter * Optional: one or more ``driver`` parameter to filter out results * Optional: one or more ``type`` parameter to filter out results * Optional: a boolean ``children`` parameter to search for children recursively (True by default) Examples: .. code:: bash $ ${get} ${server_url}/from-pools "Provide at least one pool to get data from" HTTP: 412 Content-type: application/json $ ${get} -d 'pool=emptypool' ${server_url}/from-pools [] HTTP: 200 Content-type: application/json $ ${get} -d 'pool=singlepool' -d 'pool=multipool' ${server_url}/from-pools [ "/basicserver/testserver1" ] HTTP: 200 Content-type: application/json $ ${get} -H 'Clusto-Mode: expanded' -d 'pool=multipool' ${server_url}/from-pools [ { "attrs": [], "contents": [], "driver": "basicserver", "name": "testserver1", "parents": [ "/pool/singlepool", "/pool/multipool" ] }, { "attrs": [], "contents": [], "driver": "basicserver", "name": "testserver2", "parents": [ "/pool/multipool" ] } ] HTTP: 200 Content-type: application/json """ pools = bottle.request.params.getall('pool') if not pools: return util.dumps('Provide at least one pool to get data from', 412) types = bottle.request.params.getall('type') drivers = bottle.request.params.getall('driver') children = bottle.request.params.get('children', default=True, type=bool) mode = bottle.request.headers.get('Clusto-Mode', default='compact') current = int(bottle.request.headers.get('Clusto-Page', default='0')) per = int(bottle.request.headers.get('Clusto-Per-Page', default='50')) try: ents = clusto.get_from_pools( pools, clusto_types=types, clusto_drivers=drivers, search_children=children ) results = [] headers = {} if current: ents, total = util.page(list(ents), current=current, per=per) headers = { 'Clusto-Pages': total, 'Clusto-Per-Page': per, 'Clusto-Page': current } for ent in ents: results.append(util.show(ent, mode)) return util.dumps(results, headers=headers) except TypeError as te: return util.dumps('%s' % (te,), 409) except LookupError as le: return util.dumps('%s' % (le,), 404) except Exception as e: return util.dumps('%s' % (e,), 500)
from django.conf.urls.defaults import * from util import page import views urlpatterns = patterns( '', page("", "mozorg/home.html"), page('about', 'mozorg/about.html'), page('about/partnerships', 'mozorg/partnerships.html'), page('about/partnerships/distribution', 'mozorg/partnerships-distribution.html'), page('projects', 'mozorg/projects.html'), page('button', 'mozorg/button.html'), page('sandstone', 'mozorg/sandstone.html'), page('mission', 'mozorg/mission.html'), url('^contribute/$', views.contribute, name='mozorg.contribute'), url('^contribute/page/$', views.contribute_page, name='mozorg.contribute_page'), )
def get_from_pools(): """ One of the main ``clusto`` operations. Parameters: * Required: at least one ``pool`` parameter * Optional: one or more ``driver`` parameter to filter out results * Optional: one or more ``type`` parameter to filter out results * Optional: a boolean ``children`` parameter to search for children recursively (True by default) Examples: .. code:: bash $ ${get} ${server_url}/from-pools "Provide at least one pool to get data from" HTTP: 412 Content-type: application/json $ ${get} -H 'Clusto-Page: notanint' -d 'pool=emptypool' ${server_url}/from-pools "invalid literal for int() with base 10: 'notanint'" HTTP: 400 Content-type: application/json $ ${get} -d 'pool=emptypool' ${server_url}/from-pools [] HTTP: 200 Content-type: application/json $ ${get} -d 'pool=singlepool' -d 'pool=multipool' ${server_url}/from-pools [ "/basicserver/testserver1" ] HTTP: 200 Content-type: application/json $ ${get} -H 'Clusto-Mode: expanded' -d 'pool=multipool' ${server_url}/from-pools [ { "attrs": [ { "datatype": "string", "key": "key1", "number": null, "subkey": "subkey1", "value": "value1" } ], "contents": [], "driver": "basicserver", "name": "testserver1", "parents": [ "/pool/singlepool", "/pool/multipool" ] }, { "attrs": [ { "datatype": "string", "key": "key1", "number": null, "subkey": "subkey2", "value": "value2" } ], "contents": [], "driver": "basicserver", "name": "testserver2", "parents": [ "/pool/multipool" ] } ] HTTP: 200 Content-type: application/json $ ${get} -H 'Clusto-Page: 1' -H 'Clusto-Per-Page: 1' -d 'pool=multipool' ${server_url}/from-pools [ "/basicserver/testserver1" ] HTTP: 200 Content-type: application/json $ ${get} -H 'Clusto-Page: 1' -H 'Clusto-Per-Page: 100' -d 'pool=multipool' ${server_url}/from-pools [ "/basicserver/testserver1", "/basicserver/testserver2" ] HTTP: 200 Content-type: application/json $ ${get} -H 'Clusto-Page: 100' -H 'Clusto-Per-Page: 100' -d 'pool=multipool' ${server_url}/from-pools [] HTTP: 200 Content-type: application/json $ ${get} -H 'Clusto-Minify: True' -d 'pool=multipool' ${server_url}/from-pools ["/basicserver/testserver1", "/basicserver/testserver2"] HTTP: 200 Content-type: application/json """ pools = bottle.request.params.getall('pool') if not pools: return util.dumps('Provide at least one pool to get data from', 412) types = bottle.request.params.getall('type') drivers = bottle.request.params.getall('driver') children = bottle.request.params.get('children', default=True, type=bool) mode = bottle.request.headers.get('Clusto-Mode', default='compact') headers = { 'Clusto-Minify': bottle.request.headers.get('Clusto-Minify', default='False') } try: # Assignments are moved into the try block because of the int casting. current = int(bottle.request.headers.get('Clusto-Page', default='0')) per = int(bottle.request.headers.get('Clusto-Per-Page', default='50')) ents = clusto.get_from_pools( pools, clusto_types=types, clusto_drivers=drivers, search_children=children ) results = [] if current: ents, total = util.page(list(ents), current=current, per=per) headers['Clusto-Pages'] = total headers['Clusto-Per-Page'] = per headers['Clusto-Page'] = current for ent in ents: results.append(util.show(ent, mode)) return util.dumps(results, headers=headers) except ValueError as ve: return util.dumps('%s' % (ve,), 400) except TypeError as te: return util.dumps('%s' % (te,), 409) except LookupError as le: return util.dumps('%s' % (le,), 404) except Exception as e: return util.dumps('%s' % (e,), 500)
# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. from django.conf.urls import patterns, url from util import page import views urlpatterns = patterns('', url('^$', views.HomeTestView.as_view(), name='mozorg.home'), page('about/manifesto', 'mozorg/about/manifesto.html'), page('about', 'mozorg/about.html'), page('book', 'mozorg/book.html'), url('^about/partnerships/$', views.partnerships, name='mozorg.partnerships'), page('about/partnerships/distribution', 'mozorg/partnerships-distribution.html'), page('about/history', 'mozorg/about/history.html'), page('products', 'mozorg/products.html'), page('about/mozilla-based', 'mozorg/projects/mozilla-based.html'), page('projects/calendar', 'mozorg/projects/calendar.html'), page('button', 'mozorg/button.html'), page('mission', 'mozorg/mission.html'), page('ITU', 'mozorg/itu.html'), page('about/powered-by', 'mozorg/powered-by.html'), page('about/governance', 'mozorg/about/governance/governance.html'), page('about/governance/roles', 'mozorg/about/governance/roles.html'), page('about/governance/policies', 'mozorg/about/governance/policies/policies.html'), page('about/governance/policies/security-group/bugs', 'mozorg/about/governance/policies/security/bugs.html'), page('about/governance/policies/security-group/tld-idn', 'mozorg/about/governance/policies/security/tld-idn.html'), page('about/governance/policies/security-group/membership', 'mozorg/about/governance/policies/security/membership.html'), page('about/governance/policies/security-group/certs', 'mozorg/about/governance/policies/security/certs/index.html'), page('about/governance/policies/security-group/certs/included', 'mozorg/about/governance/policies/security/certs/included.html'),
# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. from django.conf.urls import patterns, url from util import page import views urlpatterns = patterns( '', page("", "mozorg/home.html"), page('about/manifesto', 'mozorg/about/manifesto.html'), page('about', 'mozorg/about.html'), page('book', 'mozorg/book.html'), url('^about/partnerships/$', views.partnerships, name='mozorg.partnerships'), page('about/partnerships/distribution', 'mozorg/partnerships-distribution.html'), page('about/history', 'mozorg/about/history.html'), page('products', 'mozorg/products.html'), page('about/mozilla-based', 'mozorg/projects/mozilla-based.html'), page('button', 'mozorg/button.html'), page('mission', 'mozorg/mission.html'), page('mobile', 'mozorg/mobile.html'), page('ITU', 'mozorg/itu.html'), page('about/powered-by', 'mozorg/powered-by.html'), page('about/governance', 'mozorg/about/governance/governance.html'), page('about/governance/roles', 'mozorg/about/governance/roles.html'), page('about/governance/policies', 'mozorg/about/governance/policies.html'), page('about/governance/policies/security-group',
from django.conf.urls.defaults import * from redirects.util import redirect from util import page import views urlpatterns = patterns('', page("", "mozorg/home.html"), page('about', 'mozorg/about.html'), page('book', 'mozorg/book.html'), page('about/partnerships', 'mozorg/partnerships.html'), page('about/partnerships/distribution', 'mozorg/partnerships-distribution.html'), page('products', 'mozorg/products.html'), page('projects/mozilla-based', 'mozorg/projects/mozilla-based.html'), page('button', 'mozorg/button.html'), page('sandstone', 'mozorg/sandstone.html'), page('mission', 'mozorg/mission.html'), page('mobile', 'mozorg/mobile.html'), url('^contribute/$', views.contribute, name='mozorg.contribute', kwargs={'template': 'mozorg/contribute.html', 'return_to_form': False}), url('^contribute/event/$', views.contribute, kwargs={'template': 'mozorg/contribute.html', 'return_to_form': True}, name='mozorg.contribute_event'), url('^contribute/page/$', views.contribute, kwargs={'template': 'mozorg/contribute-page.html', 'return_to_form': False}, name='mozorg.contribute_page'),
# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. from django.conf.urls import patterns, url from util import page import views urlpatterns = patterns('', url('^$', views.HomeTestView.as_view(), name='mozorg.home'), page('about/manifesto', 'mozorg/about/manifesto.html'), page('about', 'mozorg/about.html'), page('book', 'mozorg/book.html'), url('^about/partnerships/$', views.partnerships, name='mozorg.partnerships'), page('about/partnerships/distribution', 'mozorg/partnerships-distribution.html'), page('about/history', 'mozorg/about/history.html'), page('products', 'mozorg/products.html'), page('about/mozilla-based', 'mozorg/projects/mozilla-based.html'), page('button', 'mozorg/button.html'), page('mission', 'mozorg/mission.html'), page('mobile', 'mozorg/mobile.html'), page('ITU', 'mozorg/itu.html'), page('about/powered-by', 'mozorg/powered-by.html'), page('about/governance', 'mozorg/about/governance/governance.html'), page('about/governance/roles', 'mozorg/about/governance/roles.html'), page('about/governance/policies', 'mozorg/about/governance/policies.html'), page('about/governance/policies/security-group', 'mozorg/about/governance/policies/security/group.html'), page('about/governance/policies/security-group/bugs', 'mozorg/about/governance/policies/security/bugs.html'), page('about/governance/policies/security-group/tld-idn', 'mozorg/about/governance/policies/security/tld-idn.html'), page('about/governance/policies/security-group/membership', 'mozorg/about/governance/policies/security/membership.html'), page('about/governance/organizations', 'mozorg/about/governance/organizations.html'),