Are we ready to launch 1.99.1?

177 views
Skip to first unread message

Massimo Di Pierro

unread,
Sep 19, 2011, 11:00:26 PM9/19/11
to web2py-users
Please download the nightly built and try it with your apps. If they
work, say go and I we will launch tomorrow.

Massimo

David Marko

unread,
Sep 20, 2011, 3:55:24 AM9/20/11
to web...@googlegroups.com
Many features have been added recently(last 3 months) but documentation is behind these. Can docs can be updated, without this many features  will be lost somewhere in code. Also as Python is not staticly typed language and doesnt use variable type declaration its very often dificult to understand it without  comments in code or docs.

e.g.
Here is an example of method signature for SQLFORM.grid. It toook me some time to find out the format for fields parameter. I tried ['id','name','age'], then ['db.person.id','db.person.name', 'db-person.age'], then (db.person.id, db.person.name ...) and the latest worked :-) but its just guesswork. And there are many other parameters in this method. 

 def grid(query,
             fields=None,
             field_id=None,
             left=None,
             headers={},
             columns=None,
             orderby=None,
             searchable=True,
             sortable=True,
             paginate=20,
             deletable=True,
             editable=True,
             details=True,
             selectable=None,
             create=True,
             csv=True,
             links=None,
             upload = '<default>',
             args=[],
             user_signature = True,
             maxtextlengths={},
             maxtextlength=20,
             onvalidation=None,
             oncreate=None,
             onupdate=None, 
             ondelete=None,
             sorter_icons=('[^]','[v]'),
             ui = 'jquery-ui',
             _class="web2py_grid",             
             formname='web2py_grid',
            ):

Michele Comitini

unread,
Sep 20, 2011, 4:11:24 AM9/20/11
to web...@googlegroups.com
Massimo,

While I download...
Are the download files signed and/or hashed? just in case...

mic

2011/9/20 Massimo Di Pierro <massimo....@gmail.com>:

ron_m

unread,
Sep 20, 2011, 4:18:33 AM9/20/11
to web...@googlegroups.com
Ran application I am working on no problems.

The welcome application seems to pull in some adware. Firebug opens in Firefox with a problem loading sm6.html saying _gat is not defined. I believe this is coming from the Share item in the top menu.

The jQuery team has released 1.6.4 to fix a bug introduced in 1.6.3 which I have not seen yet, I believe it manifests on IE. The version in trunk is 1.6.3 still.

Ron

Martin Weissenboeck

unread,
Sep 20, 2011, 5:01:46 AM9/20/11
to web...@googlegroups.com
I wanted to play with other login methods. Therefore I created a new application called "alt_login" - it started with no problems.

Next step: I copied the definition of my own "auth_table" from the book into alt_login.
Here are the lines of code:

from gluon.tools import Auth, Crud, Service, PluginManager, prettydate
auth = Auth(db, hmac_key=Auth.get_or_create_key())
crud, service, plugins = Crud(db), Service(), PluginManager()

# copied from the book:
db.define_table(
    auth.settings.table_user_name,
    Field('first_name', length=128, default=''),
    Field('last_name', length=128, default=''),
    Field('email', length=128, default='', unique=True),
    Field('password', 'password', length=512,
          readable=False, label='Password'),
    Field('registration_key', length=512,
          writable=False, readable=False, default=''),
    Field('reset_password_key', length=512,
          writable=False, readable=False, default=''),
    Field('registration_id', length=512,
          writable=False, readable=False, default=''))   

auth_table.first_name.requires = \
  IS_NOT_EMPTY(error_message=auth.messages.is_empty)
auth_table.last_name.requires = \
  IS_NOT_EMPTY(error_message=auth.messages.is_empty)
auth_table.password.requires = [IS_STRONG(), CRYPT()]
auth_table.email.requires = [
  IS_EMAIL(error_message=auth.messages.invalid_email),
  IS_NOT_IN_DB(db, auth_table.email)]
auth.settings.table_user = auth_table
# end of copy


## create all tables needed by auth if not custom tables
auth.define_tables()


Result: a ticket with


Traceback (most recent call last):
File "/etc/web2py/gluon/restricted.py", line 194, in restricted
exec ccode in environment
File "/etc/web2py/applications/alt_login/models/db.py", line 56, in <module>
IS_NOT_EMPTY(error_message=auth.messages.is_empty)
NameError: name 'auth_table' is not defined

I have tried it without the line "auth.define_tables()" - same result.
Any ideas?
Regards, Martin

