Re: [web2py] Select categories that are in use

2015-03-10 Thread Gael Princivalle
Thank's again Niphlod for the explanation and the solution. Il giorno martedì 10 marzo 2015 21:56:20 UTC+1, Niphlod ha scritto: > > I guess you're in a small "typo hiccup" > > recap without "long table and field names": > > > db(db.what_i_need.id.belongs(db(otherquery)._select(otherfield))).select

[web2py] Re: Running multiple lines of SQL in executesql

2015-03-10 Thread Brian M
Actually just surround your big long multi line SQL statement with triple quotes and it will work fine. I do that all the time. No need for the \ at each line break then either. You can declare and set your @variables all within one executesql query too. On Tuesday, March 10, 2015 at 2:36:28 PM

[web2py] Ajax User Registration

2015-03-10 Thread naveed
I have ajax login working using auth.login_bare, but I can't figure out how to do the same for register. I do see register_bare, but it's probably not what I need. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https:

[web2py] Re: Running multiple lines of SQL in executesql

2015-03-10 Thread naveed
> > Ok, I moved it to a stored procedure and it works. Thanks for your help. >> > It would be nice to be able to run multiple queries in one call - I prefer to keep my code in code, not in the database, but I'm probably asking for too much. -- Resources: - http://web2py.com - http://web2py

Re: [web2py] Re: PKI Authentication? How to grab users certificates httpd > wsgi

2015-03-10 Thread Niphlod
debug it, debug it, debug it. AFAICS, x509_auth.py requires: ssl_client_raw_cert optional ssl_client_serial On Wednesday, March 11, 2015 at 12:04:51 AM UTC+1, LoveWeb2py wrote: > > so I did {{=request.env}} and I can see the SSL DATA certificate in > another app, but for some reason the app tha

[web2py] Re: SQLFORM.grid search with multiple terms

2015-03-10 Thread Ian Holser
I found a previous thread that solved my issue. https://groups.google.com/forum/#!msg/web2py/9_1ECdKHKUo/8OISg7o8OVIJ The search bar does not behave as most users would expect. The ability to type multiple words into the search, but not be considered a valid query is problematic. My changes t

Re: [web2py] Re: PKI Authentication? How to grab users certificates httpd > wsgi

2015-03-10 Thread LoveWeb2py
so I did {{=request.env}} and I can see the SSL DATA certificate in another app, but for some reason the app that requires the data isn't being passed. Going to keep troubleshooting that app because I really want to use the x509 authentication with web2py!! for some reason the x509 auth isn't w

Re: [web2py] Re: PKI Authentication? How to grab users certificates httpd > wsgi

2015-03-10 Thread Niphlod
what if you return somewhere this dict (takes the "SSL*" env variables and prints it) def yourcode(): . debug_values = {} for k, v in request.env.iteritems(): if k.lower().startswith('ssl'): debug_values[k] = v . return dict(., debu

Re: [web2py] Re: how to insert dynamic record id into field in form

2015-03-10 Thread Alex Glaros
that's what I needed to know thanks Niphlod On Tue, Mar 10, 2015 at 2:20 PM, Niphlod wrote: > uhm. there's a hiccup in the process (or at least in what you think should > be the process). > You're using factory(), so you need to handle your own db i/o. > If you want to insert a new record, how

Re: [web2py] Re: PKI Authentication? How to grab users certificates httpd > wsgi

2015-03-10 Thread LoveWeb2py
Thanks Niphlod, I had SSLOptions +stdEnvVars setup, but still no luck. I think that's definitely the problem though (Maybe I'm misplacing them) Hopefully Michele can chyme in. On Tuesday, March 10, 2015 at 5:12:44 PM UTC-4, Niphlod wrote: > > not everyone needs client certificates, so of cours

[web2py] Re: how to insert dynamic record id into field in form

2015-03-10 Thread Niphlod
uhm. there's a hiccup in the process (or at least in what you think should be the process). You're using factory(), so you need to handle your own db i/o. If you want to insert a new record, how can you know in advance its id if you didn't actually insert it into the table ? There is no way aroun

Re: [web2py] Re: PKI Authentication? How to grab users certificates httpd > wsgi

