[web2py] check for record and proceed with index only scan

2014-01-22 Thread Jayadevan M
I am checking for existence of record in a table cond = db.mytable(id=someid) if not cond : do something This works fine. The query executed selects *all* columns and adds LIMIT 1 OFFSET 0; The LIMIT and OFFSET are OK. Since I want to just check for existence of a record, how can I rewrite th

[web2py] Re: running scheduler under a user

2014-01-22 Thread Jayadevan M
Sorry about that. I think the right approach was to have the python stubs to invoke scheduled jobs, under models directory and the modules with python functions, under modules directory. That way I need not worry about a normal portal user attempting to invoke the scheduler jobs. On Tuesday, Ja

[web2py] Apache with mod_wsgi secure/insecure sessions

2014-01-22 Thread Colin Lee
I have set up apache to host the same applications via http and https. When I log on as a user with one protocol, I must always log on with that protocol or I get the following error: Versionweb2py™Version 2.8.2-stable+timestamp.2013.11.28.13.54.07PythonPython > 2.7.3: /usr/bin/python (prefix:

[web2py] pygraphviz library not found

2014-01-22 Thread Bogdan Nechita
Hi, When navigating to the Edit -> Graph Model on any web2py app, I get the error "pygraphviz library not found". I have installed Graphviz (http://www.graphviz.org/Download_windows.php) and PyGraphviz (http://www.lfd.uci.edu/~gohlke/pythonlibs/#pygraphviz) successfully but web2py doesn't seem

[web2py] WebAuth remote_user cookie based authentication

2014-01-22 Thread Kamil
I'm developing a site for my intranet, which already has an established authentication method, WebAuth. I would like to continue using this method as only one login would be required to visit multiple sites on the intranet. I would like to redirect the user to a website (say http://intranet/cg

[web2py] Re: Unable to send email on server in web2py.....

2014-01-22 Thread NeoToren
Hello, I have had the same issue trying to send email using Web2Py server. This is not mere luxury, emails are needed for a robust authentication process which Web2Py offers, IF one can send emails from W2P... Seems the problem is with GMAIL as other have noted before, on this and on other blo

Re: [web2py] check for record and proceed with index only scan

2014-01-22 Thread Johann Spies
cond = db.mytable(id=someid).select(db.mytable.id) Regards Johann On 22 January 2014 10:50, Jayadevan M wrote: > I am checking for existence of record in a table > > cond = db.mytable(id=someid) > if not cond : > do something > > This works fine. The query executed selects *all* columns and

[web2py] Re: Install Web2py on Windows with Apache and Mod WSGI (using command line, *nix flavour)

2014-01-22 Thread 黄祥
done sorry the batch file and exe file can not be attached, here is the script for bat file : @echo off powershell -Command "(New-Object Net.WebClient).DownloadFile('http://nchc.dl.sourceforge.net/project/sevenzip/7-Zip/9.20/7z920.msi', 'C:\7z920.msi')" C:\7z920.msi /quiet /passive powershe

Re: [web2py] check for record and proceed with index only scan

2014-01-22 Thread Johann Spies
Oops. That should be cond = db(db.mytable.id==someid).select(db.mytable.id) On 22 January 2014 13:50, Johann Spies wrote: > cond = db.mytable(id=someid).select(db.mytable.id) > > Regards > Johann > > > On 22 January 2014 10:50, Jayadevan M wrote: > >> I am checking for existence of record in a

Re: [web2py] check for record and proceed with index only scan

2014-01-22 Thread Jayadevan M
I tried that. I get the error - 'Row' object has no attribute 'select' By the way, the "=" works. Additional information, this function is under modules. Do I have to imprt something to make the select construct work? On Wed, Jan 22, 2014 at 5:22 PM, Johann Spies wrote: > Oops. That should be

Re: [web2py] check for record and proceed with index only scan

2014-01-22 Thread Jayadevan M
Sorry. It works (I got something wrong earlier) but the limit has gone away. I just have to ensure that there is ay least one record. On Wed, Jan 22, 2014 at 5:28 PM, Jayadevan M wrote: > I tried that. I get the error - > 'Row' object has no attribute 'select' > By the way, the "=" works. Addi

[web2py] Re: pygraphviz library not found

2014-01-22 Thread Alan Etkin
> When navigating to the Edit -> Graph Model on any web2py app, I get the > error "pygraphviz library not found". > Can you import the library from an interactive session? Maybe you have a path issue, i.e., you are using the built-in python interpreter of a compiled web2py installation without

Re: [web2py] check for record and proceed with index only scan

2014-01-22 Thread Jayadevan M
Here is how it is now .. 1) cond = db.mytable(id=someid) generates SELECT FROM mytable WHERE (id = someid) LIMIT 1 OFFSET 0; 2) cond = db(db.mytable.id==someid).select(db.mytable.id,limitby=(0, 1)) generates SELECT FROM mytable WHERE (id = someid) ORDER BY pk LIMIT 1 OFFSET 0; What I woul

