web2py 2.13.1 is OUT

367 views
Skip to first unread message

Massimo Di Pierro

unread,
Dec 18, 2015, 1:31:38 AM12/18/15
to web2py-users
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

Raul Monares

unread,
Dec 19, 2015, 12:48:38 PM12/19/15
to web2py-users
Excellent !!

Yoel Benitez Fonseca

unread,
Dec 19, 2015, 5:28:00 PM12/19/15
to web...@googlegroups.com
i have upgrade to this version and the are some issues, for example
IS_UPPER validator stopped working...
> --
> 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 web2py+un...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>


--
Yoel Benítez Fonseca
http://redevil.cubava.cu/
$ python -c "import this"

Yoel Benitez Fonseca

unread,
Dec 19, 2015, 5:32:54 PM12/19/15
to web...@googlegroups.com
sorry, in the console it works, its seems to be my problem

Alessio Varalta

unread,
Dec 20, 2015, 4:25:38 AM12/20/15
to web2py-users
Hi, how can I upgrade? There is the possibility to upgrade by console web2py?

Karl Florian

unread,
Dec 21, 2015, 7:24:04 AM12/21/15
to web2py-users
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)

Anthony

unread,
Dec 21, 2015, 8:25:14 AM12/21/15
to web2py-users
Do you mean the records are being inserted/updated without those template values?

Can you attach a minimal app that reproduces the problem?

Anthony

K.H.Florian

unread,
Dec 21, 2015, 8:59:22 AM12/21/15
to web...@googlegroups.com
Hi Anthony,
yes the records are being inserted/updated without the template values!

You could try my app online:

The old web2py version: www.freightlabel.com/demo
The new web2py version: www.freight-sw.com/demo
user: de...@demo.com
passw.: demo
Menu: Assignments/Text-Label
You can blank out the Title Field or change the Text-MC.

I'll see if i can make a minimal app.
Mit freundlichen Grüßen

C.H.Florian

Florian Software
Ferdinand-Abt-Str. 3A
65510 Idstein
Germany
Tel.: 06126/5097041
Internet: www.florian-sw.de
--
You received this message because you are subscribed to a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/hYH5cYoKVAw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.

K.H.Florian

unread,
Dec 21, 2015, 3:39:01 PM12/21/15
to web...@googlegroups.com
Hi Anthony,
here is my minimal app.
Same problem in new version #2.13.1.

Thanks

Mit freundlichen Grüßen

C.H.Florian

Florian Software
Ferdinand-Abt-Str. 3A
65510 Idstein
Germany
Tel.: 06126/5097041
Internet: www.florian-sw.de
Am 21.12.2015 um 14:25 schrieb Anthony:
--
web2py.app.frgtlbl_mini.w2p

K.H.Florian

unread,
Dec 23, 2015, 7:16:20 AM12/23/15
to web...@googlegroups.com
Hi Anthony,
were you able to reproduce the problem i have with the app i sent you?
Do you have any solution for my problem with version 2.13.2-stable+timestamp.2015.12.18.11.00.46 ?
Or should i use version 2.12.3-stable+timestamp.2015.08.19.00.18.03 as i did before ?

regards Karl

I wish everybody a merry christmas an a happy new year!!!!
Mit freundlichen Grüßen

C.H.Florian

Florian Software
Ferdinand-Abt-Str. 3A
65510 Idstein
Germany
Tel.: 06126/5097041
Internet: www.florian-sw.de

Anthony

unread,
Dec 23, 2015, 11:02:18 AM12/23/15
to web2py-users
It's a bug: https://github.com/web2py/web2py/issues/1140

For now, either stick with the older version of web2py, or instead of using onvalidation, manipulate request.post_vars directly before calling form.process.

Also, for future reference, a "minimal" app should ideally be a new app with that absolute minimum amount of code necessary to demonstrate the problem (you can create a dummy db model and a simplified version of all the logic) -- no Auth, special settings, etc. Make it as easy as possible for someone to getting it running and get to the problem without having to wade through lots of irrelevant code.

Anthony
To unsubscribe from this group and all its topics, send an email to web2py+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
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 a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/hYH5cYoKVAw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py+unsubscribe@googlegroups.com.

Andrew Buchan

unread,
Jan 27, 2017, 12:25:07 PM1/27/17
to web2py-users

How does "allow deploying to pythonanywhere from the web2py admin that you're running locally" work...? 

There is no documentation I could find in the book, and the form doesn't say what it might do when I click submit, or where it might put the app (will it overwrite my app with the same name if I click submit?) I nerve-wrackingly went to submit the form, but it failed saying the username already exists - does this mean it even tries to register me? That's quite far out... I'd expect a "deploy to pythonanywhere form" to ask for username, password, path to deploy to, and a checkbox to confirm overwrite if it exists.
And what if the app does already exists? Will it make sure not to overwrite the tables and sessions directories and so on?
Looks like a really useful feature, but there really needs to be a bit more coverage to explain the ins and outs, preferably on the same page as the form itself.

Andrew.

Leonel Câmara

unread,
Jan 27, 2017, 12:55:04 PM1/27/17
to web2py-users
> I nerve-wrackingly went to submit the form, but it failed saying the username already exists - does this mean it even tries to register me?

Yes it does register you for a free pythonanywhere account if you are not registered. This is meant to be a very easy way of getting your project online.

> And what if the app does already exists? Will it make sure not to overwrite the tables and sessions directories and so on?  
  
It does basically the same thing that happens when you deploy using a .w2p file. Yes it will overwrite by default and I have not made the option not to overwrite yet.

For now the databases folder goes too so the tables are overwritten too. The excluded folders are "cache", "sessions" and "errors".

Note that this is exactly the same behavior you get when you create a w2p file of your application in admin and then install the application in pythonanywhere using the admin of a previously installed web2py.  

Andrew Buchan

unread,
Jan 29, 2017, 10:23:23 AM1/29/17
to web2py-users
Thanks for the clarification. It makes sense to to use the same behaviour as a w2p file deploy, though it would be good if it said so somewhere, and also that this should only be used for first time deployments, accidentally point this to an app that already exists and you risk serious migration headaches!!

Leonel Câmara

unread,
Jan 29, 2017, 2:42:41 PM1/29/17
to web2py-users
I guess we could add an option to exclude the databases folder too.
Reply all
Reply to author
Forward
0 new messages