[web2py] Re: new experimental feature in trunk - rows.join(...)

2017-03-09 Thread Jurgis Pralgauskis
What is more efficient on relational DB (for ex., postgre): join(..) or group_by_val(..) rows = db(db.person).select().join(db.thing.owner, name="owns", fields=[ db.thing.id, db.thing.name]) vs rows = db(db.person).select( db.person.All, db.thing.id, db.thing.name, join=[

Re: [web2py] Re: Unpickling error

2017-03-09 Thread Dave S
On Thursday, March 9, 2017 at 4:59:03 AM UTC-8, Maurice Waka wrote: > > Sorry. I discovered that my database was corrupted > > That's too bad, but if the data is backed up it's at least a relatively straightforward recovery. Good luck! /dps > On Mar 6, 2017 23:20, "Jordan Myers"

[web2py] Re: KeyError ticket when I request a CSV/TSV in a grid with a Virtual Field

2017-03-09 Thread Dave S
On Tuesday, March 7, 2017 at 6:10:01 PM UTC-8, Marcelo Huerta wrote: > > Running 2.14.6-stable+timestamp.2016.05.10.00.21.47 on Ubuntu and Windows > 7, python 2.7 > > When I try to generate a CSV or TSV from a grid with a Virtual Field, I > get a ticket with a KeyError. > > Can you show us

[web2py] Re: how to display field names and values within for loop?

2017-03-09 Thread Alex Glaros
Will your example provide both field name and field value? am reveiving error CONTROLLER: supRows = db(db.Organization.id == 1).select() {{#returns locals}} VIEW: {{for record in supRows:}} {{=record.field}} {{pass}} Error ticket for "ES3"Ticket ID

Re: [web2py] Re: Query auth_user over first and last names in one query

2017-03-09 Thread Jim Steil
That is possible. Jim On Mar 9, 2017 6:39 PM, "Anthony" wrote: > On Thursday, March 9, 2017 at 5:08:56 PM UTC-5, Jim S wrote: >> >> queries = [db.auth_user.id > 0] >> queries.append("%s LIKE '%%%s%%'" % (db._adapter.CONCAT('first_name', ' >> ', 'last_name'), searchText)

[web2py] Re: how to display field names and values within for loop?

2017-03-09 Thread Dave S
On Thursday, March 9, 2017 at 4:09:46 PM UTC-8, Alex Glaros wrote: > > I'd like to display column names and values vertically > > is there any way to write as expressed in this psudo code? > > {{for f in db.someTableRecord:}} > {{=f}} {{=value_of_the_field}} > {{pass}} > > (To save

[web2py] Re: how to display field names and values within for loop?

2017-03-09 Thread Alex Glaros
also, is there a way to 1. leave out the table name and just display field name 2. use the field label name instead of the raw/real field name? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) -

Re: [web2py] Re: Query auth_user over first and last names in one query

2017-03-09 Thread Anthony
On Thursday, March 9, 2017 at 5:08:56 PM UTC-5, Jim S wrote: > > queries = [db.auth_user.id > 0] > queries.append("%s LIKE '%%%s%%'" % (db._adapter.CONCAT('first_name', ' ', > 'last_name'), searchText) > I guess you must have pulled a more recent version version of web2py from Github (i.e.,

[web2py] how to display field names and values within for loop?

2017-03-09 Thread Alex Glaros
I'd like to display column names and values vertically is there any way to write as expressed in this psudo code? {{for f in db.someTableRecord:}} {{=f}} {{=value_of_the_field}} {{pass}} thanks Alex Glaros -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) -

[web2py] Re: Query auth_user over first and last names in one query

2017-03-09 Thread isi_jca
Jim: In the next expression query = db((db.auth_user == name) or (db.auth_user == lastname)).select() Replace "or" by "|" (pipe) query = db((db.auth_user == name) | (db.auth_user == lastname)).select() Regards. El miércoles, 8 de marzo de 2017, 1:00:04 (UTC-3), Jim S escribió: > > Hi > > I

Re: [web2py] Re: Query auth_user over first and last names in one query

2017-03-09 Thread Jim Steil
queries = [db.auth_user.id > 0] queries.append("%s LIKE '%%%s%%'" % (db._adapter.CONCAT('first_name', ' ', 'last_name'), searchText) query = reduce(lambda a, b: (a & b), queries) -Jim On Thu, Mar 9, 2017 at 4:03 PM, Anthony wrote: > I meant what was the code that produced

Re: [web2py] Re: Query auth_user over first and last names in one query

2017-03-09 Thread Anthony
I meant what was the code that produced that CONCAT exception? -- 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

Re: [web2py] Re: Query auth_user over first and last names in one query

2017-03-09 Thread Richard Vézina
You may need also to make some cleansing for multiple white spaces with replace before your final split and add some logic for middle name and add further where clause condition... where_clauses = [] where_clauses.append((db[request.args(0)].fieldname <= request.vars.input_entry)) query =

Re: [web2py] Re: Query auth_user over first and last names in one query

2017-03-09 Thread Richard Vézina
single_input_first_last_name.split(' ')[0] single_input_first_last_name.split(' ')[1] can workin case your user input first and last name in a proper order or you search both first and last name 4 times if you don't know in which order you get them with OR ('|') you will get everythings out you

Re: [web2py] Re: Query auth_user over first and last names in one query

2017-03-09 Thread Jim Steil
Here is my version info: web2py Web Framework Created by Massimo Di Pierro, Copyright 2007-2017 Version 2.14.6-stable+timestamp.2016.05.09.19.18.48 Database drivers available: pymysql, imaplib, MySQLdb, sqlite3, pg8000, pyodbc Code used to be: queries = [db.auth_user.id > 0]

Re: [web2py] Re: Query auth_user over first and last names in one query

2017-03-09 Thread Anthony
What did your code look like, and are you using an older version of web2py? On Thursday, March 9, 2017 at 12:08:10 PM UTC-5, Jim S wrote: > > Holy Cow! I got it working. > > Not exactly what you specified Anthony, but got me on the right track > > With your method I got this traceback: > >

[web2py] bootstrap modal and conditional fields

2017-03-09 Thread Andrea Fae'
I'm using a modal bootstrap to show a form from a table, this is the funntion called from JS webcomponent $.web2py.component("{{=URL('default', 'nuovo_evento.load')}}"+ "?titolo=" + title +"=" + risorsa + "=" +start + "=" + end,"modulo-evento"); Function of the controller: def

Re: [web2py] how to override "select" method?

2017-03-09 Thread Jurgis Pralgauskis
One more feature: - I want to get result of select() .compact=False by default On Thu, Mar 9, 2017 at 8:33 PM, Jurgis Pralgauskis < jurgis.pralgaus...@gmail.com> wrote: > Hi, > > I want to have extra features for select(..) > And the codebase is already quite big -- imo best would be to

Re: {Disarmed} Re: [web2py] problem with ldap authentication

2017-03-09 Thread Richard Vézina
port=636, secure=True, self_signed_certificate=True, You should look at auth_ldap code if they all apply depends of your LDAP server... Things is I don't recall if I contribute all the change I made over my own auth_ldap, but the code is your source of truth... :) Richard On Thu, Mar 9, 2017

Re: {Disarmed} Re: [web2py] problem with ldap authentication

2017-03-09 Thread Richard Vézina
Associate parameters : On Thu, Mar 9, 2017 at 1:32 PM, Richard Vézina wrote: > You may try the SSL port 636 (http://www.openldap.org/faq/ > data/cache/185.html) > > > You may realise that it actually available... > > Richard > > On Thu, Mar 9, 2017 at 12:53 PM,

[web2py] how to override "select" method?

2017-03-09 Thread Jurgis Pralgauskis
Hi, I want to have extra features for select(..) And the codebase is already quite big -- imo best would be to implement the features transparently... I guess I could make derivative of Set class and override __call__ and select (and maybe _select) If I need this only for reading information?

Re: {Disarmed} Re: [web2py] problem with ldap authentication

2017-03-09 Thread Richard Vézina
You may try the SSL port 636 ( http://www.openldap.org/faq/data/cache/185.html) You may realise that it actually available... Richard On Thu, Mar 9, 2017 at 12:53 PM, Carlos Cesar Caballero Díaz < carlos.caball...@cfg.jovenclub.cu> wrote: > I completely agree, and I have warned to the

{Disarmed} Re: [web2py] problem with ldap authentication

2017-03-09 Thread Carlos Cesar Caballero Díaz
I completely agree, and I have warned to the sysadmin, but is not my network, so... Greetings. El 09/03/17 a las 12:26, Richard Vézina escribió: Hello Carlos, auth_ldap is difficult to put in place because as you mention it doesn't provide proper feedback when something goes wrong...

Re: {Disarmed} Re: [web2py] problem with ldap authentication

2017-03-09 Thread Richard Vézina
Hello Carlos, auth_ldap is difficult to put in place because as you mention it doesn't provide proper feedback when something goes wrong... Note: If you access localhost instance of LDAP it may be ok to not use SSL protected service, but other than that you want to use 636 port (if I recall) and

Re: [web2py] Re: Query auth_user over first and last names in one query

2017-03-09 Thread Jim Steil
Holy Cow! I got it working. Not exactly what you specified Anthony, but got me on the right track With your method I got this traceback: Traceback (most recent call last): File "C:\dev\web2py\gluon\restricted.py", line 216, in restricted exec(ccode, environment) File

{Disarmed} Re: [web2py] problem with ldap authentication

2017-03-09 Thread Carlos Cesar Caballero Díaz
Hi Richard, I am connecting against an OpenLDAP server, and here is a lot of services running against it (proxy, email, nextcloud, dolibarr, a few dozen of Ubuntu PCs and others). After a more accurate debugging I release that simple_bind_s() was throwing an invalid credentials error (will

[web2py] Re: Query auth_user over first and last names in one query

2017-03-09 Thread Anthony
I haven't tried it, but maybe something like this: def search(sfields, keywords): keywords = keywords.strip().replace("'", "''") return "CONCAT(first_name, ' ', last_name) LIKE '%%%s%%'" % keywords grid = SQLFORM.grid(db.mytable, searchable=search) Actually, although not

Re: [web2py] Re: Query auth_user over first and last names in one query

2017-03-09 Thread Anthony
On Thursday, March 9, 2017 at 9:05:27 AM UTC-5, Áureo Dias Neto wrote: > > you can use the 'like' condition in w2p, something like this: > > > query = ((db.auth_user.like('%s%' form.var.name) or (db.auth_user.like('%s%' > form.var.name > You cannot build a query from the table object alone

Re: [web2py] Re: Query auth_user over first and last names in one query

2017-03-09 Thread Jim S
That doesn't work because if I put in 'Tom Jones' into my search it doesn't match either first name or last name. Only matches if I concatenate the first and last name fields together. -Jim On Thursday, March 9, 2017 at 8:05:27 AM UTC-6, Áureo Dias Neto wrote: > > you can use the 'like'

Re: [web2py] Re: Query auth_user over first and last names in one query

2017-03-09 Thread Áureo Dias Neto
you can use the 'like' condition in w2p, something like this: query = ((db.auth_user.like('%s%' form.var.name) or (db.auth_user.like('%s%' form.var.name 2017-03-09 10:52 GMT-03:00 Jim S : > That will work, but I'm only wanting 1 form field. Basically want to > implement a

Re: [web2py] Re: Query auth_user over first and last names in one query

2017-03-09 Thread Jim S
That will work, but I'm only wanting 1 form field. Basically want to implement a CONCAT function like in the sample SQL Statement I mentioned above. -Jim On Thursday, March 9, 2017 at 7:47:16 AM UTC-6, Áureo Dias Neto wrote: > > or this: > > name = form.vars.name > lastname =

Re: [web2py] Re: Query auth_user over first and last names in one query

2017-03-09 Thread Áureo Dias Neto
or this: name = form.vars.name lastname = form.vars.lastname query = ((db.auth_user == name) or (db.auth_user == lastname)) form = SQLFORM.grid(query) -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) -

Re: [web2py] Re: Query auth_user over first and last names in one query

2017-03-09 Thread Áureo Dias Neto
name = form.vars.name lastname = form.vars.lastname query = db((db.auth_user == name) or (db.auth_user == lastname)).select() form = SQLFORM.grid(query) -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) -

[web2py] Re: Query auth_user over first and last names in one query

2017-03-09 Thread Jim S
Bump - didn't get any takers the first time. Wondering if anyone has any ideas... -Jim On Tuesday, March 7, 2017 at 10:00:04 PM UTC-6, Jim S wrote: > > Hi > > I have a search form where the user types in generic search text. I want > to be able to return to them a list of matching users. >

Re: [web2py] Re: Unpickling error

2017-03-09 Thread Maurice Waka
Sorry. I discovered that my database was corrupted On Mar 6, 2017 23:20, "Jordan Myers" wrote: > It would help if you gave us some more context. Where does this error > occur? What are you trying to do? The error seems to be when you are > creating tables in the file