Re: [web2py] check for record and proceed with index only scan

2014-01-22 Thread Anthony
If you want to get rid of the orderby, do: db(db.mytable.id == someid).select(db.mytable.id, limitby=(0, 1),orderby_on_limitby =False) When you specify a limitby, by default it will orderby the PK (or add the PK to the orderby). The reason for this is to ensure a consistent ordering if you rep

Re: [web2py] Re: Unable to send email on server in web2py.....

2014-01-22 Thread Akash Agrawall
Can you explain it in a more brief way. Like where are you hosting the site and which site you are using to send the mail from(like gmail, yahoo or ??) and please fill in the mail settings(in db.py) that you have used to make it work. In my case the case was that the server was from US and gmail ha

[web2py] check if db field is empty

2014-01-22 Thread Yebach
Hello How do I check is database field is empty? eng_out = db(db.script.id == id_skripte).select(db.script.sc_engine_output) print "eng_out ",eng_out ## this returns ##eng_out script.sc_engine_output ## if eng_out is None: ## check for nullability print "field is Nul

[web2py] Re: check if db field is empty

2014-01-22 Thread Yebach
I tryied with eng_out = db(db.script.id == id_skripte).select(db.script.sc_engine_output)[0]['sc_engine_output'] print "eng_out ", eng_out if eng_out is None: print "Ni podatkov" but I am sure there has to be a better way. thanx again -- Resources: - http://web2py.com

[web2py] Re: Install Web2py on Windows with Apache and Mod WSGI (using command line, *nix flavour)

2014-01-22 Thread Willoughby
As a side note, Chocolatey is an attempt at apt-get like functionality in Windows: http://chocolatey.org/ You can even make your own package... -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/

[web2py] How to change SQLFORM values after submission and then show the form again?

2014-01-22 Thread Horst Horst
In my record-update controller, after SQLFORM.validate(), I'd like to programmatically change some of the submitted form values, and then present the form again (with the changed values) for further editing. Imagine a sort of autocomplete of partially filled forms. My controller has the standa

[web2py] Re: check if db field is empty

2014-01-22 Thread Anthony
How about: if db((db.script.id == id_skripte) & (db.script.sc_engine != None)).select (): Anthony On Wednesday, January 22, 2014 9:30:45 AM UTC-5, Yebach wrote: > > I tryied with > > eng_out = db(db.script.id == > id_skripte).select(db.script.sc_engine_output)[0]['sc_engine_output'] > prin

[web2py] simplejson and datetime

2014-01-22 Thread Arnon Marcus
I know there is support for "encoding" datetime objects using the gluon.contrib flavor of simplejson. (at least in the old version of web2py I am using) But I opted for using 'pip install simplejson' as it compiles the latest version for me... So I use that. I don't have issues in encoding, as I

[web2py] Re: Weird problems generating menu from database

2014-01-22 Thread web2pygroup
That works great, thank you!!! My only remaining question is that when I try to edit the first record "main" in the appadmin I get the foreign key error. I read here -> https://groups.google.com/forum/#!topic/web2py/klspqXpha4E <- about how to disable it. Wasn't sure if I should do that or n

