本文整理汇总了Python中pylons.controllers.util.redirect_to函数的典型用法代码示例。如果您正苦于以下问题:Python redirect_to函数的具体用法?Python redirect_to怎么用?Python redirect_to使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了redirect_to函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: _delete
def _delete(self, id):
c.stream = Stream.find_by_id(id)
meta.Session.delete(c.stream)
meta.Session.commit()
h.flash("Stream has been deleted.")
redirect_to('index')
开发者ID:CarlFK,项目名称:zookeepr,代码行数:7,代码来源:stream.py
示例2: index
def index(self):
# Check access and redirect
if not h.auth.authorized(h.auth.has_organiser_role):
redirect_to(action="new")
c.volunteer_collection = Volunteer.find_all()
return render("volunteer/list.mako")
开发者ID:cafuego,项目名称:zookeepr,代码行数:7,代码来源:volunteer.py
示例3: _edit
def _edit(self, id):
results = self.form_result["volunteer"]
c.volunteer = Volunteer.find_by_id(id)
for key in self.form_result["volunteer"]:
setattr(c.volunteer, key, self.form_result["volunteer"][key])
meta.Session.commit()
redirect_to(action="view", id=c.volunteer.id)
开发者ID:cafuego,项目名称:zookeepr,代码行数:7,代码来源:volunteer.py
示例4: changepassword
def changepassword (self, id=None):
user = h.checkuser(id)
h.requirerights(user_is=id)
user.password = md5(self.form_result['newpass'].encode('utf-8')).hexdigest()
meta.Session.commit()
h.flashmsg (u"Пароль был изменён")
redirect_to(h.url_for(controller='usercontrol', action='list', id=None))
开发者ID:AmurSU,项目名称:orderman,代码行数:7,代码来源:usercontrol.py
示例5: save
def save(self):
up = UserProperty(session['identifier'],
self.form_result['nickname'],
int(self.form_result['time_diff']))
self.ups.save(up)
redirect_to('now')
开发者ID:masayang,项目名称:pylons_rpx_simpledb,代码行数:7,代码来源:clock.py
示例6: add
def add(self):
if request.POST:
c.name = request.POST.get('name')
c.description = request.POST.get('description')
c.identifier = request.POST.get('identifier')
c.homepage = request.POST.get('homepage')
c.is_public = request.POST.get('is_public') or False
if not c.name:
c.error = 'You must enter a name'
return render('/projects/add.mao')
if not c.identifier:
c.error = 'You must enter an identifier'
return render('/projects/add.mao')
project = Project()
project.name = c.name
project.description = c.description
project.homepage = c.homepage
project.is_public = c.is_public
project.identifier = c.identifier
db.add(project)
db.commit()
redirect_to(action='show', id=c.identifier)
return render('/projects/add.mao')
开发者ID:damoxc,项目名称:snakepit,代码行数:27,代码来源:projects.py
示例7: revoke
def revoke(self, id=None):
"""Отзыв заявки её создателем (например, решили проблему сами или «ложная тревога»)."""
order = h.checkorder(id)
# Заявка должна быть свободна!
if order.status.id != 1:
abort(403)
# Проверка прав доступа (админ либо ответственный подразделения, создавшего заявку)
if not (
h.have_role("admin")
or (
session.has_key("division")
and session.has_key("creator")
and session["creator"]
and order.cust_id == session["division"]
)
):
abort(401)
# Заявка готова, но никто её не сделал
order.status = meta.Session.query(model.Status).get(15)
order.performers = []
order.performer = None
# Добавление записи в журнал действий над заявкой
act = model.Action()
act.order_id = order.id
act.status = meta.Session.query(model.Status).get(15)
act.division = meta.Session.query(model.Division).get(session["division"])
act.performers.append(meta.Session.query(model.Person).get(session["id"]))
if session.has_key("operator_id") and session["id"] != session["operator_id"]:
act.performers.append(meta.Session.query(model.Person).get(session["operator_id"]))
meta.Session.add(act)
# Готово
meta.Session.commit()
h.flashmsg(u"Заявка № " + h.strong(order.id) + u" отозвана.")
redirect_to(h.url_for(controller="order", action="view", id=order.id))
开发者ID:AmurSU,项目名称:orderman,代码行数:34,代码来源:order.py
示例8: save
def save(self, id=None):
"""Save a record and redirect to new or edit."""
rock_q = model.meta.Session.query(model.Rock)
rock = rock_q.filter_by(id=id).first()
if not rock:
# if the record did not exist yet
rock = model.Rock()
rock.geo_zone = request.POST.get("geo_zone", "")
rock.geo_group = request.POST.get("geo_group", "")
rock.rock_number = request.POST.get("rock_number", "")
rock.rock_name = request.POST.get("rock_name", "")
rock.x = request.POST.get("x", "")
rock.y = request.POST.get("y", "")
rock.z = request.POST.get("z", "")
rock.length = request.POST.get("length", "")
rock.width = request.POST.get("width", "")
rock.geo_context_torrent = request.POST.get("geo_context_torrent", "")
rock.geo_context_lake = request.POST.get("geo_context_lake", "")
rock.geo_context_bog = request.POST.get("geo_context_bog", "")
rock.geo_context_pass = request.POST.get("geo_context_pass", "")
rock.geo_context_summit = request.POST.get("geo_context_summit", "")
rock.rock_type = request.POST.get("rock_type", "")
rock.outcrop_type = request.POST.get("outcrop_type", "")
rock.provision = request.POST.get("provision", "")
rock.description = request.POST.get("description", "")
model.meta.Session.save_or_update(rock)
model.meta.Session.commit()
# Issue a redirect based on the submit button
if "new_button" in request.POST.keys():
return redirect_to(action="new")
elif "edit_button" in request.POST.keys():
return redirect_to(url_for(action="edit", id=rock.id))
elif "delete_button" in request.POST.keys():
return redirect_to(url_for(action="delete", id=rock.id))
开发者ID:lazaret,项目名称:archeobases,代码行数:34,代码来源:rock.py
示例9: _review
def _review(self, id):
"""Review a funding application.
"""
c.funding = Funding.find_by_id(id)
c.signed_in_person = h.signed_in_person()
c.next_review_id = Funding.find_next_proposal(c.funding.id, c.funding.type.id, c.signed_in_person.id)
person = c.signed_in_person
if person in [ review.reviewer for review in c.funding.reviews]:
h.flash('Already reviewed')
return redirect_to(action='review', id=c.next_review_id)
results = self.form_result['review']
if results['score'] == 'null':
results['score'] = None
review = FundingReview(**results)
meta.Session.add(review)
c.funding.reviews.append(review)
review.reviewer = person
meta.Session.commit()
if c.next_review_id:
return redirect_to(action='review', id=c.next_review_id)
h.flash("No more funding applications to review")
return redirect_to(action='review_index')
开发者ID:CarlFK,项目名称:zookeepr,代码行数:30,代码来源:funding.py
示例10: signout_confirm
def signout_confirm(self, id=None):
""" Confirm user wants to sign out
"""
if id is not None:
redirect_to(action='signout_confirm', id=None)
return render('/person/signout.mako')
开发者ID:CarlFK,项目名称:zookeepr,代码行数:7,代码来源:person.py
示例11: _new
def _new(self):
# Do we allow account creation?
if lca_info['account_creation']:
"""Create a new person submit.
"""
# Remove fields not in class
results = self.form_result['person']
del results['password_confirm']
del results['email_address2']
c.person = Person(**results)
c.person.email_address = c.person.email_address.lower()
meta.Session.add(c.person)
#for sn in self.form_result['social_network']:
# network = SocialNetwork.find_by_name(sn['name'])
# if sn['account_name']:
# c.person.social_networks[network] = sn['account_name']
meta.Session.commit()
if lca_rego['confirm_email_address'] == 'no':
redirect_to(controller='person', action='confirm', confirm_hash=c.person.url_hash)
else:
email(c.person.email_address, render('/person/new_person_email.mako'))
return render('/person/thankyou.mako')
else:
return render('/not_allowed.mako')
开发者ID:CarlFK,项目名称:zookeepr,代码行数:28,代码来源:person.py
示例12: _delete
def _delete(self, id):
c.location = Location.find_by_id(id)
meta.Session.delete(c.location)
meta.Session.commit()
h.flash("Location has been deleted.")
redirect_to('index')
开发者ID:CarlFK,项目名称:zookeepr,代码行数:7,代码来源:location.py
示例13: save
def save(self):
up = UserProperty(request.environ['REMOTE_USER'],
self.form_result['nickname'],
int(self.form_result['time_diff']))
self.ups.put_item(up)
redirect_to('now')
开发者ID:masayang,项目名称:pylons_simpledb_openid,代码行数:7,代码来源:clock.py
示例14: _delete
def _delete(self, id):
c.schedule = Schedule.find_by_id(id)
meta.Session.delete(c.schedule)
meta.Session.commit()
h.flash("Schedule has been deleted.")
redirect_to('index')
开发者ID:cafuego,项目名称:zookeepr,代码行数:7,代码来源:schedule.py
示例15: _delete
def _delete(self, id):
c.event = Event.find_by_id(id)
meta.Session.delete(c.event)
meta.Session.commit()
h.flash("Event has been deleted.")
redirect_to('index')
开发者ID:CarlFK,项目名称:zookeepr,代码行数:7,代码来源:event.py
示例16: _review
def _review(self, id):
"""Review a proposal.
"""
c.proposal = Proposal.find_by_id(id)
c.signed_in_person = h.signed_in_person()
c.next_review_id = Proposal.find_next_proposal(c.proposal.id, c.proposal.type.id, c.signed_in_person.id)
# TODO: currently not enough (see TODOs in model/proposal.py)
#if not h.auth.authorized(h.auth.has_organiser_role):
# # You can't review your own proposal
# for person in c.proposal.people:
# if person.id == c.signed_in_person.id:
# h.auth.no_role()
person = c.signed_in_person
if person in [ review.reviewer for review in c.proposal.reviews]:
h.flash('Already reviewed')
return redirect_to(action='review', id=c.next_review_id)
results = self.form_result['review']
review = Review(**results)
meta.Session.add(review)
c.proposal.reviews.append(review)
review.reviewer = person
meta.Session.commit()
if c.next_review_id:
return redirect_to(action='review', id=c.next_review_id)
h.flash("No more papers to review")
return redirect_to(action='review_index')
开发者ID:CarlFK,项目名称:zookeepr,代码行数:35,代码来源:proposal.py
示例17: _delete
def _delete(self, id):
c.special_offer = SpecialOffer.find_by_id(id)
meta.Session.delete(c.special_offer)
meta.Session.commit()
h.flash("Special Offer has been deleted.")
redirect_to('index')
开发者ID:CarlFK,项目名称:zookeepr,代码行数:7,代码来源:special_offer.py
示例18: makecomplaint
def makecomplaint (self):
order = meta.Session.query(model.Order).filter_by(id=self.form_result['id']).first()
if order is None:
abort(404)
if order.deleted:
abort(410)
# Теперь - проверка прав доступа (ответственный подразделения, подавшего эту заявку)
if not (session.has_key('division') and session['division']):
abort(401)
if not (h.have_role('creator') and order.cust_id == session['division']):
abort(403)
complaint = model.Action()
complaint.order_id = order.id
complaint.status = meta.Session.query(model.Status).get(6)
complaint.div_id = session['division']
perf = meta.Session.query(model.Person).get(session['id'])
complaint.performers.append(perf)
# Если претензию подаёт оператор, то и его добавим
if session.has_key("operator_id") and session["id"] != session["operator_id"]:
complaint.performers.append(meta.Session.query(model.Person).get(session["operator_id"]))
complaint.description = self.form_result['description']
meta.Session.add (complaint)
order.status = meta.Session.query(model.Status).get(6)
# Обновляем создателей заявки
if perf not in order.customers:
order.customers.append(perf)
meta.Session.commit()
h.flashmsg (u"Жалоба подана. Всех лишат зарплаты. Дело заявки № " + h.strong(order.id) + u" будет сделано.")
redirect_to(h.url_for(controller='order', action='view', id=order.id))
开发者ID:AmurSU,项目名称:orderman,代码行数:29,代码来源:action.py
示例19: take
def take(self, id=None):
order = h.checkorder(id)
# Теперь - проверка прав доступа (ответственный подразделения, могущего выполнять заявки)
if not (h.have_role("appointer") and order.status_id == 1):
abort(403)
elif h.have_role("guest"):
abort(401)
act = model.Action()
act.order_id = order.id
act.status = meta.Session.query(model.Status).get(2)
act.div_id = session["division"]
# Заполним исполнителей заявки
for pid in self.form_result["performers"]:
perf = meta.Session.query(model.Person).get(pid)
act.performers.append(perf)
order.order_performers.append(model.OrderPerformer(person=perf, current=True))
order.status = meta.Session.query(model.Status).get(2)
order.perf_id = session["division"]
meta.Session.add(act)
# Готово!
meta.Session.commit()
h.flashmsg(
u"Вы взяли заявку № "
+ h.strong(order.id)
+ u" для выполнения себе. Исполнители: %s" % (u", ".join([h.name(x) for x in act.performers]))
)
redirect_to(h.url_for(controller="order", action="view", id=order.id))
开发者ID:AmurSU,项目名称:orderman,代码行数:27,代码来源:order.py
示例20: makethank
def makethank (self):
order = meta.Session.query(model.Order).filter_by(id=self.form_result['id']).first()
if order is None:
abort(404)
if order.deleted:
abort(410)
# Теперь - проверка прав доступа (ответственный подразделения, подавшего эту заявку)
if not (session.has_key('division') and session['division']):
abort(401)
if not (h.have_role('creator') and order.cust_id == session['division']):
abort(403)
thank = model.Action()
thank.order_id = order.id
thank.status = meta.Session.query(model.Status).get(14)
thank.div_id = session['division']
perf = meta.Session.query(model.Person).get(session['id'])
thank.performers.append(perf)
# Если претензию подаёт оператор, то и его добавим
if session.has_key("operator_id") and session["id"] != session["operator_id"]:
thank.performers.append(meta.Session.query(model.Person).get(session["operator_id"]))
thank.description = self.form_result['description']
meta.Session.add (thank)
meta.Session.commit()
h.flashmsg (u"Спасибо за " + h.literal("«") + u"спасибо" + h.literal("»") + "!")
redirect_to(h.url_for(controller='order', action='view', id=order.id))
开发者ID:AmurSU,项目名称:orderman,代码行数:25,代码来源:action.py
注:本文中的pylons.controllers.util.redirect_to函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论