本文整理汇总了Python中util.redirect函数的典型用法代码示例。如果您正苦于以下问题:Python redirect函数的具体用法?Python redirect怎么用?Python redirect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了redirect函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: lost_passwd_send
def lost_passwd_send(self, email=None):
if not email:
util.redirect("/")
try:
u = UserAcct.by_email_address(email)
import smtplib
import pkg_resources
from email.MIMEText import MIMEText
msg_to = u.email_address
msg_from = "BandRadar Help <[email protected]>"
body = pkg_resources.resource_string(__name__,
'templates/user/lost_passwd_email.txt')
body = body % {'password': u.password,
'user_name': u.user_name}
msg = MIMEText(body)
msg['Subject'] = "bandradar.com password reminder"
msg['From'] = msg_from
msg['To'] = msg_to
s = smtplib.SMTP()
s.connect()
s.sendmail(msg_from, [msg_to], msg.as_string())
s.close()
flash("Email sent to %s." % email)
except SQLObjectNotFound:
flash("Email unknown - no email sent.")
util.redirect("/")
开发者ID:agrover,项目名称:BandRadar,代码行数:29,代码来源:users.py
示例2: show
def show(self, id, list_all=0):
try:
a = Artist.get(id)
except SQLObjectNotFound:
flash("Artist ID not found")
util.redirect("/artists/list")
except ValueError:
try:
a = Artist.byNameI(urllib.unquote_plus(id))
except SQLObjectNotFound:
flash("Artist ID not found")
util.redirect("/artists/list")
if identity.current.user and a in identity.current.user.artists:
is_tracked = True
else:
is_tracked = False
past_events = a.events.filter(Event.q.date < date.today()).orderBy('-date')
if not list_all:
past_events = past_events[:5]
future_events = a.events.filter(Event.q.date >= date.today()).orderBy('date')
return dict(artist=a, past_events=past_events, future_events=future_events,
tracked_count=a.users.count(), is_tracked=is_tracked,
description=util.desc_format(a.description), artist_list=artist_list)
开发者ID:agrover,项目名称:BandRadar,代码行数:25,代码来源:artists.py
示例3: atse_addSchemplate
def atse_addSchemplate(self, atse_schemplate_id, schema_template, RESPONSE=None):
""" Adds a schema template.
@type atse_schemplate_id: String
@param atse_schemplate_id: The id of the schema template to be created
@type schema_template: String
@param schema_template: The name of the template to redirect to
"""
S = BaseSchema.copy()
if self._schemas.has_key( atse_schemplate_id ):
raise SchemaEditorError('Schema template with id %s already exists' % schema_id)
else:
self.atse_registerSchema(
atse_schemplate_id,
S,
filtered_schemas=SCHEMPLATE_IGNORE_SCHEMATA)
self._schemas._p_changed = 1
if RESPONSE:
util.redirect(RESPONSE, schema_template,
self.translate('atse_schema_template_added',
default='Schema template added',
domain='ATSchemaEditorNG'),
schema_id=atse_schemplate_id)
return
开发者ID:a-pasquale,项目名称:Products.ATSchemaEditorNG,代码行数:28,代码来源:SchemplateEditor.py
示例4: delete
def delete(self, id):
try:
a = Artist.get(id)
a.destroySelf()
flash("Deleted")
except SQLObjectNotFound:
flash("Delete failed")
util.redirect("/artists/list")
开发者ID:agrover,项目名称:BandRadar,代码行数:8,代码来源:artists.py
示例5: delete
def delete(self, id):
try:
b = Blurb.get(id)
b.destroySelf()
flash("Deleted")
except SQLObjectNotFound:
flash("Delete failed")
util.redirect("/blurbs/list")
开发者ID:agrover,项目名称:BandRadar,代码行数:8,代码来源:blurbs.py
示例6: merge_dupe
def merge_dupe(self, old_id, new_id):
old = Event.get(old_id)
new = Event.get(new_id)
Event.merge(old, new)
for artist in new.artists:
if not artist.approved:
artist.approved = datetime.now()
util.redirect("/importers/reviewdupes")
开发者ID:agrover,项目名称:BandRadar,代码行数:8,代码来源:importers.py
示例7: reviewsubmit
def reviewsubmit(self, submit, **kw):
if submit == "Import Checked":
self.review_import(**kw)
flash("Imported")
else:
self.review_delete(**kw)
flash("Deleted")
util.redirect("/importers/review")
开发者ID:agrover,项目名称:BandRadar,代码行数:8,代码来源:importers.py
示例8: delete
def delete(self, id):
try:
v = Venue.get(id)
v.destroySelf()
flash("Deleted")
except SQLObjectNotFound:
flash("Not Found")
except SQLObjectIntegrityError:
flash("Cannot delete")
util.redirect("/venues/list")
开发者ID:agrover,项目名称:BandRadar,代码行数:10,代码来源:venues.py
示例9: edit
def edit(self, id=0):
if id:
try:
v = Venue.get(id)
except SQLObjectNotFound:
flash("Invalid ID")
util.redirect("/venues/list")
else:
v = {}
return dict(venue_form=venue_form, form_vals=v)
开发者ID:agrover,项目名称:BandRadar,代码行数:10,代码来源:venues.py
示例10: split
def split(self, id):
try:
a = Artist.get(id)
new_artists = a.split_artist()
if len(new_artists) > 1:
flash("split into %s" % ", ".join(new_artists.values()))
else:
flash("Not split")
except SQLObjectNotFound:
flash("not found")
util.redirect("/artists/%s" % new_artists.keys()[0])
开发者ID:agrover,项目名称:BandRadar,代码行数:11,代码来源:artists.py
示例11: edit
def edit(self, user_name):
if not (identity.current.user.user_name == user_name
or "admin" in identity.current.groups):
raise identity.IdentityFailure("Not authorized")
try:
u = UserAcct.by_user_name(user_name)
except SQLObjectNotFound:
flash("Invalid username")
util.redirect("/")
return dict(user_name=user_name, user_form=user_form,
form_vals=u)
开发者ID:agrover,项目名称:BandRadar,代码行数:11,代码来源:users.py
示例12: merge
def merge(self, id, other_id):
try:
old = Artist.get(id)
new = Artist.get(other_id)
Artist.merge(old, new)
# add this to fixup dict, so will never have to merge again
artist_fixup_dict[old.name] = new.name
artist_fixup_dict.tidy(old.name, new.name)
flash("%s merged into %s and learned" % (old.name, new.name))
except SQLObjectNotFound:
flash("Could not move")
util.redirect("/artists/%s" % other_id)
开发者ID:agrover,项目名称:BandRadar,代码行数:12,代码来源:artists.py
示例13: untrack
def untrack(self, id, viewing="no"):
u = identity.current.user
try:
v = Venue.get(id)
if v in u.venues:
u.removeVenue(v)
except SQLObjectNotFound:
flash("Venue not found")
util.redirect("/")
if viewing == "no":
util.redirect_previous()
else:
util.redirect("/venues/%s" % v.id)
开发者ID:agrover,项目名称:BandRadar,代码行数:13,代码来源:venues.py
示例14: save
def save(self, id=0, **kw):
if id:
try:
v = Venue.get(id)
v.set(**v.clean_dict(kw))
flash("Updated")
except SQLObjectNotFound:
flash("Update Error")
else:
v = Venue(added_by=identity.current.user, **Venue.clean_dict(kw))
flash("Added")
v.approved = datetime.now()
util.redirect("/venues/%s" % v.id)
开发者ID:agrover,项目名称:BandRadar,代码行数:13,代码来源:venues.py
示例15: untrack
def untrack(self, id, viewing="no"):
u = identity.current.user
try:
a = Artist.get(id)
if a in u.artists:
u.removeArtist(a)
except SQLObjectNotFound:
flash("Artist not found")
util.redirect("/")
if viewing == "no":
util.redirect_previous()
else:
util.redirect("/artists/%s" % a.id)
开发者ID:agrover,项目名称:BandRadar,代码行数:13,代码来源:artists.py
示例16: showtracked
def showtracked(self, user_name):
try:
u = UserAcct.by_user_name(user_name)
artists = u.artists.orderBy(Artist.q.name)
viewing_self = False
if identity.current.user and identity.current.user.user_name == user_name:
viewing_self = True
except SQLObjectNotFound:
flash("User not found")
util.redirect("/")
return dict(user=u, artists=artists, viewing_self=viewing_self,
artist_list=artist_list)
开发者ID:agrover,项目名称:BandRadar,代码行数:14,代码来源:users.py
示例17: auth
def auth(request):
auth_user(request.cookies.get('auth'))
if g.user:
return util.redirect('/')
oauth_client = oauth2.Client2(
oauth_settings['client_id'],
oauth_settings['client_secret'],
oauth_settings['base_url']
)
authorization_url = oauth_client.authorization_url(
redirect_uri = oauth_settings['redirect_url'],
# params={'scope': 'user'}
)
return util.redirect(authorization_url)
开发者ID:argolab,项目名称:lusernews,代码行数:15,代码来源:github.py
示例18: generic_import
def generic_import(self, name, gen):
not_added = 0
review_count = 0
nonreview_count = 0
for event in gen:
new_event, flagged = self.import_to_db(event)
if not new_event:
not_added += 1
elif flagged:
review_count += 1
else:
nonreview_count += 1
flash("%s added %d, %d flagged for review, %d skipped" % \
(name, nonreview_count, review_count, not_added))
util.redirect("/importers/review")
开发者ID:agrover,项目名称:BandRadar,代码行数:15,代码来源:importers.py
示例19: save
def save(self, id=0, **kw):
if id:
try:
a = Artist.get(id)
a.set(**a.clean_dict(kw))
flash("Updated")
except SQLObjectNotFound:
flash("Update Error")
else:
a = Artist(added_by=identity.current.user, **Artist.clean_dict(kw))
if not "admin" in identity.current.groups:
identity.current.user.addArtist(a)
flash("Artist added")
a.approved = datetime.now()
util.redirect("/artists/%s" % a.id)
开发者ID:agrover,项目名称:BandRadar,代码行数:15,代码来源:artists.py
示例20: save
def save(self, id, **kw):
if id:
try:
b = Blurb.get(id)
b.set(**util.clean_dict(Blurb, kw))
flash("Updated")
except SQLObjectNotFound:
flash("Update Error")
else:
if kw.get("preview"):
kw['show_text'] = publish_parts(kw['text'], writer_name="html")["html_body"]
return self.edit(**kw)
else:
b = Blurb(added_by=identity.current.user, **util.clean_dict(Blurb, kw))
flash("Blurb added")
util.redirect("/blurbs/list")
开发者ID:agrover,项目名称:BandRadar,代码行数:16,代码来源:blurbs.py
注:本文中的util.redirect函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论