2015-03-10 Thread LoveWeb2py
The main problem is that when I set auth.settings.login_form = X509Auth() as specified in the book I get the error: Login not allowed. No valid x509 credentials. My httpd.conf is exactly out of the book as specified for mod_wsgi http://web2py.com/books/default/chapter/29/13/deployment-recipes

Re: [web2py] Select categories that are in use

2015-03-10 Thread Niphlod
I guess you're in a small "typo hiccup" recap without "long table and field names": db(db.what_i_need.id.belongs(db(otherquery)._select(otherfield))).select(db.what_i_need.field) you can get it rewritten (more understandable) mysubquery = db(otherquery)._select(otherfield) myquerywithbelongs =

[web2py] Re: Running multiple lines of SQL in executesql

2015-03-10 Thread Niphlod
executesql doesn't allow more than one statement per invocation. You'll get the same issues running execute() with the underlying driver. What are you really trying to execute isn't a query: it's more of a stored procedure that returns a set of results. On Tuesday, March 10, 2015 at 8:36:28 PM

Re: [web2py] Select categories that are in use

2015-03-10 Thread Gael Princivalle
Thanks all. Niphlod what a great query. I'm just disappointed about the orderby, it don't have any effect: categories=db(db.news_categories.id.belongs(db(db.news.on_line==True). _select(db.news.category, distinct=True, orderby=db.news.category.name))). select() Do you know why? Il giorno martedì

[web2py] Re: how to insert dynamic record id into field in form

2015-03-10 Thread Niphlod
there's something wrong with the code something = db.table.insert(**mapping) returns the db.table.id that has been inserted. in this piece of code, using messageID.id doesn't really make much sense... On Tuesday, March 10, 2015 at 8:49:05 PM UTC+1, Alex Glaros wrote: > > I want to insert the re

Re: [web2py] Re: PKI Authentication? How to grab users certificates httpd > wsgi

2015-03-10 Thread LoveWeb2py
*httpd* - Apache Hypertext Transfer Protocol Server my httpd.conf has the certificates and is serving https out properly, I just can't seem to read the user certificates when they visit the site. On Tuesday, March 10, 2015 at 3:36:53 PM UTC-4, Richard wrote: > > "This works out of the box with

[web2py] how to insert dynamic record id into field in form

2015-03-10 Thread Alex Glaros
I want to insert the record id into one of its fields during record creation in form right now, using work-around right after the record is created. here is the record being created messageID = db.InternalMessage.insert(**db.InternalMessage._filter_fields( form.vars)) right afterwards, this is

Re: [web2py] Re: PKI Authentication? How to grab users certificates httpd > wsgi

2015-03-10 Thread LoveWeb2py
Is M2Crypto in my wsgi handler? I have the module installed if that's what you mean. On Tuesday, March 10, 2015 at 3:35:17 PM UTC-4, Richard wrote: > > Is M2Crypto there?? > > Basic, but you know... > > On Tue, Mar 10, 2015 at 3:18 PM, LoveWeb2py > wrote: > >> Just the basic stuff like first nam

Re: [web2py] Re: PKI Authentication? How to grab users certificates httpd > wsgi

2015-03-10 Thread Richard Vézina
"This works out of the box with Rocket (the web2py built-in web server) but you may need some extra configuration work on the web server side if you are using a different web server. In particular you need to tell your web server where the certificates are located on local host and that it needs to

Re: [web2py] Re: PKI Authentication? How to grab users certificates httpd > wsgi

2015-03-10 Thread Richard Vézina
Is M2Crypto there?? Basic, but you know... On Tue, Mar 10, 2015 at 3:18 PM, LoveWeb2py wrote: > Just the basic stuff like first name and last name. But when I try to > login using the x509 tutorial in the book I am getting Login not allowed. > No valid x509 credentials. This tells me that my ce

[web2py] Running multiple lines of SQL in executesql

