No tomorrow. On Wednesday, 15 April 2015 13:10:28 UTC-5, Dave S wrote: > > > > On Tuesday, April 14, 2015 at 2:29:48 PM UTC-7, Niphlod wrote: >> >> being a bug, we need to ship a new web2py. it got fixed already. we're >> waiting for Massimo to release a 2.10.4. >> > > Is that fix included in the nightly builds yet? > > /dps > > >> On Tuesday, April 14, 2015 at 10:51:31 PM UTC+2, wish...@gmail.com wrote: >>> >>> I just discovered, there's already a issue posted.. >>> >>> https://groups.google.com/forum/#!topic/web2py/Tog4tdUl400 >>> https://github.com/web2py/web2py/issues/904 >>> >>> Are there already any solutions yet? >>> >>> Thanks & cheers >>> Toby >>> >>> wish...@gmail.com: >>>> >>>> Hey guys! >>>> >>>> Did 2.10.3-stable+timestamp.2015.04.02.21.42.07 change something in the >>>> way* format statements *%(fields)s are handled? >>>> >>>> When referencing another table, the *format statement now seems to be >>>> ignored*. Instead only the foreign key id is displayed. >>>> >>>> Example >>>> >>>> I have the following lookup table >>>> >>>> db.define_table('countries', >>>> Field('country', 'string'), >>>> Field('the_geom', 'geometry()'), >>>> Field.Virtual('latitude', lambda row: db(db.countries.id == >>>> row.countries.id >>>> ).select(db.countries.centroid.st_y()).first()[db.countries.centroid.st_y()]), >>>> Field.Virtual('longitude', lambda row: db(db.countries.id == >>>> row.countries.id >>>> ).select(db.countries.centroid.st_x()).first()[db.countries.centroid.st_x()]), >>>> * format='%(country)s'*, migrate=True) >>>> >>>> Another table is referencing this lookup table >>>> >>>> db.define_table('uploads', >>>> Field('country',* db.countries*), >>>> Field('uploaded','date'), >>>> ... >>>> migrate=True) >>>> >>>> Now I would like to count the number of uploads per country. >>>> >>>> def count_uploads_by_country(): >>>> import datetime >>>> from datetime import timedelta >>>> count = db.wifi_zone.id.count() >>>> result = db(db.uploads.uploaded > datetime.date.today() - >>>> timedelta(days=7)).select(*db.uploads.country*, count, groupby = >>>> db.uploads.country).render() >>>> return dict(result=result) >>>> >>>> I would expect that a query on the uploads table would display the >>>> country name as specified in the format statement, i.e. >>>> *Country Uploads per Country* >>>> *France* 123 >>>> *Italy *45 >>>> *Germany *10 >>>> >>>> Until recently this worked perfectly, but following the update to >>>> 2.10.3 only the country ids are returned, i.e. >>>> >>>> *Country Uploads per Country**1* <-- foreign id instead of name >>>> *2* <-- 45 >>>> *3* <-- 10 >>>> >>>> db._lastsql shows that the country name isn't even queried: >>>> SELECT uploads.country, COUNT(uploads.id) FROM uploads WHERE >>>> (uploads.last_updated > '2015-04-04') GROUP BY uploads.country; >>>> >>>> Does anybody have a clue, why only the foreign id is displayed, but not >>>> the country name according to the format statement? >>>> >>>> Cheers >>>> Toby >>>> >>>>
-- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.