Martin Weissenboeck

unread,
Sep 20, 2011, 5:54:08 AM9/20/11
to web...@googlegroups.com
I forgot: it's Version 1.99.0 (2011-09-20 03:52:08)

2011/9/20 Martin Weissenboeck <mwei...@gmail.com>

I wanted to play with other login methods. Therefore I created a new application called "alt_login" - it started with no problems.

Next step: I copied the definition of my own "auth_table" from the book into alt_login.
Here are the lines of code:

...

Ross Peoples

unread,
Sep 20, 2011, 7:52:59 AM9/20/11
to web...@googlegroups.com, mar...@weissenboeck.at
You should be using "db.auth_table", not just "auth_table"

Ross Peoples

unread,
Sep 20, 2011, 7:54:02 AM9/20/11
to web...@googlegroups.com, mar...@weissenboeck.at
Actually, sorry, it should be "db.auth_user". Where did you get the "auth_table" variable from anyways?

Martin Weissenboeck

unread,
Sep 20, 2011, 8:29:04 AM9/20/11
to web...@googlegroups.com
copy and paste from the book.  :-)
Chapter "Custimizing Auth"

2011/9/20 Ross Peoples <ross.p...@gmail.com>

Ross Peoples

unread,
Sep 20, 2011, 8:39:45 AM9/20/11
to web...@googlegroups.com, mar...@weissenboeck.at
The actual code from the book:

db.define_table(
auth.settings.table_user_name,
Field('first_name', length=128, default=''),
Field('last_name', length=128, default=''),
Field('email', length=128, default='', unique=True),
Field('password', 'password', length=512,
readable=False, label='Password'),
Field('registration_key', length=512,
writable=False, readable=False, default=''),
Field('reset_password_key', length=512,
writable=False, readable=False, default=''),
Field('registration_id', length=512,
writable=False, readable=False, default=''))

custom_auth_table = db[auth.settings.table_user_name] # get the custom_auth_table
custom_auth_table.first_name.requires = \
IS_NOT_EMPTY(error_message=auth.messages.is_empty)
custom_auth_table.last_name.requires = \
IS_NOT_EMPTY(error_message=auth.messages.is_empty)
custom_auth_table.password.requires = [IS_STRONG(), CRYPT()]
custom_auth_table.email.requires = [
IS_EMAIL(error_message=auth.messages.invalid_email),
IS_NOT_IN_DB(db, custom_auth_table.email)]

auth.settings.table_user = custom_auth_table # tell auth to use custom_auth_table

# before
# auth.define_tables()

You forgot this line which creates and assigns a reference to custom_auth_table:

custom_auth_table = db[auth.settings.table_user_name] # get the custom_auth_table

Anthony

unread,
Sep 20, 2011, 9:23:41 AM9/20/11
to web...@googlegroups.com
+1 for more comments in the code. Also, sometimes comments/docstrings need to be updated when changes are made.

Furqan Rauf

unread,
Sep 20, 2011, 10:00:00 AM9/20/11
to web...@googlegroups.com
so is there anyone who is in charge of updating the book? Massimo is already doing too much?
--
-Furqan Rauf
Do you love your creator? Love your fellow-beings first. -Prophet Muhammad

Richard Vézina

unread,
Sep 20, 2011, 10:00:43 AM9/20/11
to web...@googlegroups.com
It seems like it's the most stable release that's coming ;-)

Richard

Martin Weissenboeck

unread,
Sep 20, 2011, 11:27:36 AM9/20/11
to web...@googlegroups.com
Thank you - now it works.
But: maybe there are two versions of THE BOOK?

Five minutes ago I have found the following code in the online version (chapter "Customizing Auth"):

# after
# auth = Auth(globals(),db)


db.define_table(
   auth.settings.table_user_name,
Field('first_name', length=128, default=''),
Field('last_name', length=128, default=''),
Field('email', length=128, default='', unique=True),
Field('password', 'password', length=512,
   readable=False, label='Password'),
Field('registration_key', length=512,
   writable=False, readable=False, default=''),
Field('reset_password_key', length=512,
   writable=False, readable=False, default=''),
Field('registration_id', length=512,
   writable=False, readable=False, default=''))

auth_table.first_name.requires = \
   IS_NOT_EMPTY(error_message=auth.messages.is_empty)
auth_table.last_name.requires = \
   IS_NOT_EMPTY(error_message=auth.messages.is_empty)
