本文整理汇总了Python中turbogears.flash函数的典型用法代码示例。如果您正苦于以下问题:Python flash函数的具体用法?Python flash怎么用?Python flash使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了flash函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: delete
def delete(self, id):
"""Destroy record in model"""
r = validate_get(id)
curso_id = r.cursoID
r.destroySelf()
flash(_(u'El %s fue eliminado permanentemente.') % name)
raise redirect('../list/%s' % curso_id)
开发者ID:sercom,项目名称:sercom,代码行数:7,代码来源:__init__.py
示例2: remove
def remove(self, **kw):
item = ConfigItem.by_id(kw['id'])
item.set(None, None, identity.current.user)
session.add(item)
session.flush()
flash(_(u"%s cleared") % item.description)
raise redirect(".")
开发者ID:beaker-project,项目名称:beaker,代码行数:7,代码来源:configuration.py
示例3: anular
def anular(self, entregaid):
e = validate_get_entrega(entregaid)
e.inicio = e.fin = datetime.now()
e.exito = 0
e.observaciones = u'La entrega fue anulada por %s' % identity.current.user.shortrepr()
flash(_(u'Se anuló la entrega %s' % e.shortrepr()))
raise redirect('/entregas/statistics')
开发者ID:sercom,项目名称:sercom,代码行数:7,代码来源:__init__.py
示例4: reject
def reject(self, person_name):
'''Reject a user's FPCA.
This method will remove a user from the FPCA group and any other groups
that they are in that require the FPCA. It is used when a person has
to fulfill some more legal requirements before having a valid FPCA.
Arguments
:person_name: Name of the person to reject.
'''
show = {}
show['show_postal_address'] = config.get('show_postal_address')
exc = None
user = People.by_username(turbogears.identity.current.user_name)
if not is_admin(user):
# Only admins can use this
turbogears.flash(_('You are not allowed to reject FPCAs.'))
exc = 'NotAuthorized'
else:
# Unapprove the cla and all dependent groups
person = People.by_username(person_name)
for role in person.roles:
if self._cla_dependent(role.group):
role.role_status = 'unapproved'
try:
session.flush()
except SQLError, error:
turbogears.flash(_('Error removing cla and dependent groups' \
' for %(person)s\n Error was: %(error)s') %
{'person': person_name, 'error': str(error)})
exc = 'sqlalchemy.SQLError'
开发者ID:ccoss,项目名称:fas,代码行数:31,代码来源:fpca.py
示例5: members
def members(self, groupname, search=u'a*', role_type=None,
order_by='username'):
'''View group'''
sort_map = { 'username': 'people_1.username',
'creation': 'person_roles_creation',
'approval': 'person_roles_approval',
'role_status': 'person_roles_role_status',
'role_type': 'person_roles_role_type',
'sponsor': 'people_2.username',
}
if not isinstance(search, unicode) and isinstance(search, basestring):
search = unicode(search, 'utf-8', 'replace')
re_search = search.translate({ord(u'*'): ur'%'}).lower()
username = turbogears.identity.current.user_name
person = People.by_username(username)
group = Groups.by_name(groupname)
if not can_view_group(person, group):
turbogears.flash(_("You cannot view '%s'") % group.name)
turbogears.redirect('/group/list')
return dict()
# return all members of this group that fit the search criteria
members = PersonRoles.query.join('group').join('member', aliased=True).filter(
People.username.like(re_search)
).outerjoin('sponsor', aliased=True).filter(
Groups.name==groupname,
).order_by(sort_map[order_by])
if role_type:
members = members.filter(PersonRoles.role_type==role_type)
group.json_props = {'PersonRoles': ['member']}
return dict(group=group, members=members, search=search)
开发者ID:chepioq,项目名称:fas,代码行数:34,代码来源:group.py
示例6: can_apply_group
def can_apply_group(person, group, applicant):
'''Check whether the user can apply applicant to the group.
:arg person: People object or username to test whether they can apply an
applicant
:arg group: Group object to apply to
:arg applicant: People object for the person to be added to the group.
:returns: True if the user can apply applicant to the group otherwise False
'''
# User must satisfy all dependencies to join.
# This is bypassed for people already in the group and for the
# owner of the group (when they initially make it).
prerequisite = group.prerequisite
# TODO: Make this raise more useful info.
if prerequisite:
if prerequisite not in applicant.approved_memberships:
turbogears.flash(_(
'%s membership required before application to this group is allowed'
) % prerequisite.name)
return False
# group sponsors can apply anybody.
if can_sponsor_group(person, group):
return True
# TODO: We can implement invite-only groups here instead.
if group.group_type not in ('system',) and ( \
(isinstance(person, basestring) and person == applicant.username) \
or (person == applicant)):
return True
return False
开发者ID:Affix,项目名称:fas,代码行数:32,代码来源:auth.py
示例7: install_options
def install_options(self, distro_tree_id, **kwargs):
try:
distro_tree = DistroTree.by_id(distro_tree_id)
except NoResultFound:
flash(_(u'Invalid distro tree id %s') % distro_tree_id)
redirect('.')
if 'ks_meta' in kwargs:
distro_tree.activity.append(DistroTreeActivity(
user=identity.current.user, service=u'WEBUI',
action=u'Changed', field_name=u'InstallOption:ks_meta',
old_value=distro_tree.ks_meta,
new_value=kwargs['ks_meta']))
distro_tree.ks_meta = kwargs['ks_meta']
if 'kernel_options' in kwargs:
distro_tree.activity.append(DistroTreeActivity(
user=identity.current.user, service=u'WEBUI',
action=u'Changed', field_name=u'InstallOption:kernel_options',
old_value=distro_tree.kernel_options,
new_value=kwargs['kernel_options']))
distro_tree.kernel_options = kwargs['kernel_options']
if 'kernel_options_post' in kwargs:
distro_tree.activity.append(DistroTreeActivity(
user=identity.current.user, service=u'WEBUI',
action=u'Changed', field_name=u'InstallOption:kernel_options_post',
old_value=distro_tree.kernel_options_post,
new_value=kwargs['kernel_options_post']))
distro_tree.kernel_options_post = kwargs['kernel_options_post']
flash(_(u'Updated install options'))
redirect(str(distro_tree.id))
开发者ID:sibiaoluo,项目名称:beaker,代码行数:29,代码来源:distrotrees.py
示例8: reviseShipTo
def reviseShipTo(self,**kw):
try:
s = VendorShipToInfo.get(id=kw["header_ids"])
except:
flash("The Ship To doesn't exist!")
return dict(obj = s,
vendor_id = kw["vendor_id"])
开发者ID:LamCiuLoeng,项目名称:bossini,代码行数:7,代码来源:Vendor.py
示例9: saveAddress
def saveAddress(self,**kw):
try:
params = {}
fields = ["billTo","address","contact","tel","fax","needVAT","needInvoice","flag"]
for f in fields :
if f == 'flag':
params[f] = int(kw.get(f,0))
else:
params[f] = kw.get(f,None)
v = params["vendor"] = Vendor.get(kw["vendor_id"])
history = v.history
if "update_type" in kw:
va = VendorBillToInfo.get(kw["bill_id"])
va.set(**params)
hisContent = "Update Vendor %s Address %s information in master" % (v.vendorCode,va.billTo)
his = updateHistory(actionUser=identity.current.user,actionKind="Update Vendor Bill To Info",actionContent=hisContent)
v.set(history="%s|%s" %(his.id,history) )
else:
va = VendorBillToInfo(**params)
hisContent = "Add Vendor bill TO %s for vendor %s" % (va.billTo,v.vendorCode)
his = updateHistory(actionUser=identity.current.user,actionKind="Add New Vendor Bill To Info",actionContent=hisContent)
v.set(history= "%s|%s" %(his.id,history) if history else "%s|" %(his.id))
except:
traceback.print_exc()
flash("Save the Bill To information successfully!")
raise redirect("/vendor/review?id=%s" %kw["vendor_id"])
开发者ID:LamCiuLoeng,项目名称:bossini,代码行数:28,代码来源:Vendor.py
示例10: reviseBillTo
def reviseBillTo(self,**kw):
try:
h = VendorBillToInfo.get(id=kw['header_ids'])
except:
flash("The Bill To doesn't exist!")
return dict(obj=h,
vendor_id = kw["vendor_id"],)
开发者ID:LamCiuLoeng,项目名称:bossini,代码行数:7,代码来源:Vendor.py
示例11: sendinvite
def sendinvite(self, groupname, target):
username = turbogears.identity.current.user_name
person = People.by_username(username)
group = Groups.by_name(groupname)
if is_approved(person, group):
invite_subject = _('Come join The Fedora Project!')
invite_text = _('''
%(user)s <%(email)s> has invited you to join the Fedora
Project! We are a community of users and developers who produce a
complete operating system from entirely free and open source software
(FOSS). %(user)s thinks that you have knowledge and skills
that make you a great fit for the Fedora community, and that you might
be interested in contributing.
How could you team up with the Fedora community to use and develop your
skills? Check out http://fedoraproject.org/join-fedora for some ideas.
Our community is more than just software developers -- we also have a
place for you whether you're an artist, a web site builder, a writer, or
a people person. You'll grow and learn as you work on a team with other
very smart and talented people.
Fedora and FOSS are changing the world -- come be a part of it!''') % \
{'user': person.username, 'email': person.email}
send_mail(target, invite_subject, invite_text)
turbogears.flash(_('Message sent to: %s') % target)
turbogears.redirect('/group/view/%s' % group.name)
else:
turbogears.flash(_("You are not in the '%s' group.") % group.name)
person = person.filter_private()
return dict(target=target, person=person, group=group)
开发者ID:ccoss,项目名称:fas,代码行数:34,代码来源:group.py
示例12: agregar
def agregar(self, **kw):
usuario = model.User(**kw)
usuario.flush()
flash("Se ha agregado el usuario")
return self.default(usuario.id)
开发者ID:SpectralAngel,项目名称:Recibos,代码行数:7,代码来源:usuario.py
示例13: eliminar
def eliminar(self, usuario):
usuario = model.User.get(usuario)
nombre = usuario.display_name
usuario.delete()
flash("Se ha eliminado el usuario %s" % nombre)
return self.index()
开发者ID:SpectralAngel,项目名称:Recibos,代码行数:7,代码来源:usuario.py
示例14: doRegister
def doRegister(self, username, display_name, password1, password2, email_address):
username = str(username)
email_address = str(email_address)
redirect_to_register = lambda:redirect("/register", {"username":username, "display_name":display_name, "email_address":email_address})
try:
User.by_user_name(username)
except sqlobject.SQLObjectNotFound:
pass
else:
turbogears.flash("Error:User %s Already Exists"%username)
raise redirect_to_register()
try:
User.by_email_address(email_address)
except sqlobject.SQLObjectNotFound:
pass
else:
turbogears.flash("Error:Email-Address %s Already Exists"%username)
raise redirect_to_register()
#create user
user = User(user_name=username, email_address=email_address, display_name=str(display_name), password=str(password1))
#add user to user group
user.addGroup(Group.by_group_name("user"))
raise redirect("/")
开发者ID:squallsama,项目名称:mirrormanager-rfremix,代码行数:29,代码来源:controllers.py
示例15: index
def index(self, search=None, tg_errors=None, *args, **kw):
if tg_errors:
flash(tg_errors)
if search:
raise redirect('/search/%s' % search)
return dict(form=search_form, values={}, action=url('/search/'),
title='Search Updates')
开发者ID:docent-net,项目名称:bodhi,代码行数:7,代码来源:search.py
示例16: delete_job_page
def delete_job_page(self, t_id):
try:
self._delete_job(t_id)
flash(_(u'Succesfully deleted %s' % t_id))
except (BeakerException, TypeError), e:
flash(_(u'Unable to delete %s' % t_id))
redirect('.')
开发者ID:sibiaoluo,项目名称:beaker,代码行数:7,代码来源:jobs.py
示例17: eliminar
def eliminar(self, beneficiario):
beneficiario = model.Beneficiario.get(beneficiario)
seguro = beneficiario.seguro
beneficiario.delete()
flash('Se ha eliminado el beneficiario')
raise redirect('/seguro/{0}'.format(seguro.id))
开发者ID:SpectralAngel,项目名称:Egresos,代码行数:7,代码来源:seguro.py
示例18: edit_osmajor
def edit_osmajor(self, id=None, *args, **kw):
try:
osmajor = OSMajor.by_id(id)
except InvalidRequestError:
flash(_(u"Invalid OSMajor ID %s" % id))
redirect(".")
return dict(title="OSMajor", value=osmajor, form=self.osmajor_form, action="./save_osmajor", options=None)
开发者ID:sibiaoluo,项目名称:beaker,代码行数:7,代码来源:osversion.py
示例19: remove
def remove(self, id, *args, **kw):
try:
labcontroller = LabController.by_id(id)
labcontroller.removed = datetime.utcnow()
systems = System.query.filter_by(lab_controller_id=id).values(System.id)
for system_id in systems:
sys_activity = SystemActivity(identity.current.user, 'WEBUI', \
'Changed', 'lab_controller', labcontroller.fqdn,
None, system_id=system_id[0])
system_table.update().where(system_table.c.lab_controller_id == id).\
values(lab_controller_id=None).execute()
watchdogs = Watchdog.by_status(labcontroller=labcontroller,
status='active')
for w in watchdogs:
w.recipe.recipeset.job.cancel(msg='LabController %s has been deleted' % labcontroller.fqdn)
for lca in labcontroller._distro_trees:
lca.distro_tree.activity.append(DistroTreeActivity(
user=identity.current.user, service=u'WEBUI',
action=u'Removed', field_name=u'lab_controller_assocs',
old_value=u'%s %s' % (lca.lab_controller, lca.url),
new_value=None))
session.delete(lca)
labcontroller.disabled = True
LabControllerActivity(identity.current.user, 'WEBUI',
'Changed', 'Disabled', unicode(False), unicode(True),
lab_controller_id=id)
LabControllerActivity(identity.current.user, 'WEBUI',
'Changed', 'Removed', unicode(False), unicode(True),
lab_controller_id=id)
session.commit()
finally:
session.close()
flash( _(u"%s removed") % labcontroller.fqdn )
raise redirect(".")
开发者ID:sibiaoluo,项目名称:beaker,代码行数:35,代码来源:labcontroller.py
示例20: corregir
def corregir(self, afiliado, asamblea, departamento, banco, cuenta,
municipio, telefono):
afiliado = model.Affiliate.get(afiliado)
asamblea = model.Asamblea.get(asamblea)
departamento = model.Departamento.get(departamento)
afiliado.departamento = departamento
afiliado.municipio = model.Municipio.get(municipio)
log(identity.current.user,
u"Inscrito afiliado {0} en asamblea {1}".format(
afiliado.id,
asamblea.id), afiliado)
banco = model.Banco.get(banco)
afiliado.banco = banco.id
afiliado.cuenta = cuenta
afiliado.phone = telefono
kw = {'afiliado': afiliado, 'asamblea': asamblea,
'viatico': model.Viatico.selectBy(asamblea=asamblea,
municipio=afiliado.municipio
).limit(1).getOne()}
model.Inscripcion(**kw)
flash(inscripcionRealizada(afiliado))
raise redirect('/asamblea/inscripcion/{0}'.format(asamblea.id))
开发者ID:SpectralAngel,项目名称:TurboAffiliate,代码行数:28,代码来源:asamblea.py
注:本文中的turbogears.flash函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论