[web2py] cache.action questions (views with db selects, and different views for logged-in users)

2013-10-20 Thread Mark Li
I have 2 questions about cache.action Firstly, I am looking into cache.action to cache several static pages (about, contact, etc), that rarely change content. For users who aren't logged in, the pages would be the same. However, if a user is logged in, then there are links to the users' profile

[web2py] Re: ask response.models_to_run

2013-10-20 Thread Anthony
On Monday, October 21, 2013 12:57:31 AM UTC-4, 黄祥 wrote: > > yes, i redefined db variable in db_wizard_service.py when i put it on the > sub folder service. > please find attached file. > 1. i started from scratch. > 2. on attached file, it can work but the news and service link don't have >

[web2py] new feature in trunk

2013-10-20 Thread Massimo Di Pierro
It is a recurrent problem that is displays tree-like structures like threaded comments. For example: db.define_table('post', Field('parent_id','reference post'), Field('body')) where each comment has a body and a parent_id (parent_id==None for the root comment(s)

[web2py] Re: ask response.models_to_run

2013-10-20 Thread Anthony
Do you happen to re-define your "db" variable in db_wizard_service.py file? That would overwrite the one in db.py, losing any tabled defined there. If that's not it, please pack and attach a minimal app that replicates the problem. Anthony On Sunday, October 20, 2013 6:52:51 PM UTC-4, 黄祥 wrote

[web2py] Re: 2.4.7 problems

2013-10-20 Thread Mark Li
I've just encountered this problem myself, and I opened a ticket about this since I couldn't find one already posted. http://code.google.com/p/web2py/issues/detail?id=1736&thanks=1736&ts=1382314136 -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/we

[web2py] Re: ask response.models_to_run

2013-10-20 Thread 黄祥
yes, i run web2py 2.7.4-stable in windows 7 32 bit. best regards, stifan -- 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 becaus

[web2py] Re: ERROR: pickle data was truncated; db table name error.

2013-10-20 Thread Massimo Di Pierro
Have you tried? remove the databses/._NFobj.table and change db.define_table('NFobj', fake_migrate=True, ) On Sunday, 20 October 2013 15:16:39 UTC-5, Kalvis Bruns wrote: > > I have a problem with my db tables definition. In db.py file there seems > to be a problem with the table with

[web2py] Re: web2py binary contest

2013-10-20 Thread Massimo Di Pierro
Congratulations! On Sunday, 20 October 2013 15:52:23 UTC-5, Brian M wrote: > > WhooHoo! :D And thank you Niphlod for all you contribute to the web2py > community! > > On Sunday, October 20, 2013 2:22:29 PM UTC-5, Niphlod wrote: >> >> @Brian M won the contest. Congrats to him for committing to t

[web2py] Re: Web2Py Hangs on Recaptcha Form Submission

2013-10-20 Thread 黄祥
hm, not sure about the root cause, had you already try the sqlform or crud? e.g. in controllers def contact_us(): from gluon.tools import Recaptcha form = SQLFORM(db.contact_us) form.element('table').insert(-1,TR('',Recaptcha(request, 'PUBLIC', 'PRIVATE', error_message = 'invalid', label = 'Ve

[web2py] Re: ask response.models_to_run

2013-10-20 Thread Anthony
Are you running web2py 2.7.4? There was an error related to models_to_run in prior versions. On Sunday, October 20, 2013 6:41:34 PM UTC-4, 黄祥 wrote: > > > >> if 'news' in request.function: >> response.models_to_run = ['db_wizard_news.py'] >> >> it's work, thanks, anthony, because i start from

[web2py] Re: can i build a ROWS object from scratch?

2013-10-20 Thread Anthony
Try this: rows = Rows(colnames=['controle.redmine'], records=records, db={}) SQLTABLE expects the column names to be in 'tablename.fieldname' format, and it needs at least a dummy "db" object that can be subscripted with keys (so, an empty dictionary will do). Anthony On Sunday, October 20, 2

[web2py] Re: ask response.models_to_run

2013-10-20 Thread 黄祥
> > if 'news' in request.function: > response.models_to_run = ['db_wizard_news.py'] > > it's work, thanks, anthony, because i start from simple to learn how response.models_to run works, but i need to run other models too. i've followed your suggestion to make a folder for each models to ru

[web2py] Re: Custom field name in db().select()

2013-10-20 Thread Anthony
On Sunday, October 20, 2013 3:17:43 PM UTC-4, Niphlod wrote: > calc_field = db.hourlydata.TotalAsh / db.hourlydata.TotalMass > rows = db( db.hourlydata.DevId==1 ).select( db.hourlydata.DevId,calc_field > ) > for row in rows: > print row.DevId, row[calc_field] > > > tl;dr: every expression get

[web2py] Re: can i build a ROWS object from scratch?

2013-10-20 Thread Anthony
I'm sure it can be made to work. You might need to set colnames=['controle.redmine']. Note, {{=rows}} is equivalent to {{=SQLTABLE(rows)}}, so you can look at the SQLTABLE code in gluon.sqlhtml.py to get an idea what needs to be done. Anthony On Sunday, October 20, 2013 3:15:22 PM UTC-4, JaapP

[web2py] Re: web2py binary contest

2013-10-20 Thread Brian M
WhooHoo! :D And thank you Niphlod for all you contribute to the web2py community! On Sunday, October 20, 2013 2:22:29 PM UTC-5, Niphlod wrote: > > @Brian M won the contest. Congrats to him for committing to test out the > recipe and fiddle a little with the source code. > > @everyone else: fee

[web2py] ERROR: pickle data was truncated; db table name error.

2013-10-20 Thread Kalvis Bruns
I have a problem with my db tables definition. In db.py file there seems to be a problem with the table with name "NFCobj". I get the " pickle data was truncated" error If I have the db.define_table command, with table name "NFCobj" like this: #NFCobj table db.define_table('NFCobj', Field(

[web2py] Re: web2py binary contest

2013-10-20 Thread Niphlod
@Brian M won the contest. Congrats to him for committing to test out the recipe and fiddle a little with the source code. @everyone else: feel free to test the recipe...next binary release will be done following those guides. -- Resources: - http://web2py.com - http://web2py.com/book (Documen

[web2py] Re: Custom field name in db().select()

2013-10-20 Thread Niphlod
calc_field = db.hourlydata.TotalAsh / db.hourlydata.TotalMass rows = db( db.hourlydata.DevId==1 ).select( db.hourlydata.DevId, calc_field ) for row in rows: print row.DevId, row[calc_field] tl;dr: every expression gets saved into the row as a field in the _extra dict (see for yourself print

[web2py] Re: can i build a ROWS object from scratch?

2013-10-20 Thread JaapP
Hello Anthony, Your code is working for me! If you want to display the rows from a view with {{=rows}} i still get an error, but i use a custom table builder which takes a rows object as input, and this works just fine. In the end, my mistake was not importing a row object, only a rows object..

[web2py] Custom field name in db().select()

2013-10-20 Thread Sergio R.
Im using adhoc calculated field ( db.hourlydata.TotalAsh / db.hourlydata.TotalMass ) in db().select() statement. rows = db( db.hourlydata.DevId==1 ).select( db.hourlydata.DevId, db.hourlydata.TotalAsh / db.hourlydata.TotalMass ) Is it possible to define custom names for fields in db().select()

[web2py] Upload fields custom_store

2013-10-20 Thread Alan Etkin
Supposing one has a controller like this: def mycustomstore(f, n, p): print "file length", len(f.read()) print "file name", n print "path", p def index(): form = SQLFORM.factory(Field("myupload", "upload", custom_store=mycustomstore)) if form.

[web2py] Re: can i build a ROWS object from scratch?

2013-10-20 Thread Anthony
Not tested, but maybe something like: from gluon.dal import Rows, Row def rowsWithoutDB(): auth=HTTPBasicAuth('username', 'password') r = requests.get("http://myURL/projects.xml";, auth=auth) projects = BeautifulStoneSoup(r.content) records = [Row(dict(redmine=str(project.content

[web2py] can i build a ROWS object from scratch?

2013-10-20 Thread JaapP
Hi All, i've been struggling and googling this problem for may hours, hope someone can give me a hint: i'm trying to create a ROWS object from data i receive from an external webservice. I do not have a corresponding table in the database, and would like to do something like this: *NOT WORKI

[web2py] Re: ask response.models_to_run

2013-10-20 Thread Anthony
You have to run at least one model file in order to set response.models_to_run, so put the models_to_run code in a model file that comes before db_wizard_news.py alphabetically. If you don't need to run any model files after db_wizard_news.py, you can do something like: if 'news' in request.fun

[web2py] Re: Nothing displayed in edit window

2013-10-20 Thread Massimo Di Pierro
The JS files have changed so they must be reloaded. On Sunday, 20 October 2013 06:42:07 UTC-5, SS wrote: > > After logging in as administrator, when I try to edit a file and click > edit button, a window opens and nothing is displayed. The screen shot of > the window is attached, I get nothing

[web2py] Re: Chrome + 10.8 != joy

2013-10-20 Thread davedigerati
I searched in the debug and I couldn't find the definitive yes/no to your question Anthony (still learning debugger tools) and wanting to fix once and for all I simply uninstalled Chrome and reinstalled, and it is working fine. SO- anyone else with a similar problem, there ya go;) On Saturda

[web2py] Re: imap - TypeError: %d format: a number is required, not NoneType

2013-10-20 Thread Alan Etkin
> I think this is a bug. Please create an issue at the project page with your system details. The format issue should be fixed in trunk. BTW: I have also added an enhancement to support imap dbs in appadmin but the patch is pending: https://github.com/web2py/web2py/pull/268 -- Resources: - h

[web2py] Re: Writing a time series monitor, pandas, matplotlib, highcharts...

2013-10-20 Thread Niphlod
first things first: are you sure that highcharts can handle 10*100k points to draw a graph ? As for the storage, you can do anything you like: if the data doesn't change that much, storing into the database will be a long process only on the first time. On the other end, if you need to fetch 100

[web2py] Re: Nothing displayed in edit window

2013-10-20 Thread Niphlod
a simple ctrl+f5 fixes the issue. Won't happen in future releases. On Sunday, October 20, 2013 2:15:34 PM UTC+2, LightDot wrote: > > Similar problems have been reported several times in the past week or so. > Perhaps one of the other threads already has a solution for your issue? > > If not, plea

[web2py] ask response.models_to_run

2013-10-20 Thread 黄祥
hi, i want to use response.models_to_run in my application, my code : *models/db_wizard_news.py* db.define_table('news', Field('title'), Field('contents', 'text'), format = '%(title)s') *controllers/default.py* def news(): if len(request.args): page = int(request.args[0]) else

[web2py] Re: invalid view (default/home.html)

2013-10-20 Thread Anthony
Did you put the view file in /web2py/applications/yourapp/views/default/? On Sunday, October 20, 2013 5:23:30 AM UTC-4, Phawin Khongkhasawan wrote: > > I follow tutorial at > > > http://fragile.org.uk/2013/06/twitter-clone-tutorial-in-web2py-part-2-the-home-page/ > > code in my home/html > > htt

[web2py] Re: Code completion: Do I need to install to install web2py from source?

2013-10-20 Thread LightDot
The content of both repositories is identical. I see a trend towards Github due to the ease of use of pull requests for contributions. For checkouts, Googlecode should be just fine. Contributions in the form of diffs/patches attached to the googlecode issues are accepted too, but this seems to b

[web2py] grid: readable for columns and backgroundcolors for rows

2013-10-20 Thread Martin Weissenboeck
Hi, I have a SQLFORM.grid with details=True. A click on the "details"-ikon (the magnifier) shows another TABLE or SQLFORM. Two problems: (1) I have one column with a lot details, which should not be visible in the grid, but should be visible in the second table/sqlform. (2) I want to have even/

[web2py] Pass upload data to imap table

2013-10-20 Thread Alan Etkin
- How does one retrieve the *Payload of File + File name + Mime type* from the View (HTML Form + Upload type input field) and pass it directly to the Controller's Function (web2py DAL mail-row object)? To extract the filename and payload see the example posted at: http://www.web2pysl

[web2py] Re: Nothing displayed in edit window

2013-10-20 Thread LightDot
Similar problems have been reported several times in the past week or so. Perhaps one of the other threads already has a solution for your issue? If not, please post your web2py version, if you are using Rocket, OS and browser version and anything else that is different then what's reported in

[web2py] Re: skeleton.css

2013-10-20 Thread LightDot
You seem to be following very old instructions. The skeleton.css used to be a part of the welcome application, but it isn't any more. I strongly suggest following a newer how-to or an up to date web2py book. Regards On Sunday, October 20, 2013 12:05:09 PM UTC+2, Hasanov wrote: > > Hi. I am new

[web2py] Re: Code completion: Do I need to install to install web2py from source?

2013-10-20 Thread User
I see web2py seems to have both mercurial and git repositories. I'm more familiar with hg but I can get more familiar with git if need be. Is one preferred over the other? Any pros/cons with respect to web2py? Which is path of least resistance? On Saturday, October 19, 2013 3:13:29 PM UTC

[web2py] web2py and PIL: The _imaging C module is not installed

2013-10-20 Thread lesssugar
I'm trying to use web2py slice to make images thumbnails: http://www.web2pyslices.com/slice/show/1522/generate-a-thumbnail-that-fits-in-a-box The script worked fine with web2py 2.4.7. When upgraded to 2.7.4, when I;m uploading an image, I get this: * File "[path]/PIL/Image.py", line 37, in __ge

[web2py] skeleton.css

2013-10-20 Thread Hasanov
Hi. I am new to web2py. Downloaded and began yesterday. I read that there must be skeleton.css in ../static/css folder, but I have only bootstrap*.css, web2py.css, web2py_bootstrap*.css, calendar.css.. Can anyone axplain me how to solve it? Maybe I am doing something wrong. Thanks.. -- Resour

[web2py] invalid view (default/home.html)

2013-10-20 Thread Phawin Khongkhasawan
I follow tutorial at http://fragile.org.uk/2013/06/twitter-clone-tutorial-in-web2py-part-2-the-home-page/ code in my home/html https://gist.github.com/lifez/7066995 i found error invalid view (default/home.html) -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - h

[web2py] Re: Same menu in two applications.

2013-10-20 Thread Niphlod
do those apps share the same session ? every app in web2py by default doesn't share the session, so if you're logged in in the first, it doesn't mean you're logged in into the other. On Sunday, October 20, 2013 9:38:05 AM UTC+2, Annet wrote: > > I divided my application in two sub-application, on

Re: [web2py] Re: Lets shrink custom forms verbosity

2013-10-20 Thread António Ramos
That is what i was looking for. Thank u massimo. Em 20/10/2013 03:29, "Massimo Di Pierro" escreveu: > How about? > > {{c,w=form.custom,form.custom.widget}} > > {{c.begin}} > {{=w.field1}} > {{=w.field2}} > {{=w.field3}} > {{=w.field4}} > {{c.submit}} > {{c.end}} > > On Saturday, 19 October 2013 1

[web2py] Re: input-xlarge versus span4

2013-10-20 Thread Annet
Hi Simone, I apologize for my late reply, a performance problem is keeping me busy :-( I upgraded from 2.5.1 and I am using: formstyle='bootstrap' Kind regards, Annet -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) -

[web2py] Same menu in two applications.

2013-10-20 Thread Annet
I divided my application in two sub-application, one front-end and a cms. Both application have the same menu. This menu contains the following code: {{if auth.is_logged_in():}} Logout {{else:}} Login {{pass}} In the cms application this link reflects the ri