auth_table.password.requires = [IS_STRONG(), CRYPT()]
auth_table.email.requires = [
   IS_EMAIL(error_message=auth.messages.invalid_email),
   IS_NOT_IN_DB(db, auth_table.email)]
auth.settings.table_user = auth_table

# before
# auth.define_tables()


Where did you find "your" code?
Martin

Anthony

unread,
Sep 20, 2011, 11:38:14 AM9/20/11
to web...@googlegroups.com, mar...@weissenboeck.at
Here's what I see at http://web2py.com/book/default/chapter/08#Customizing-Auth (screenshot attached) -- not the same as what you have pasted below.

What URL are you accessing?

Anthony
customizing_auth.png

Ross Peoples

unread,
Sep 20, 2011, 11:47:11 AM9/20/11
to web...@googlegroups.com, mar...@weissenboeck.at

Anthony

unread,
Sep 20, 2011, 11:51:32 AM9/20/11
to web...@googlegroups.com, mar...@weissenboeck.at
Weird, I see different code when visiting that link. Are you looking at the English version?

Martin Weissenboeck

unread,
Sep 20, 2011, 12:10:45 PM9/20/11
to web...@googlegroups.com
My link is http://www.web2py.com/book/default/chapter/08#Customizing-Auth (it is the same!) I have tried twice with two different browsers.



2011/9/20 Anthony <abas...@gmail.com>

Massimo Di Pierro

unread,
Sep 20, 2011, 12:28:57 PM9/20/11
to web2py-users
Yes. There are different versions depending on the accept_language
browser settings. Problem is that non-english one that have not been
translated default to engllish.
The title should tell you which one you are looking at.

On Sep 20, 11:10 am, Martin Weissenboeck <mweis...@gmail.com> wrote:
> My link ishttp://www.web2py.com/book/default/chapter/08#Customizing-Auth(it
> is the same!) I have tried twice with two different browsers.
>
> 2011/9/20 Anthony <abasta...@gmail.com>

Martin Weissenboeck

unread,
Sep 20, 2011, 12:28:48 PM9/20/11
to web...@googlegroups.com
That is the headline of the first page:

The Official (3rd Ed.)
web2py Book(de)

Does "de" mean "German"? But there is no German word inside this book. 
And I cann't find any way to change the language.



2011/9/20 Anthony <abas...@gmail.com>

Martin Weissenboeck

unread,
Sep 20, 2011, 12:53:24 PM9/20/11
to web...@googlegroups.com
That is the answer. Now I switched to "en" and I can see the actual version of this example.

2011/9/20 Massimo Di Pierro <massimo....@gmail.com>
Yes. There are different versions depending on the accept_language

Anthony

unread,
Sep 20, 2011, 2:10:34 PM9/20/11
to web...@googlegroups.com, mar...@weissenboeck.at
On Tuesday, September 20, 2011 12:28:48 PM UTC-4, mweissen wrote:
That is the headline of the first page:

The Official (3rd Ed.)
web2py Book(de)

Does "de" mean "German"? But there is no German word inside this book. 
And I cann't find any way to change the language.

A number of people have been reporting odd problems with the online book and language settings. I and others were randomly be shown the book with French text (even though the title said "web2py Book(en)"). Now you have the German version of the book, but with English text. What's going on?

Anthony

Massimo Di Pierro

unread,
Sep 20, 2011, 2:27:49 PM9/20/11
to web2py-users

At some point we made the book multi-language. That means that the
book detects the language from accept_language and uses that. 8
languages were created (en, es, de, fr, pt, jp, cz, it) and pre
populated with english (official 3rd ed, except for it pre populated
with italian) to easy translation. People did not check their browser
settings and the language (stated at the top of the book) and have
edited the different languages. This is a recent problem (less than
1mo). I have now frozen all translations and they will stay frozen
until I process the 4th edition. I will diff everything to make sure
no edit gets lost.

Massimo

juanduke

unread,
Sep 20, 2011, 2:29:08 PM9/20/11
to web...@googlegroups.com
Some weeks ago, I reported here some typo related with validators. Someone tell me that the typo has been corrected, but when I check again the book, the typo still there.

PS: And I see Book (es) but fully english lang

HTH

Bye, and sorry for my bad english

Bruno Rocha

unread,
Sep 20, 2011, 3:56:19 PM9/20/11
to web...@googlegroups.com
On Tue, Sep 20, 2011 at 12:00 AM, Massimo Di Pierro <massimo....@gmail.com> wrote:
Please download the nightly built and try it with your apps. If they
work, say go and I we will launch tomorrow.

