*Hi,*
*I too upgraded to this Version.*
*My issue is the following controller function worked in the previous
versions but not in this one.*
*The onvalidation def txtlabel_valupd(form): is not filling my
form.vars.titel and form.vars.posting *
*as it did in previous versions!?*
*If form.vars.title is empty the function should get the title and posting
out of the text-template db*
*and fill them into the form fields. But it doesn't.*
*Is there anything wrong with the coding?*
*Or is there a better way of moving the field values out of the
texttemplate (alltext) table*
*into the textlabel (altxtlbl) table ?*
*This is my code and table definitions:*
*def txtlabel_edit():*
def txtlabel_valupd(form):
if len(form.vars.text_mc) >0 and len(form.vars.titel)<=0:
alltxtrec=db(db.alltext.text_mc==form.vars.text_mc).select().first()
if alltxtrec:
form.vars.titel=alltxtrec.titel
form.vars.posting=alltxtrec.posting
def txtlabel_valnew(form):
if len(form.vars.text_mc) >0 and len(form.vars.titel)<=0:
alltxtrecs=db(db.alltext.text_mc==form.vars.text_mc).select()
if alltxtrecs[0]:
form.vars.titel=alltxtrecs[0].titel
form.vars.posting=alltxtrecs[0].posting
db.altxtlbl.text_mc.requires =
IS_EMPTY_OR(IS_IN_DB(db,db.alltext.text_mc,'alltext.description'))
if len(request.args):
session.recstat = 'upd'
req_id=request.args(0)
record = db.altxtlbl(request.args(0))
btn_list = [TAG.button(SPAN(_class="icon-arrow-left glyphicon
glyphicon-arrow-left"),' Back',_type='button', _onClick =
"parent.location='%s' " %
URL('txtlabel_grid')),TAG.button(SPAN(_class="icon-ok glyphicon
glyphicon-ok"),' Submit', _type='submit', _id='submit_btn'),
TAG.button(SPAN(_class="icon-refresh glyphicon glyphicon-refresh"),'
Reset', _type='reset', _onclick='return confirm("Are you sure you want to
reset the form?");', _id='clear_btn'),TAG.button(SPAN(_class="icon-pencil
glyphicon glyphicon-pencil"),' New-Label',_type='button',_onClick =
"parent.location='%s' " % URL('orders', 'txtlabel_edit',
args=[])),TAG.button(SPAN(_class="icon-print glyphicon glyphicon-print"),'
Txt-Label',_type='button',_onClick = "parent.location='%s' " %
URL('print_txtlabel', args=req_id))]
db.altxtlbl.posting.requires = requires=IS_LENGTH(1000,30)
form = SQLFORM(db.altxtlbl,
record,
buttons = btn_list,
formstyle = 'table3cols',
user_signature=True)
form.process(onvalidation=txtlabel_valupd,
session=settings.editsession)
if form.accepted:
response.flash = 'record saved'
redirect(URL('txtlabel_edit', args=form.vars.id))
elif form.errors:
response.flash = 'form has errors'
else:
db.define_table(
'alltext',
Field('text_mc', 'string', length=8, unique=True, label='Text-MC'),
Field('description', 'string', length=50, requires=IS_NOT_EMPTY(),
label='Description'),
Field('titel', 'string', length=50, requires=IS_NOT_EMPTY(),
label='Titel'),
Field('posting', 'text', length=1000, requires=IS_LENGTH(1000,30),
label='Text'),
Field('date_changed', 'datetime', update = request.now, writable =
False, label=T('Modified')),
Field('user_id', 'reference auth_user', update=auth.user and
auth.user.id, writable = False, readable = False),
migrate=settings.migrapp,
redefine=settings.redefin,
format='%(text_mc)s'
)
db.alltext.text_mc.requires = [IS_NOT_IN_DB(db, 'alltext.text_mc'),
IS_UPPER(), IS_LENGTH(minsize=2, maxsize=8)]
db.define_table(
'altxtlbl',
Field('order_date', 'datetime', default = request.now,
label='Order-Date'),
Field('text_mc', 'string', length=8, label='Text-MC'),
Field('titel', 'string', length=50, label='Titel'),
Field('posting', 'text', length=1000, label='Text'),
Field('no_label', 'integer', notnull=True, requires =
IS_INT_IN_RANGE(1, 10000), label='No-of-Label'),
Field('client_mc', 'string', length=8, requires =
IS_IN_DB(db,db.alcustomers.cust_mc,'alcustomers.name1'), label='Client-MC'),
Field('orderdatemc', 'string', length=25, compute=lambda r: '%s%s' %
(r.text_mc,r.order_date), label='Order-MC-Date'),
Field('date_printed', 'datetime', writable = False,
label='Date-Printed'),
Field('date_created', 'datetime', default = request.now, writable =
False, label='Created'),
Field('date_changed', 'datetime', update = request.now, writable =
False, label='Modified'),
Field('user_id', 'reference auth_user', update=auth.user and
auth.user.id, writable = False, readable = False),
migrate=settings.migrapp,
redefine=settings.redefin,
format='%(order_date)s %(text_mc)s'
)
db.altxtlbl.orderdatemc.requires = [IS_NOT_IN_DB(db,
'altxtlbl.orderdatemc')]
db.altxtlbl.titel.requires = requires=IS_LENGTH(50,0)
Am Freitag, 18. Dezember 2015 07:31:38 UTC+1 schrieb Massimo Di Pierro:
> CHANGELOG
>
> ## 2.13.1
>
>
> - fixed oauth2 renew token, thanks dokime7
>
> - fixed add_membership, del_membership, add_membership IntegrityError
> (when auth.enable_record_versioning)
>
> - allow passing unicode to template render
>
> - allow IS_NOT_IN_DB to work with custom primarykey, thanks timmyborg
>
> - allow HttpOnly cookies
>
> - added fabfile.py
>
> - french pluralizaiton rules, thanks Mathieu Clabaut
>
> - fixed bug in redirect to cas service, thanks Fernando González
>
> - allow deploying to pythonanywhere from the web2py admin that you're
> running locally, thanks Leonel
>
> - better tests
>
> - many more bug fixes
>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.