本文整理汇总了Python中view.render.base函数的典型用法代码示例。如果您正苦于以下问题:Python base函数的具体用法?Python base怎么用?Python base使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了base函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: GET
def GET(self):
i = web.input(uid=None, sha=None, full=0)
if i.uid == None:
return render.base(view.listing())
else:
results = config.DB.select('items', dict(n=str(i.uid)), where="id=$n")
rows = results.list()
print ("Row count: " + str(len(rows)))
if len(rows) > 0:
row = rows[0]
results = config.DB.query("SELECT * FROM scores WHERE id='" + str(i.uid) + "'")
if i.full == 0:
for r in results.list():
print ("Updating: " + r['commitsha'])
outdir = os.getcwd() + '/static/' + r['commitsha'] + '/'
score, pagecount, all_scores = document_compare.compare_pdf_using_images(row['id'], outdir)
config.DB.update('scores', where='id="' + str(i.uid) + '" AND commitsha="' + str(r['commitsha']) + '"', olscore=score[0],ollscore=score[1], olwscore=score[2], details=str(all_scores).strip('[]'))
else:
shutil.copy(os.getcwd() + '/static/originals/' + str(i.uid) + row['extension'], '/tmp/')
if results[0].total_version == len(lo):
config.DB.delete('scores', where='id = "' + str(i.uid) + '"')
a = threading.Thread(target=worker, args=('/tmp/' + str(i.uid) + row['extension'], False, ))
a.start()
else:
a = threading.Thread(target=worker, args=('/tmp/' + str(i.uid) + row['extension'], True, ))
a.start()
return render.base(view.listing())
示例2: GET
def GET(self, cart_id):
"""Display the badges associated with a Cart ID"""
try:
bson.objectid.ObjectId(cart_id)
except bson.errors.InvalidId:
return render.base(render.validate(None, ("bad", "Invalid ObjectId")), "Pickup", True)
return render.base(render.pickup(view.badgeListing(cart_id)), "Pickup", True)
示例3: POST
def POST(self):
x = web.input(querytag='')
gm=Global_Mod()
gm.tag=x.querytag
gm.results=Search.searchbytag(gm.tag)
gm.results=[item.replace('\\','/') for item in gm.results]
print gm.results
if gm.results==[]:
return render.base(view.noresult())
else:
return render.base(view.tagresult(gm.tag,gm.results))
示例4: GET
def GET(self, source, feed_type=None):
if not feed_type:
events = db.get_events(order='time_start, name',
where="not cancelled and time_start >= date_sub(current_timestamp, interval 5 hour) and taken_from= '%s'" % (source))
web.debug(len(events))
#add source specific feed
print render.base(render.show_events( events, admin=False), feeds=["""
<link rel="alternate"
type="application/atom+xml" title="%s calendar - Atom"
href="http://%s/from/%s/feed.atom" />
""" % (source, config.server_root_url, source),])
else:
events = [e for e in db.get_events(limit='100', order='time_taken desc', where ="taken_from= '%s'" % (source))]
render_cached_feed(events, feed_type)
示例5: GET
def GET (self):
#return render.base("Contact Us", "Contáctenos")
#print web.ctx.path
#return render.base(menu(), render.contact("Contáctenos"), "Contáctenos")
#return render.base(menu, web.ctx.path, render.contact("Contáctenos"), "Contáctenos")
return render.base(menu, web.ctx.path, render.contact(view.listCountries()))
示例6: GET
def GET(self):
cart_id = web.cookies().get(config.cookieName)
if cart_id:
f = badgeForm()
return render.base(render.badge(f), "Nouvel insigne ~ New badge", True)
else:
raise web.seeother(config.make_url('/error'))
示例7: GET
def GET(self):
imglist=[]
ext=['png','bmp']
for file in os.listdir('static'):
if file.split('.')[-1] in ext:
imglist.append('static/'+file)
return render.base(view.allimg(imglist))
示例8: GET
def GET(self):
query_data = web.input(contact='', req_id='')
print query_data.contact
print query_data.req_id
confirm.notify_confirmation(query_data.contact, str(query_data.req_id))
return render.base(render.doconfirm(query_data.contact, query_data.req_id), 'SearchParty')
示例9: GET
def GET(self):
"""Display the cart listing"""
cart_id = web.cookies().get(config.cookieName)
if not cart_id:
cart_number = view.generateCartNumber()
cart_id = db.newCart(cart_number)
view.saveCookie(cart_id)
return render.base(view.cartListing(cart_id))
示例10: GET
def GET(self, action, badge_id):
cart_id = view.getCookie()
if not cart_id:
raise web.seeother(config.make_url("/"))
elif "status" in db.getCart(cart_id):
view.destroyCookie()
raise web.seeother(config.make_url("/"))
return render.base(view.cartListing(cart_id, (action, badge_id)))
示例11: POST
def POST(self):
x = web.input(myfile={})
print x['myfile'].filename
gm=Global_Mod()
gm.img = cv2.imdecode(numpy.fromstring(x['myfile'].file.read(), numpy.uint8), cv2.IMREAD_UNCHANGED)
resultslist=Search.search(gm.img)
for row in resultslist:
temp=list(row)
gm.results.append(temp[1].replace('\\','/'))
print gm.results
return render.base(view.imgresult(gm.img,gm.results))
示例12: GET
def GET(self,page=1):
page = int(page)
limit=config.perpage
offset = (page -1)*limit
counting = db.counting()
pages = counting / limit
if counting % limit > 0:
pages += 1
if page > pages:
raise web.seeother('/')
else:
return render.base(view.listing(offset=offset,limit=limit),
pages=pages, curpage=page)
示例13: GET
def GET(self):
fill_seedwords()
category = None
category_list = {}
user_data = web.input()
if user_data.has_key('category'):
category = user_data.get('category')
k = {}
k['what'] = 'rank, name'
k['where'] = 'category = "%s"' % category
entities = db.listing(**k)
category_list['category'] = category
category_list['words'] = seedwords[category]
return render.base(view.listing(), category_list = category_list)
示例14: GET
def GET(self):
x=web.input()
imgpath=x.imgpath
taglist=[]
print imgpath
with open('tag.csv') as f:
reader=csv.reader(f)
for row in reader:
temppath=row[0].replace('\\','/')
print temppath
if imgpath==temppath:
taglist=row[1:]
break
f.close()
return render.base(view.addtag(imgpath,taglist))
示例15: GET
def GET(self):
redact = {}
schema = db.wikischema()
block_list = db.get_redact_list()
for tcol in block_list:
redaction = db.get_redaction(tcol)
table, col = tcol.split('.')
if table not in redact:
redact[table] = {}
redact[table][col] = {}
redact[table][col]['type'] = schema[table][col]
redact[table][col]['redaction'] = redaction
m = re.search('\d+', schema[table][col])
if m and m.group(0):
redact[table][col]['size'] = m.group(0)
else:
redact[table][col]['size'] = 64
print redact
return render.base(view.menu('redacted'), view.redacted(redact))