I ran in to this:


Traceback (most recent call last
):
File "/home/rochacbruno/projects/199test/gluon/restricted.py", line 194, in restricted
exec ccode in environment
File "/home/rochacbruno/projects/199test/applications/rifaapp/controllers/default.py", line 755, in <module>
File "/home/rochacbruno/projects/199test/gluon/globals.py", line 148, in <lambda>
self._caller = lambda f: f()
File "/home/rochacbruno/projects/199test/applications/rifaapp/controllers/default.py", line 618, in user
return dict(form=auth())
File "/home/rochacbruno/projects/199test/gluon/tools.py", line 1125, in __call__
return getattr(self,args[0])()
File "/home/rochacbruno/projects/199test/gluon/tools.py", line 1868, in register
next = replace_id(next, form)
File "/home/rochacbruno/projects/199test/gluon/tools.py", line 74, in replace_id
if url and not url[0] == '/' and url[:4] != 'http':
NameError: global name 'url' is not defined 

Bruno Rocha

unread,
Sep 20, 2011, 4:00:13 PM9/20/11
to web...@googlegroups.com
Teh same in another app


return dict(form=auth())
File "/home/rochacbruno/projects/199test/gluon/tools.py", line 1125, in __call__
return getattr(self,args[0
])()
File "/home/rochacbruno/projects/199test/gluon/tools.py", line 1724, in login

Carlos

unread,
Sep 20, 2011, 4:10:24 PM9/20/11
to web...@googlegroups.com

Anthony

unread,
Sep 20, 2011, 4:16:11 PM9/20/11
to web...@googlegroups.com
On Tuesday, September 20, 2011 2:29:08 PM UTC-4, juanduke wrote:
Some weeks ago, I reported here some typo related with validators. Someone tell me that the typo has been corrected, but when I check again the book, the typo still there.

Yes, the typos have been fixed in the markmin but are not showing up because of the problems Massimo mentioned. Hopefully this will all be resolved soon.

Anthony

Massimo Di Pierro

unread,
Sep 20, 2011, 4:26:38 PM9/20/11
to web2py-users
This is a commit error. Will fix in a few hours when I will have
access to my dev machine again. Sorry.

On Sep 20, 2:56 pm, Bruno Rocha <rochacbr...@gmail.com> wrote:
> On Tue, Sep 20, 2011 at 12:00 AM, Massimo Di Pierro <
>
> massimo.dipie...@gmail.com> wrote:
> > Please download the nightly built and try it with your apps. If they
> > work, say go and I we will launch tomorrow.
>
> I ran in to this:
>
> Traceback (most recent call last):
>
>   File "/home/rochacbruno/projects/199test/gluon/restricted.py", line
> 194, in restricted
>
>     exec ccode in environment
>
>   File "/home/rochacbruno/projects/199test/applications/rifaapp/controllers/defaul t.py"
> <http://127.0.0.1:8001/admin/default/edit/rifaapp/controllers/default.py>,
> line 755, in <module>
>
>   File "/home/rochacbruno/projects/199test/gluon/globals.py", line
> 148, in <lambda>
>
>     self._caller = lambda f: f()
>
>   File "/home/rochacbruno/projects/199test/applications/rifaapp/controllers/defaul t.py"
> <http://127.0.0.1:8001/admin/default/edit/rifaapp/controllers/default.py>,

kasapo

unread,
Sep 20, 2011, 5:24:35 PM9/20/11
to web2py-users
Yes, sometimes when I do google searches it seems to find the code i
search for in the french version (since the code is still english...
like searching for "response.vars" or something), but there is a
variable "?_language=fr" in the URL.

After accessing a page (creating a session?) with the 'fr' param for
language, I find that visiting web2py.com/book renders the whole book
in french, until I manually type _language=en back into the address
bar.

That switches it back to english.


On Sep 20, 1:10 pm, Anthony <abasta...@gmail.com> wrote:

Martin Weissenboeck

unread,
Sep 21, 2011, 12:13:12 AM9/21/11
to web...@googlegroups.com
In gloun/tools there is the definition of class Recaptcha.
It contains a class variable
self.comment = ''
but there is no way to change by a parameter. Is it intended or is it a bug?

Martin

nick name

unread,
Sep 21, 2011, 2:04:56 PM9/21/11
to web...@googlegroups.com
I've just done an hg pull -u:

