Re: [web2py] is_in_db two tables

2012-04-04 Thread CtrlSoft
> > many thanks > >

[web2py] typo in documentation

2012-04-04 Thread Xabier Bello
At http://web2py.com/books/default/chapter/29/3#A-wiki return db(db.page.title.contains(keyword).select().as_list() should read return db(db.page.title.contains(keyword)).select().as_list()

[web2py] Re: Template efficiency

2012-04-04 Thread Yarin
Interesting. Guess as long as the difference is negligible in a loop, shouldn't be a concern. Thanks Anthony- On Wednesday, April 4, 2012 12:28:32 AM UTC-4, Anthony wrote: > > I do not know for sure in this case. There is an overhead in serializing >> the UL/LI. Would be nice to have some bench

[web2py] Re: web2py reverse proxy for AnnoJ

2012-04-04 Thread Liam
I've managed to get a proxy working using the following function. It's based off a script I found here (https://gist.github.com/284772). The original attempted solution using URL rewriting was abandoned. I expect it to be slow clunky, potentially unsafe and incomplete. Please let me know if any

[web2py] Show the pop up by using the controller

2012-04-04 Thread Sanjeet Kumar
I want to use the pop up on certain conditions through controller

[web2py] Trunk AttributeError when validating SQLFORM.factory

2012-04-04 Thread Alan Etkin
When I submit a form created with .factory(), on validation web2py throws this error: Traceback (most recent call last): File "/home/alan/web2py/web2py-hg/gluon/restricted.py", line 205, in restricted exec ccode in environment File "/home/alan/web2py/web2py-hg/applications/pyodel/contr

[web2py] auth have no key user ????

2012-04-04 Thread bussiere adrien
i truly don't understand it seems to work before at my last commit and now i have a bug : 127.0.0.1.2012-04-04.14-49-48.50c46aad-96a9-4d70-9b67-009e81ed17f0 'User' Traceback (most recent call last): File "gluon/restricted.py", line 205, in restricted File "C:/Users/Bussiere/Dropbox/Pro

[web2py] Re: My website is running lil slow

2012-04-04 Thread Massimo Di Pierro
Try this: - add the web2py toolbar and it will tell you the time of each query {{=response.toolbar()}} - turn on the profiler web2py.py -F profiler_filename.txt it will log useful info at each request On Tuesday, 3 April 2012 23:45:46 UTC-5, Kenny wrote: > > I have some python fetching rows an

[web2py] Re: LinkedIn Integration - my step by step tutorial

2012-04-04 Thread Massimo Di Pierro
Can you please email it to me, possibly as a patch to gluon/contrib/login_methods? On Wednesday, 4 April 2012 00:49:46 UTC-5, Udi Milo wrote: > > It took a while to figure out, but this is my version on how to use > linkedIn in web2py, > comments are much appreciated. (its very detailed and inte

[web2py] Re: Trunk AttributeError when validating SQLFORM.factory

2012-04-04 Thread Massimo Di Pierro
fixed in trunk. Thanks Alan. On Wednesday, 4 April 2012 07:33:28 UTC-5, Alan Etkin wrote: > > When I submit a form created with .factory(), on validation web2py throws > this error: > > Traceback (most recent call last): > File "/home/alan/web2py/web2py-hg/gluon/restricted.py", line 205, in >

[web2py] Re: auth have no key user ????

2012-04-04 Thread Massimo Di Pierro
Not completely sure but auth.environment.session.auth = ... should be session.auth = ... since auth.environment does not exist any more. On Wednesday, 4 April 2012 07:53:50 UTC-5, bussiere adrien wrote: > > i truly don't understand > it seems to work before at my last commit and now i h

[web2py] Re: auth have no key user ????

2012-04-04 Thread bussiere adrien
it's not that i 've corrected but not htat it drives me crazy it worked yesterday : def invitation(): form=FORM("Code Invitation :", INPUT(_name='invitation')," 'User'VERSIONweb2py™(1, 99, 7, datetime.datetime(2012, 3, 4, 22, 12, 8), 'stable')PythonPython 2.5.4: C:\Users\Bussiere\Dropbox\Pr

[web2py] Re: represent in form

2012-04-04 Thread Anthony
Are you talking about the items in the select/options drop-down on forms? If so, that is controlled by the "label" argument (i.e., third argument) to the IS_IN_DB validator specified for the field. If you don't specify any validators for a given reference field and the referenced table includes

[web2py] Re: Show the pop up by using the controller

2012-04-04 Thread weheh
I think you will have to provide a little more detail ... On Wednesday, April 4, 2012 8:32:15 PM UTC+8, Sanjeet Kumar wrote: > > I want to use the pop up on certain conditions through controller

[web2py] run a controller function from the command line - SEND ARGUMENTS!!!

2012-04-04 Thread António Ramos
hello i have this command line python web2py -S app/controller/function -M It works ok Now i want ( I NEED!) to pass arguments to mu "function" How to? thank you António

[web2py] Re: run a controller function from the command line - SEND ARGUMENTS!!!

2012-04-04 Thread Massimo Di Pierro
web2py.py -S app -M -N -R script.py -A args1 args2 ... On Wednesday, 4 April 2012 08:55:52 UTC-5, Ramos wrote: > > hello i have this command line > > python web2py -S app/controller/function -M > It works ok > > Now i want ( I NEED!) to pass arguments to mu "function" > > How to? > > thank you >

[web2py] Re: Ajax Problem

2012-04-04 Thread weheh
Indeed, if I had looked a little harder I would have seen this to be true, Massimo.

Re: [web2py] Re: run a controller function from the command line - SEND ARGUMENTS!!!

2012-04-04 Thread António Ramos
my index def index(temp='None'): ... python web2py.py -S myapp/default/index -M -A does not send aaa to index function Index function temp variable has None and not Thank you António 2012/4/4 Massimo Di Pierro > web2py.py -S app -M -N -R script.py -A args1 args2 ... > > > On Wed

Re: [web2py] Re: run a controller function from the command line - SEND ARGUMENTS!!!

2012-04-04 Thread António Ramos
i changed to another function "reload", so i can open my index in the browser executing python web2py.py -S myapp/default/reload -M -A i get the error reload() takes exactly 1 argument (0 given) Thank you António Em 4 de abril de 2012 16:31, António Ramos escreveu: > my index > > def i

Re: [web2py] Re: run a controller function from the command line - SEND ARGUMENTS!!!

2012-04-04 Thread Anthony
On Wednesday, April 4, 2012 12:16:46 PM UTC-4, Ramos wrote: > > i changed to another function "reload", so i can open my index in the > browser > > executing python web2py.py -S myapp/default/reload -M -A > > i get the error > reload() takes exactly 1 argument (0 given) > What exactly are

Re: [web2py] Re: run a controller function from the command line - SEND ARGUMENTS!!!

2012-04-04 Thread António Ramos
I have a PBX in linux that can call scripts in python I´m trying to call a script in my web2py app and pass some vars. i have a script in python that in the end calls another script os.system("python /../../web2py.py -S app/default/reload/ -M -A arg1") Thank you António 2012/4/4 Anthony >

[web2py] Need some help with a simple case of routing

2012-04-04 Thread Cliff
In my application, "localhost:8000" should go to the welcome app. Any request with a subdomain, such as "dc.localhost:8000" should go to the operations app. I try this, but it raises syntax errors at startup: routes_in = ( ("localhost:8000", '/welcome'), ('.*\.localhost:8000', '/operati

[web2py] Re: Need some help with a simple case of routing

2012-04-04 Thread pbreit
I'm not sure if it's the problem but the slashes don't look right. I would have expected something more like: routes_in = ( ("localhost:8000", '/welcome'), ('*.localhost:8000', '/operations') ) routes_out = ( ('/welcome', r"//localhost:8000"), ('/operations', '*.localhost:8000') )

[web2py] regarding record fetching from database

2012-04-04 Thread Sonu Srivastava
i have a table in database and i want to fetch record one by one randomly from database on form...every record is shown on form with radio button and when user select one of them and click on submit button then next record will be shown on the form... so..please help me for this code...

[web2py] Re: regarding record fetching from database

2012-04-04 Thread Anthony
Not quite sure I understand, but to select a single record at random: record = db(db.mytable).select(limitby=(0, 1), orderby='').first() To create an update form for a record, you can then do: form = SQLFORM(db.mytable, record) Anthony On Wednesday, April 4, 2012 2:10:52 PM UTC-4, Sonu Srivast

Re: [web2py] Re: run a controller function from the command line - SEND ARGUMENTS!!!

2012-04-04 Thread Massimo Di Pierro
You should really not do it this way. The reload function is not a controller and therefore does not belong there. If should go in a module. You should import it from there and call it from where you need it. On Wednesday, 4 April 2012 11:39:53 UTC-5, Ramos wrote: > > I have a PBX in linux that

[web2py] matplotlib + web2py question

2012-04-04 Thread dancer`
Hello, I'm on the newer end of programming, and web2py has been my first (and very happy) foray into web application development. I am developing an application to remotely control two spectrum analyzers (HP 3562A) in our lab to do swept sine and power spectra plots. The connection is made usin

[web2py] Re: Need some help with a simple case of routing

2012-04-04 Thread Cliff
Thanks for the reply - Still not working. On Wednesday, April 4, 2012 2:05:53 PM UTC-4, pbreit wrote: > > I'm not sure if it's the problem but the slashes don't look right. I would > have expected something more like: > > routes_in = ( > ("localhost:8000", '/welcome'), > ('*.localhost:8

[web2py] computed field question

2012-04-04 Thread Richard
Hello, I notice that in the book the example shown don't define a field type for compute. In that case web2py default seems to create a char var (512) type field. I had no problem with this for storing the computation of decimal result. It also works well if I define a proper field type, in my

[web2py] Re: DataTables Help needed

2012-04-04 Thread Anthony
Could be an issue with DataTables -- you might consider asking on their user forum. Anthony On Wednesday, April 4, 2012 12:50:33 PM UTC-4, greenpoise wrote: > > Anthony, > > I first get an error. Then the select dropdown picks the values with some > additional characters and when I make a selec

Re: [web2py] Re: My website is running lil slow

2012-04-04 Thread Kenny Chung
Thank you. On Apr 4, 2012 6:16 AM, "Massimo Di Pierro" wrote: > Try this: > > - add the web2py toolbar and it will tell you the time of each query > {{=response.toolbar()}} > - turn on the profiler > web2py.py -F profiler_filename.txt > it will log useful info at each request > > On Tuesday, 3 A

[web2py] Re: Need some help with a simple case of routing

2012-04-04 Thread Anthony
Have you tried the parameter-based rewrite system? It supports domain routing -- maybe it works for subdomains as well -- see http://web2py.com/books/default/chapter/29/4#Parameter-based-system. Not sure subdomains will work on localhost without some configuration, though. Anthony On Wednesda

[web2py] Re: matplotlib + web2py question

2012-04-04 Thread Massimo Di Pierro
Makes perfect sense. When you use matplotlib you can do: You can store the image in temp file: import tempfile f = tempfile.NamedTemporaryFile() canvas = FigureCanvas(figure) canvas.print_png(f) filename = f.name f.close() then move it to the db in a field called for e

[web2py] Re: matplotlib + web2py question

2012-04-04 Thread dancer`
Thank you very much. One more thing - if I understand correctly this allows me to keep my data buffer clean and not worry about overwriting plots. Is it possible to use a date/time unique naming format to automatically name the image files and store them, say, in the static folder? Or somewher

[web2py] Re: matplotlib + web2py question

2012-04-04 Thread Massimo Di Pierro
The code I posted will create a temp file, them move it to uploads (not static) using db.table.file.store(...) The store function will create a new unique and secure filename in upoads. If you have no future plans to add access control to these files, than you can put them in static. In that ca

[web2py] Re: DAL and schema

2012-04-04 Thread Wuwei
Massimo, I think it is very simple to support schemas: you should simply allow a . (dot) in table name. So that we can define a table like this: db.define_table('myschema.mytable', Field(), ...) This syntax now raises an exception: SyntaxError: only [0-9a-zA-Z_] allowed in table and field nam

[web2py] create global variable

2012-04-04 Thread Richard
Hello, I use to build dict in models, I do that mainly because I want those dict to be usable everywhere I want without thinking about them. Those dict are often id/fieldvalue that I use for custom representation where I can't rely on web2py built-in represent mechanism or translation purpose s

Re: [web2py] Re: data source configuration

2012-04-04 Thread Alex
each app is running in an own instance with an own webserver and of course an own URL. But I cannot distinguish by the URL because this does not work for cron jobs. I think the solution with reading a properties file and caching is fine for me. Still, I think this feature is necessary for almos

Re: [web2py] Re: data source configuration

2012-04-04 Thread Anthony
Do you have a proposal for how web2py should do this? On Wednesday, April 4, 2012 6:23:11 PM UTC-4, Alex wrote: > > each app is running in an own instance with an own webserver and of course > an own URL. But I cannot distinguish by the URL because this does not work > for cron jobs. > > I think

[web2py] Re: DAL and schema

2012-04-04 Thread Massimo Di Pierro
Can a query involve tables from different schemas? Massimo On Wednesday, 4 April 2012 16:46:30 UTC-5, Wuwei wrote: > > Massimo, > I think it is very simple to support schemas: you should simply allow a . > (dot) in table name. > So that we can define a table like this: > db.define_table('myschem

Re: [web2py] Prevent mobile rendering on iPad/Tablets

2012-04-04 Thread Naveed Ahmed
I worked around it using this: {{is_mobile=request.user_agent().is_mobile and not request.user_agent().is_tablet}} in layout.html Naveed From: Anthony Sent: Tuesday, April 03, 2012 08.45 To: web2py@googlegroups.com Subject: Re: [web2py] Prevent mobile rendering on iPad/Tablets Any future

[web2py] Re: Eclipse and autocomplete

2012-04-04 Thread Anthony
Does it work if you do the following at the top of model and controller files (requires latest web2py version): if 0: from gluon import * If you've got db and auth objects, you could also add: from gluon.tools import Auth db = DAL() auth = Auth(db) Anthony On Tuesday, April

Re: [web2py] Prevent mobile rendering on iPad/Tablets

2012-04-04 Thread Anthony
Oops, forgot we already had is_tablet defined -- I think we should change layout.html as you have done below. Anthony On Wednesday, April 4, 2012 7:18:28 PM UTC-4, naveed wrote: > > I worked around it using this: > > {{is_mobile=request.user_agent().is_mobile and not > request.user_agent().

Re: [web2py] create global variable

2012-04-04 Thread pbreit
I would think caching would do just about exactly what you want. How frequently does the data change?

[web2py] DAL select() on "id" field returns Row functions

2012-04-04 Thread Aaron
I've defined a table in my models file with the usual db.define_table method/syntax, omitting my auto_increment id field (since web2py adds this automatically). However, when I perform a select on my table, I get very different results depending on whether I include the id field in my list of fi

[web2py] Re: DAL select() on "id" field returns Row functions

2012-04-04 Thread Anthony
> > I've defined a table in my models file with the usual db.define_table > method/syntax, omitting my auto_increment id field (since web2py adds this > automatically). > However, when I perform a select on my table, I get very different results > depending on whether I include the id field in

[web2py] Putting two Storage objects together (ie, the results of 2 different queries)

2012-04-04 Thread pbreit
Is there an easy way to conjoin two Storage objects (or dicts) together based on matching keys in each? I have the results of two queries and I'd like to combine the sets into one. Of course I should probably creating a query that does that but I haven't. I'm also contemplating some NoSQL appro

[web2py] Re: Putting two Storage objects together (ie, the results of 2 different queries)

2012-04-04 Thread Massimo Di Pierro
a = Storage() b = Storage() a.update(b) should work, a storage is a dict and has a dict.update method. On Wednesday, 4 April 2012 20:11:12 UTC-5, pbreit wrote: > > Is there an easy way to conjoin two Storage objects (or dicts) together > based on matching keys in each? > > I have the res

[web2py] Re: Show the pop up by using the controller

2012-04-04 Thread Vineet
>From the view, call controller function function via web2py's built-in ajax function and use eval argument (by using eval, the javascript code from controller will be executed). web2py's docs explain this nicely. In controller, return javascript code for pop-up. HTH Vineet On Wednesday, Apri

Re: [web2py] create global variable

2012-04-04 Thread Vineet
Why not to use session storage object? It is available globally. If you are using a dict such as -- {k1:v1, k2:v2}, you might consider using -- session.k1=v1, session.k2=v2 --Vineet On Thursday, April 5, 2012 3:40:09 AM UTC+5:30, Richard wrote: > > Hello, > > I use to build dict in models, I do

[web2py] Re: DAL and schema

2012-04-04 Thread spyker
On Thursday, 5 April 2012 01:17:48 UTC+2, Massimo Di Pierro wrote: > > Can a query involve tables from different schemas? > > Yes. This query works in Postgresql: select * from toets.wiesdaar left join public.akb_authors on (surname = van) where surname is not null Regards Johann

[web2py] Re: Putting two Storage objects together (ie, the results of 2 different queries)

2012-04-04 Thread pbreit
Sorry I wasn't clear. The two dicts are dissimilar (ie, different tables).