[web2py] Re: foreign key reference and "not null" mutually exclusive. by design, or a bug?

2014-01-22 Thread User
I also would like a non-null foreign key reference, but like OP experienced web2py will not create one. Why is this? And is there a workaround to make reference fields not null? Or worst case can I add the not null constraint manually in the db without breaking anything? On Tuesday, June 19

[web2py] Re: Form input prolem

2014-01-22 Thread Lucas Schreiber
Hi, i thought the form worked good, but unfortunally i was wrong. name = form.vars.name contains the data from 'Name', INPUT(_name='name'), but passwords = form.vars.password is always none here again the code, with the improvements: def login(): form = FORM( 'Name', INPUT(_name='name'),

Re: [web2py] Re: foreign key reference and "not null" mutually exclusive. by design, or a bug?

2014-01-22 Thread Richard Vézina
Of cours you can change you db manually with SQL DLL... You can still adjust your web2py model and do fake_migrate=True, migrate=False to get thing in sync... Richard On Wed, Jan 22, 2014 at 1:13 PM, User wrote: > I also would like a non-null foreign key reference, but like OP > experienced w

[web2py] Re: foreign key reference and "not null" mutually exclusive. by design, or a bug?

2014-01-22 Thread Anthony
This is a bug, and an issue has been created. Yes, you should be able to make the change directly in the database. Anthony On Wednesday, January 22, 2014 1:13:30 PM UTC-5, User wrote: > > I also would like a non-null foreign key reference, but like OP > experienced web2py will not create one (I

Re: [web2py] Re: Unable to send email on server in web2py.....

2014-01-22 Thread NeoToren
Not hosting it yet, still building and testing... I have tried to use gmail (I am located in USA) and had encountered same problems you and others did. Since I am not hosted YET, and for testing purposes I needed be able to send email I decided to go with this company I found yesterday... In thi

[web2py] Multiple one-to-many join query help.

2014-01-22 Thread Apple Mason
I have the following tables: db.define_table('person', Field('name', 'string')) db.define_table('pet', Field('name', 'string'), Field('person_id', 'reference person')) db.define_table('thing', Field('name', 'string'), Field('person_id', 'reference person')) I have a person

[web2py] Re: pygraphviz library not found

2014-01-22 Thread Massimo Di Pierro
Are you using the windows web2py binary? You need the source. On Wednesday, 22 January 2014 01:06:06 UTC-6, Bogdan Nechita wrote: > > Hi, > > When navigating to the Edit -> Graph Model on any web2py app, I get the > error "pygraphviz library not found". > I have installed Graphviz (http://www.gra

Re: [web2py] Re: filepaths for library and images ?

2014-01-22 Thread Stef Mientki
thanks, got in not working yet. I also tried the solution suggested in "pass as parameter or import" about an our later, but that didn't worked either. I don't understand the path philosophy of web2py at this moment. e.g. why is this working: and why is this NOT working: while the image

[web2py] Path to static files

2014-01-22 Thread horridohobbyist
I'm trying to do an os.listdir() of the files in 'static', but I can't figure out the correct pathname. Is this documented somewhere? Thanks. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/we

[web2py] Re: Multiple one-to-many join query help.

2014-01-22 Thread Niphlod
I'm guessing you had it wrong db(main_table.filter == something).select( main_table, other_table, left=[other_table.on(main_table.some_id == other_table.reference), ] ) On Wednesday, January 22, 2014 10:24:14 PM UTC+1, Apple Mason wrote: > > > I have the following tables:

Re: [web2py] Re: filepaths for library and images ?

2014-01-22 Thread Anthony
web2py URL are not based on filepaths, with the exception of files in the /static folder. All other URLs are in /app/controller/function/list/of/args format. You cannot access a file in the /uploads folder simply by putting /uploads in the URL. Rather, the URL must point to a controller and fun

[web2py] Re: Path to static files

2014-01-22 Thread Niphlod
os.path.join(request.folder, 'static') the core functionalities are documented here http://web2py.com/books/default/chapter/29/04/the-core On Wednesday, January 22, 2014 10:39:35 PM UTC+1, horridohobbyist wrote: > > I'm trying to do an os.listdir() of the files in 'static', but I can't > figure

[web2py] Re: pygraphviz library not found

2014-01-22 Thread 黄祥
same here, pygraphiz library not found, tested on windows 7 32 bit with web2py_src and web2py_win 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 (Repor

[web2py] error creating table using sql server

2014-01-22 Thread 黄祥
hello folks, is there any adjustment for table when change database connection? i have define table that running fine on postgresql, mysql, sqlite (without any modification when i change database connection), but sadly when tested on sql server it throw me an error *error :* (u'42000', u"[420

[web2py] Re: How to change SQLFORM values after submission and then show the form again?

2014-01-22 Thread Jaime Sempere
I don't understand completely the flow of the process... do you have two submitt buttons, one for "autocomplete" and the other for "final submit? I am not very sure, but here are my thoughts: What I would do is use SQLFORM.factory something like this: new_post_form = SQLFORM.factory(db.po

[web2py] Re: Important New Year News: Edison Award

2014-01-22 Thread Jaime Sempere
Good luck! And glad to hear news like this. I am using again web2py and I am loving it. It was long time ago since I didn't enjoy programming so much. And I think you can see almost everywhere of 'him' the effort of the creators for develope something easy and fast to use. So.. as everyone say

[web2py] Re: How to change SQLFORM values after submission and then show the form again?

2014-01-22 Thread Anthony
I think it will be easier to help if you show some code so we can see exactly what you need to do. On Wednesday, January 22, 2014 9:43:48 AM UTC-5, Horst Horst wrote: > > In my record-update controller, after SQLFORM.validate(), I'd like to > programmatically change some of the submitted form va

[web2py] Re: How to change SQLFORM values after submission and then show the form again?

2014-01-22 Thread Jaime Sempere
Damn... I forgot the link: https://groups.google.com/forum/#!searchin/web2py/prepopulate$20form/web2py/GF2sDS7uWi8/x8SVU09CFIoJ El jueves, 23 de enero de 2014 02:07:19 UTC+1, Jaime Sempere escribió: > > > I don't understand completely the flow of the process... do you have two > submitt butto

Re: [web2py] Re: error ('', 'SQL_INVALID_HANDLE') when DAL is mssq

2014-01-22 Thread Gianganh Nguyen
Oh, I'm sorry because now I'm checking mail. I didn't get that error. But I use driver pyodbc-3.0.7.win32-py2.7.exe for python2.7.5. Are you using what is python's version? On Fri, Jan 17, 2014 at 5:57 AM, Josh Myers wrote: > I was also getting this same error and I thank Gianganh for his help i

[web2py] Re: pygraphviz library not found

2014-01-22 Thread Bogdan Nechita
I started web2py from the source and I added the Graphviz to the PATH and now it works as a charm. Thanks for the quick reply. On Wednesday, January 22, 2014 4:29:47 PM UTC-5, Massimo Di Pierro wrote: > > Are you using the windows web2py binary? You need the source. > > On Wednesday, 22 January

[web2py] Re: pygraphviz library not found

2014-01-22 Thread Bogdan Nechita
Try starting web2py from the source code, as detailed here: http://web2py.com/books/default/chapter/29/04/the-core. I also added Graphviz (C:\Program Files (x86)\Graphviz2.36\bin) to the environment PATH, did a restart and now it works. On Wednesday, January 22, 2014 6:59:05 PM UTC-5, 黄祥 wrote:

[web2py] DAL definition when NOT deployed on localhost ? PythonAnywhere for example...

2014-01-22 Thread NeoToren
I have managed to deploy to *PythonAnywhere* (*PA*) the MySQL database in a matter of minutes! Then I have re-created the Web2Py , uploaded and installed my application from the localhost - literally 5 minutes !! The familiar Web2Py interface was ready like a charm...so the description of PA in

[web2py] Re: pygraphviz library not found

2014-01-22 Thread 黄祥
it's work now, i missed the environment path steps, thank you so much. 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