changeset:   2435:8cbfa1244549
tag:         tip
user:        mdip...@massimo-di-pierros-macbook-2.local
date:        Wed Sep 21 00:17:23 2011 -0500
summary:     sys.exit(0), thanks Praneeth

The "README" file mentions request.utcnow, but the code doesn't. So either the README needs a fix, or some patch was lost along the way.

guruyaya

unread,
Sep 21, 2011, 2:29:27 PM9/21/11
to web2py-users
I've just D/L vcms to try. It works well on 1.98.2, but not throws an
exception on the home page. Here's the ticket details:

Traceback (most recent call last):
File "/home/guruyaya/web2py/gluon/restricted.py", line 194, in
restricted
exec ccode in environment
File "/home/guruyaya/web2py/applications/blog/controllers/
default.py", line 294, in <module>
File "/home/guruyaya/web2py/gluon/globals.py", line 148, in <lambda>
self._caller = lambda f: f()
File "/home/guruyaya/web2py/applications/blog/controllers/
default.py", line 15, in index
all_articles = db().select(db.article.ALL,
orderby=~db.article.date|~db.article.modified)
File "/home/guruyaya/web2py/gluon/dal.py", line 5697, in select
return self.db._adapter.select(self.query,fields,attributes)
File "/home/guruyaya/web2py/gluon/dal.py", line 1233, in select
rows = response(sql)
File "/home/guruyaya/web2py/gluon/dal.py", line 1223, in response
self.execute(sql)
File "/home/guruyaya/web2py/gluon/dal.py", line 1309, in execute
return self.log_execute(*a, **b)
File "/home/guruyaya/web2py/gluon/dal.py", line 1304, in log_execute
ret = self.cursor.execute(*a,**b)
File "/usr/lib/python2.7/sqlite3/dbapi2.py", line 66, in
convert_timestamp
datepart, timepart = val.split(" ")
ValueError: need more than 1 value to unpack

I'll give it a deeper look later.


On Sep 21, 9:04 pm, nick name <i.like.privacy....@gmail.com> wrote:
> I've just done an hg pull -u:
>
> changeset:   2435:8cbfa1244549
> tag:         tip
> user:        mdipie...@massimo-di-pierros-macbook-2.local

guruyaya

unread,
Sep 21, 2011, 4:16:07 PM9/21/11
to web2py-users
This is what I got. No fix, for now.
Say you have a datetime field. The database adapter will save it as a
TIMESTAMP sqlite type.
Now if you decide you just want the date, you don't care for the time.
You change the field to be a date col. But SQLite still use the
TIMESTAMP field type. At this point, it converts timestamp to date, as
part of what the python sqlite adapter tells it to do, and that line
has a bug, that creates the ValueError.

I have no idea how 1.98.2 can go around this. It seems more an sqlite
bug, then a web2py bug. Yet - the problem remains.
Hope someone will have a better idea what's going on here.

nick name

unread,
Sep 21, 2011, 4:29:48 PM9/21/11
to web...@googlegroups.com


On Wednesday, September 21, 2011 4:16:07 PM UTC-4, guruyaya wrote:
This is what I got. No fix, for now.
Say you have a datetime field. The database adapter will save it as a
TIMESTAMP sqlite type.
Now if you decide you just want the date, you don't care for the time.
You change the field to be a date col. But SQLite still use the
TIMESTAMP field type. At this point, it converts timestamp to date, as
part of what the python sqlite adapter tells it to do, and that line
has a bug, that creates the ValueError.

I have no idea how 1.98.2 can go around this. It seems more an sqlite
bug, then a web2py bug. Yet - the problem remains.
Hope someone will have a better idea what's going on here.

This is the result of a change I was pushing for, which makes sqlite behave more like every other database - by asking it to parse the date or timestamp field itself, rather than return a string.

Your database itself is in a actually in an inconsistent state -- if you dumped it to .csv and reloaded, you will not get the same database; if you tried to dump and reload into Postgres, you wouid fail. The previous web2py behavior somehow shielded you from that, but that's sort of a lucky coincidence for you; If you changed the column type from a 'decimal' to an 'int' and had float values, you'd be in the same trouble; or even worse if you changed from a 'string' to an 'int'.

Massimo might back the change out, but if he does not, you can force a return to sqlite's previous behaviour by changing from

db = DAL('sqlite:....')

to

db = DAL('sqlite:...', driver_args={'detect_types': 0}}

Either way, I would think it's a good idea for you to make the database consistent -- things like this tend to byte in more than one way.
Reply all
Reply to author
Forward
0 new messages