2015-03-10 Thread naveed
I need to execute multiple lines of SQL in web2py, something like this: db.executesql("set @num := 0, @type := '';")\ rows = db.executesql("select type, variety, price\ from (\ select type, variety, price,\ @num := if(@type = type, @num + 1, 1) as row_number,\

[web2py] Re: PKI Authentication? How to grab users certificates httpd > wsgi

2015-03-10 Thread LoveWeb2py
Just the basic stuff like first name and last name. But when I try to login using the x509 tutorial in the book I am getting Login not allowed. No valid x509 credentials. This tells me that my certificate isn't being read properly by web2py or I'm not passing the variables through uwsgi properly

Re: [web2py] SQLFORM Validation and Password Hashes

2015-03-10 Thread Dave S
On Tuesday, March 10, 2015 at 10:44:36 AM UTC-7, horridohobbyist wrote: > > Nobody has any ideas?? Surely, this is a common use case... > > Does it work to make the password field readable=writable=False in the form? If it does, you can probably add a button for "change password" to toggle tho

[web2py] PKI Authentication? How to grab users certificates httpd > wsgi

2015-03-10 Thread LoveWeb2py
Hello, I'm wondering how to get the users details when they visit my site over SSL. I'm guessing I'll have to parse out the information through the WSGI handler? If anyone has insight or could provide direction I'd really appreciate it. -- Resources: - http://web2py.com - http://web2py.com/bo

[web2py] Re: how do I add form attributes to SQLFORM.factory?

2015-03-10 Thread Oliver Holloway
Read part of the book, tried with just FORM. The following worked. score_box = FORM(INPUT(_name='score',requires=IS_NOT_EMPTY(), _style='height:80px; width:80px; font-size:50px;', _autofocus='autofocus', _type='tel', _autocomplete='off'

Re: [web2py] SQLFORM Validation and Password Hashes

2015-03-10 Thread horridohobbyist
Nobody has any ideas?? Surely, this is a common use case... On Tuesday, 10 March 2015 07:41:45 UTC-4, horridohobbyist wrote: > > The table definition is: > > db.define_table('teams', > > Field('team_email',requires=[IS_EMAIL(),IS_NOT_IN_DB(db,'teams.team_email')]), >

Re: [web2py] Re: Compute insert-only

2015-03-10 Thread Anthony
Got it. In that case, compute wouldn't have worked anyway. On Tuesday, March 10, 2015 at 1:09:12 PM UTC-4, Louis Amon wrote: > > My url builder requires the « id » field so _before_insert wouldn’t work. > > That’s a good suggestion though! > > Thanks Anthony :) > > Le 10 mars 2015 à 18:00, Anthony

[web2py] Re: Can we disable moderation in the group?

2015-03-10 Thread Rufus
(Must be those Django fanboys trying to disrupt the site!) On Tuesday, March 10, 2015 at 10:39:46 AM UTC-4, Massimo Di Pierro wrote: > > We only moderate the first post. We get lots of spam. > > On Friday, 6 March 2015 20:12:30 UTC-6, Jack Kuan wrote: >> >> I don't see the need and think it can

[web2py] Re: Compute insert-only

2015-03-10 Thread Anthony
Might be easier with a _before_insert callback, so you can add the new value along with the initial insert instead of after: db.mytable._before_insert.append(lambda fields: fields.update(url=make_url( fields))) Anthony On Tuesday, March 10, 2015 at 12:10:12 PM UTC-4, Niphlod wrote: > > code an

[web2py] Compute insert-only

2015-03-10 Thread Louis Amon
I'm trying to hard-code URLs for SEO purposes so I have a function ("make_url(row)") that builds the paths based on other fields. I was thinking of using "compute=make_url", but it seems that update operations also call the compute. Is there a way to use compute only on INSERT operations, and

[web2py] Re: SQLFORM.grid search with multiple terms

2015-03-10 Thread Massimo Di Pierro
please open a ticket. We need to check this. Can you also post your model? On Monday, 9 March 2015 15:09:23 UTC-5, Ian Holser wrote: > > The search function on SQLFORM grid works fine for single terms, but when > typing multiple terms, it doesn't seem to work. > > For example: > If I have a field

[web2py] Re: Query Production Oracle database using DAL

2015-03-10 Thread Michel Krav
Thanks paolo for the user permission idea. And* cpdb.py* and also *oracle_extract_models.py* will be helpful. -- 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

[web2py] Does not work registration and authorization. What to look for?

2015-03-10 Thread Сергей Петрови
Veb2po launched on the server does not work authorization and registration. More precisely gives this error, break the Internet, could not find an answer ... read the book, did not find an answer ... Traceback (most recent call last): File "C:\sites\tkp-dv.ru\tkts\web2py\gluon\main.py", line 4

[web2py] Re: Check file size before upload process

2015-03-10 Thread William Chen
I believe you can use 'onvalidation' to check the file size before upload. http://web2py.com/books/default/chapter/29/07/forms-and-validators#onvalidation -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.go

[web2py] Re: Can we disable moderation in the group?

2015-03-10 Thread Massimo Di Pierro
We only moderate the first post. We get lots of spam. On Friday, 6 March 2015 20:12:30 UTC-6, Jack Kuan wrote: > > I don't see the need and think it can be off putting for new comers. > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py

[web2py] Invalid reset password (and another issue)

2015-03-10 Thread NeoToren
*Using the scaffolding app (2.9.12), here is the db.py of TEST app:* # For the LOCAL / Development Site: db = DAL('mysql://root:sqlpwd@localhost/TestDB', fake_migrate_all=True) from gluon.tools import Auth auth = Auth(db) auth.define_tables(username=False,signature=False) auth.settings.create_use

[web2py] cannot perform INSERT RETURNING on VIEW

2015-03-10 Thread Val K
Hi! I am falling in love with web2py!!! But I had got a little problem when migrated to 2.9.11-stable+timestamp.2014.09.15.23.35.11. After submit INSERT-form, I had got an error: cannot perform INSERT RETURNING on relation "table_view" HINT: You need an unconditional ON INSERT DO INSTEAD

[web2py] Re: list reference with ondelete=set null breaking when delete parent

2015-03-10 Thread Francisco Costa
Hi Paolo, but how do you find the tables (and records) that use the deleted record as a Foreign Key? I don't know if those records should have the "is_active" set to False, or the Foreign Key set to None On Tuesday, 10 March 2015 07:34:22 UTC, Paolo Valleri wrote: > > ondelete is for reference

Re: [web2py] Select categories that are in use

2015-03-10 Thread Niphlod
2 queries ? no subselect - way, 1 query. db(db.news_categories.id.belongs(db(db.news.id>0)._select(db.news.category, distinct=True))).select() technically, there is also another one, more useful in case you'd like to select, e.g., only categories with at least x news, but that's another s

Re: [web2py] SQLFORM Validation and Password Hashes

2015-03-10 Thread horridohobbyist
The table definition is: db.define_table('teams', Field('team_email',requires=[IS_EMAIL(),IS_NOT_IN_DB(db,'teams.team_email')]), Field('password',requires=[IS_STRONG(upper=2),CRYPT(salt=False)]), Field('team_name',requires=[IS_TEAM_NAME(),IS_NOT_I

Re: [web2py] Select categories that are in use

2015-03-10 Thread Johann Spies
Try this (untested) categories_used = [x.category for x in db().select(db.news.category,orderby=db.news.category))] categories = db(db.news_categories.id.belongs(categories_used).select( db.news_categories.name) Johann On 9 March 2015 at 18:53, Gael Princivalle wrote: > > Hello all. > > I'v

[web2py] Re: IMPORTANT - WEB2PY CONSULTING

2015-03-10 Thread João Saraiva
Hi, Massimo, My company also does web2py consulting and development. The link is http://www.definescope.com/ . web2py itself is mentioned in http://www.definescope.com/en/services/consulting/ and http://www.definescope.com/en/services/software-development/ (I just noticed now that the first pa

[web2py] Re: IMPORTANT - DROPPING SUPPORT FOR PYTHON 2.5?

2015-03-10 Thread weheh
I should be OK. Got my fingers crossed. On Saturday, March 7, 2015 at 11:18:17 AM UTC-8, Massimo Di Pierro wrote: > > Who is opposed? Why? > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2

[web2py] Re: list reference with ondelete=set null breaking when delete parent

2015-03-10 Thread Paolo Valleri
ondelete is for reference field. At a first sight, a possible workaround would be to write your own 'ondelete' by using the _before_delete and _after_delete callbacks Paolo On Monday, March 9, 2015 at 7:09:54 PM UTC+1, Ron Chatterjee wrote: > > Wonder if he can try to make it a list and do list.