[web2py] Re: Small issue in DAL using ``

2015-11-18 Thread Maxwell Morais
Any suggestion?

Em segunda-feira, 16 de novembro de 2015 18:31:07 UTC-2, Maxwell Morais 
escreveu:
>
> Hi all!
>
> I'm trying to implement a small layer over DAL, for my meta-schemas, and 
> I'm facing a very strange issue!
>
> My model is hosted here 
> https://github.com/MaxMorais/esquema/blob/master/esquema/lds.py#L248, I 
> commented the line that is raising a error in SQLite3.
>
> What is going wrong is:
>
> When I use my class to define a model, each sub-model make a explicity 
> reference to the master model, until here nothing special, I guess!
>
> While DAL try to create the table, I receive a error from SQLite3, 
> basicaly the SQL Statement is right, but the order of the statemets is 
> wrong, see it here https://gist.github.com/MaxMorais/8c22caec9789032ea99a, 
> the fine.SQL is the file that I edited the order of the statements, and the 
> wrong.SQL is the untouched SQL from DAL.
>
> Inspecting the code, I found the stretch of code that is generating this 
> statement, the stretch is this: 
> https://github.com/web2py/pydal/blob/fef5ed36f07f211aee7c9a5d2218d2b9f3b77c99/pydal/adapters/base.py#L312,
>  
> but I dont have idea, why it is in this way!
>
>
>
> -- 
>
> Best Regards.
>
> Maxwell Morais
> Python Developer powered by Webnotes framework <3
> +55 11 954329659
>
>

-- 
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 subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: executesql issue

2015-11-18 Thread Anthony
The code looks correct. Maybe a bug with the pg8000 driver?

On Wednesday, November 18, 2015 at 6:46:39 AM UTC-5, Pierre wrote:
>
> Hi everyone,
>
> I cannot run an executesql command with the placeholders argument. Is 
> there a robust example somewhere to use as a reference ?
> I need to pass string and float variables via placeholders
>
> I use a postgresql database
>
> test code is
>
> def test():
> tablename = 'tablex'
> query = 'select * from  %s'
> result = db.executesql(query,placeholders=(tablename,))
> return locals()
>
> and the traceback:
>
>  ('ERROR', '42601', 'syntax 
> error at or near "$1"') Version web2py™ Version 
> 2.12.3-stable+timestamp.2015.08.19.00.18.03 Traceback 
>
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
> 10.
> 11.
> 12.
> 13.
> 14.
> 15.
> 16.
> 17.
> 18.
> 19.
> 20.
> 21.
> 22.
> 23.
> 24.
>
> Traceback (most recent call last):
>   File "/opt/web2py/gluon/restricted.py", line 227, in restricted
> exec ccode in environment
>   File "/opt/web2py/applications/proxima/controllers/default.py" 
> , 
> line 89, in 
>   File "/opt/web2py/gluon/globals.py", line 412, in 
> self._caller = lambda f: f()
>   File "/opt/web2py/applications/proxima/controllers/default.py" 
> , 
> line 41, in test
> result = db.executesql(query,placeholders=(tablename,))
>   File "/opt/web2py/gluon/packages/dal/pydal/base.py", line 998, in executesql
> adapter.execute(query, placeholders)
>   File "/opt/web2py/gluon/packages/dal/pydal/adapters/postgres.py", line 360, 
> in execute
> return BaseAdapter.execute(self, *a, **b)
>   File "/opt/web2py/gluon/packages/dal/pydal/adapters/base.py", line 1378, in 
> execute
> return self.log_execute(*a, **b)
>   File "/opt/web2py/gluon/packages/dal/pydal/adapters/base.py", line 1372, in 
> log_execute
> ret = self.cursor.execute(command, *a[1:], **b)
>   File "/opt/web2py/gluon/contrib/pg8000/core.py", line 573, in execute
> self._c.execute(self, operation, args)
>   File "/opt/web2py/gluon/contrib/pg8000/core.py", line 1626, in execute
> self.handle_messages(cursor)
>   File "/opt/web2py/gluon/contrib/pg8000/core.py", line 1774, in 
> handle_messages
> raise self.error
> ProgrammingError: ('ERROR', '42601', 'syntax error at or near "$1"')
>
>
>
>

-- 
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 subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] SQlite to Postgres insert problems

2015-11-18 Thread Carla Raquel
I'm having some troubles importing from csv files while using a Postgres 
connection, when a table has one or more references to other tables like so:

db.define_table('Extension',
Field('Person',db.auth_user),
Field('Supervisor',db.auth_user),
Field('Number','integer'),
Field('Description','text')



I have created this and the auth_user table on Postgres and imported the 
auth_user contents from the csv file with no problems. I also have no 
problems importing to other tables that have no external references. I have 
the following error: ('Error', '23503','insert or update on table 
"extensao" violates foreign key constraint "extension_person_fkey"'). Any 
ideas?

-- 
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 subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] executesql issue

2015-11-18 Thread Richard Vézina
I notice that you use pg8000, you may also try with psycopg2 instead...

Richard



On Wed, Nov 18, 2015 at 11:34 AM, Richard Vézina <
ml.richard.vez...@gmail.com> wrote:

> I didn't know about the placeholder argument, though the documentation
> says that it may not works for all the backend, is your database support it?
>
> Documentation :
> In this case, the return values are not parsed or transformed by the DAL,
> and the format depends on the specific database driver. This usage with
> selects is normally not needed, but it is more common with indexes.
> executesql takes four optional arguments: placeholders, as_dict, fields
>  andcolnames. placeholders is an optional sequence of values to be
> substituted in or, if supported by the DB driver, a dictionary with keys
> matching named placeholders in your SQL.
>
>
>
> On Wed, Nov 18, 2015 at 6:46 AM, Pierre  wrote:
>
>> Hi everyone,
>>
>> I cannot run an executesql command with the placeholders argument. Is
>> there a robust example somewhere to use as a reference ?
>> I need to pass string and float variables via placeholders
>>
>> I use a postgresql database
>>
>> test code is
>>
>> def test():
>> tablename = 'tablex'
>> query = 'select * from  %s'
>> result = db.executesql(query,placeholders=(tablename,))
>> return locals()
>>
>> and the traceback:
>>
>>  ('ERROR', '42601',
>> 'syntax error at or near "$1"') Version web2py™ Version
>> 2.12.3-stable+timestamp.2015.08.19.00.18.03 Traceback
>>
>> 1.
>> 2.
>> 3.
>> 4.
>> 5.
>> 6.
>> 7.
>> 8.
>> 9.
>> 10.
>> 11.
>> 12.
>> 13.
>> 14.
>> 15.
>> 16.
>> 17.
>> 18.
>> 19.
>> 20.
>> 21.
>> 22.
>> 23.
>> 24.
>>
>> Traceback (most recent call last):
>>   File "/opt/web2py/gluon/restricted.py", line 227, in restricted
>> exec ccode in environment
>>   File "/opt/web2py/applications/proxima/controllers/default.py" 
>> , 
>> line 89, in 
>>   File "/opt/web2py/gluon/globals.py", line 412, in 
>> self._caller = lambda f: f()
>>   File "/opt/web2py/applications/proxima/controllers/default.py" 
>> , 
>> line 41, in test
>> result = db.executesql(query,placeholders=(tablename,))
>>   File "/opt/web2py/gluon/packages/dal/pydal/base.py", line 998, in 
>> executesql
>> adapter.execute(query, placeholders)
>>   File "/opt/web2py/gluon/packages/dal/pydal/adapters/postgres.py", line 
>> 360, in execute
>> return BaseAdapter.execute(self, *a, **b)
>>   File "/opt/web2py/gluon/packages/dal/pydal/adapters/base.py", line 1378, 
>> in execute
>> return self.log_execute(*a, **b)
>>   File "/opt/web2py/gluon/packages/dal/pydal/adapters/base.py", line 1372, 
>> in log_execute
>> ret = self.cursor.execute(command, *a[1:], **b)
>>   File "/opt/web2py/gluon/contrib/pg8000/core.py", line 573, in execute
>> self._c.execute(self, operation, args)
>>   File "/opt/web2py/gluon/contrib/pg8000/core.py", line 1626, in execute
>> self.handle_messages(cursor)
>>   File "/opt/web2py/gluon/contrib/pg8000/core.py", line 1774, in 
>> handle_messages
>> raise self.error
>> ProgrammingError: ('ERROR', '42601', 'syntax error at or near "$1"')
>>
>>
>>
>> --
>> 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 subscribed to the Google Groups
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to web2py+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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 subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] executesql issue

2015-11-18 Thread Richard Vézina
I didn't know about the placeholder argument, though the documentation says
that it may not works for all the backend, is your database support it?

Documentation :
In this case, the return values are not parsed or transformed by the DAL,
and the format depends on the specific database driver. This usage with
selects is normally not needed, but it is more common with indexes.
executesql takes four optional arguments: placeholders, as_dict, fields and
colnames. placeholders is an optional sequence of values to be substituted
in or, if supported by the DB driver, a dictionary with keys matching named
placeholders in your SQL.



On Wed, Nov 18, 2015 at 6:46 AM, Pierre  wrote:

> Hi everyone,
>
> I cannot run an executesql command with the placeholders argument. Is
> there a robust example somewhere to use as a reference ?
> I need to pass string and float variables via placeholders
>
> I use a postgresql database
>
> test code is
>
> def test():
> tablename = 'tablex'
> query = 'select * from  %s'
> result = db.executesql(query,placeholders=(tablename,))
> return locals()
>
> and the traceback:
>
>  ('ERROR', '42601', 'syntax
> error at or near "$1"') Version web2py™ Version
> 2.12.3-stable+timestamp.2015.08.19.00.18.03 Traceback
>
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
> 10.
> 11.
> 12.
> 13.
> 14.
> 15.
> 16.
> 17.
> 18.
> 19.
> 20.
> 21.
> 22.
> 23.
> 24.
>
> Traceback (most recent call last):
>   File "/opt/web2py/gluon/restricted.py", line 227, in restricted
> exec ccode in environment
>   File "/opt/web2py/applications/proxima/controllers/default.py" 
> , 
> line 89, in 
>   File "/opt/web2py/gluon/globals.py", line 412, in 
> self._caller = lambda f: f()
>   File "/opt/web2py/applications/proxima/controllers/default.py" 
> , 
> line 41, in test
> result = db.executesql(query,placeholders=(tablename,))
>   File "/opt/web2py/gluon/packages/dal/pydal/base.py", line 998, in executesql
> adapter.execute(query, placeholders)
>   File "/opt/web2py/gluon/packages/dal/pydal/adapters/postgres.py", line 360, 
> in execute
> return BaseAdapter.execute(self, *a, **b)
>   File "/opt/web2py/gluon/packages/dal/pydal/adapters/base.py", line 1378, in 
> execute
> return self.log_execute(*a, **b)
>   File "/opt/web2py/gluon/packages/dal/pydal/adapters/base.py", line 1372, in 
> log_execute
> ret = self.cursor.execute(command, *a[1:], **b)
>   File "/opt/web2py/gluon/contrib/pg8000/core.py", line 573, in execute
> self._c.execute(self, operation, args)
>   File "/opt/web2py/gluon/contrib/pg8000/core.py", line 1626, in execute
> self.handle_messages(cursor)
>   File "/opt/web2py/gluon/contrib/pg8000/core.py", line 1774, in 
> handle_messages
> raise self.error
> ProgrammingError: ('ERROR', '42601', 'syntax error at or near "$1"')
>
>
>
> --
> 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 subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: update_or_insert - Calculation when updating

2015-11-18 Thread Dave S


On Tuesday, November 17, 2015 at 8:02:25 AM UTC-8, Anthony wrote:
 

> Python does allow increment assignments, though it is "+=" rather than 
> "=+". 
>

YRDLSH
 

> Perhaps you meant that it cannot be used when passing function arguments, 
> as in this case (i.e., you can't do myfunc(arg+=some_value), which 
> obviously wouldn't make sense, as "arg" doesn't have any value to 
> increment).
>

Also doesn't work in "print x += 1"
so I guess python doesn't consider assignment an expression.

/dps

-- 
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 subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] How to make a simpleLDAPObject accessible in an app ?

2015-11-18 Thread Jonathan R
Hi, 
I'm still working on an app connecting on a ldap server using the 
credentials provided at login time by the user (in the webapp) and my 
objective is to bind once to the ldap server right after login and use this 
bind to make the different query requested by the user.
I bind using a custom function added to the list :

auth.settings.login_onaccept 

I tried to use session to pass it to the app :
my code looks like :

def ldap_connect :

# create a simpleLDAPObject named *con*

# initialize this object

# use username and password provided to bind 

# here comes the problem: make the con object available outside this 
function as long as the user is logged in
# I tried different flavor of : (session.con , session.vars.con, 
session.vars[con]) the issue is not on the syntax 

session['con'] = con

This send an internal error while processing the functions: 
session.try_store_in ... [cookie_or_file, file] and return a Pikling Error 
Can't pikle : attribute lookup thread.lock failed.
 
I suppose this is why there is a section called "Don't store user defined 
object in session' in the book, my question is then where should I store it 
?


-- 
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 subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] SQlite to Postgres insert problems

2015-11-18 Thread António Ramos
Be carefull that imported records will get a fresh new id and because of
that you may get that error.
;)
Em 18/11/2015 15:35, "Carla Raquel"  escreveu:

> I'm having some troubles importing from csv files while using a Postgres
> connection, when a table has one or more references to other tables like so:
>
> db.define_table('Extension',
> Field('Person',db.auth_user),
> Field('Supervisor',db.auth_user),
> Field('Number','integer'),
> Field('Description','text')
>
>
>
> I have created this and the auth_user table on Postgres and imported the
> auth_user contents from the csv file with no problems. I also have no
> problems importing to other tables that have no external references. I have
> the following error: ('Error', '23503','insert or update on table
> "extensao" violates foreign key constraint "extension_person_fkey"'). Any
> ideas?
>
> --
> 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 subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: SQlite to Postgres insert problems

2015-11-18 Thread Anthony
You can use the method to export/import the all tables at once 

 
- that will handle all the references automatically. If you want to limit 
it to a subset of the tables, just run the export/import commands after 
defining only those tables (any tables not yet defined will be invisible to 
the DAL and therefore won't be exported/imported).

Anthony

On Wednesday, November 18, 2015 at 10:35:32 AM UTC-5, Carla Raquel wrote:
>
> I'm having some troubles importing from csv files while using a Postgres 
> connection, when a table has one or more references to other tables like so:
>
> db.define_table('Extension',
> Field('Person',db.auth_user),
> Field('Supervisor',db.auth_user),
> Field('Number','integer'),
> Field('Description','text')
>
>
>
> I have created this and the auth_user table on Postgres and imported the 
> auth_user contents from the csv file with no problems. I also have no 
> problems importing to other tables that have no external references. I have 
> the following error: ('Error', '23503','insert or update on table 
> "extensao" violates foreign key constraint "extension_person_fkey"'). Any 
> ideas?
>

-- 
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 subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: How to make a simpleLDAPObject accessible in an app ?

2015-11-18 Thread Niphlod
you can't really serialize a connection. you can serialize the plain 
password and then create a new one, using the credentials the user gave you.

On Wednesday, November 18, 2015 at 7:54:56 PM UTC+1, Jonathan R wrote:
>
> Hi, 
> I'm still working on an app connecting on a ldap server using the 
> credentials provided at login time by the user (in the webapp) and my 
> objective is to bind once to the ldap server right after login and use this 
> bind to make the different query requested by the user.
> I bind using a custom function added to the list :
>
> auth.settings.login_onaccept 
>
> I tried to use session to pass it to the app :
> my code looks like :
>
> def ldap_connect :
>
> # create a simpleLDAPObject named *con*
>
> # initialize this object
>
> # use username and password provided to bind 
> 
> # here comes the problem: make the con object available outside this 
> function as long as the user is logged in
> # I tried different flavor of : (session.con , session.vars.con, 
> session.vars[con]) the issue is not on the syntax 
> 
> session['con'] = con
>
> This send an internal error while processing the functions: 
> session.try_store_in ... [cookie_or_file, file] and return a Pikling Error 
> Can't pikle : attribute lookup thread.lock failed.
>  
> I suppose this is why there is a section called "Don't store user defined 
> object in session' in the book, my question is then where should I store it 
> ?
> 
>

-- 
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 subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Small issue in DAL using ``

2015-11-18 Thread Niphlod
are you sure that the referencED table exists before the referencING one ?

On Wednesday, November 18, 2015 at 5:01:03 PM UTC+1, Maxwell Morais wrote:
>
> Any suggestion?
>
> Em segunda-feira, 16 de novembro de 2015 18:31:07 UTC-2, Maxwell Morais 
> escreveu:
>>
>> Hi all!
>>
>> I'm trying to implement a small layer over DAL, for my meta-schemas, and 
>> I'm facing a very strange issue!
>>
>> My model is hosted here 
>> https://github.com/MaxMorais/esquema/blob/master/esquema/lds.py#L248, I 
>> commented the line that is raising a error in SQLite3.
>>
>> What is going wrong is:
>>
>> When I use my class to define a model, each sub-model make a explicity 
>> reference to the master model, until here nothing special, I guess!
>>
>> While DAL try to create the table, I receive a error from SQLite3, 
>> basicaly the SQL Statement is right, but the order of the statemets is 
>> wrong, see it here https://gist.github.com/MaxMorais/8c22caec9789032ea99a, 
>> the fine.SQL is the file that I edited the order of the statements, and the 
>> wrong.SQL is the untouched SQL from DAL.
>>
>> Inspecting the code, I found the stretch of code that is generating this 
>> statement, the stretch is this: 
>> https://github.com/web2py/pydal/blob/fef5ed36f07f211aee7c9a5d2218d2b9f3b77c99/pydal/adapters/base.py#L312,
>>  
>> but I dont have idea, why it is in this way!
>>
>>
>>
>> -- 
>>
>> Best Regards.
>>
>> Maxwell Morais
>> Python Developer powered by Webnotes framework <3
>> +55 11 954329659
>>
>>

-- 
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 subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: How to make a simpleLDAPObject accessible in an app ?

2015-11-18 Thread Jonathan R
Hi Niphlod,
I used your method but the downside is that I have a plain text password 
stored in my application then, I'm not really aware how secure it is to do 
so, is there a way for an attacker to extract this info ?

On Wednesday, November 18, 2015 at 3:09:08 PM UTC-5, Niphlod wrote:
>
> you can't really serialize a connection. you can serialize the plain 
> password and then create a new one, using the credentials the user gave you.
>
> On Wednesday, November 18, 2015 at 7:54:56 PM UTC+1, Jonathan R wrote:
>>
>> Hi, 
>> I'm still working on an app connecting on a ldap server using the 
>> credentials provided at login time by the user (in the webapp) and my 
>> objective is to bind once to the ldap server right after login and use this 
>> bind to make the different query requested by the user.
>> I bind using a custom function added to the list :
>>
>> auth.settings.login_onaccept 
>>
>> I tried to use session to pass it to the app :
>> my code looks like :
>>
>> def ldap_connect :
>>
>> # create a simpleLDAPObject named *con*
>>
>> # initialize this object
>>
>> # use username and password provided to bind 
>> 
>> # here comes the problem: make the con object available outside this 
>> function as long as the user is logged in
>> # I tried different flavor of : (session.con , session.vars.con, 
>> session.vars[con]) the issue is not on the syntax 
>> 
>> session['con'] = con
>>
>> This send an internal error while processing the functions: 
>> session.try_store_in ... [cookie_or_file, file] and return a Pikling Error 
>> Can't pikle : attribute lookup thread.lock failed.
>>  
>> I suppose this is why there is a section called "Don't store user defined 
>> object in session' in the book, my question is then where should I store it 
>> ?
>> 
>>
>

-- 
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 subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: How to make a simpleLDAPObject accessible in an app ?

2015-11-18 Thread Niphlod
if you expose it to him, yes. 
Unfortunately in your situation the only way to create an ldap connection 
is to save somewhere what you need to bind to the AD server, which at the 
very LEAST is username and password. Once again I urge to speak with AD 
administrators and require a dedicated set of credentials to let your app 
connect to AD servers.
I'm pretty sure that if you explain them what you're trying to do without 
it (really scary stuff), they'll be happy to comply.

On a totally different path, you can subclass or make your own login_method 
(mostly copy/pasting web2py's one) and append your queries to it.

On Wednesday, November 18, 2015 at 9:20:34 PM UTC+1, Jonathan R wrote:
>
> Hi Niphlod,
> I used your method but the downside is that I have a plain text password 
> stored in my application then, I'm not really aware how secure it is to do 
> so, is there a way for an attacker to extract this info ?
>
> On Wednesday, November 18, 2015 at 3:09:08 PM UTC-5, Niphlod wrote:
>>
>> you can't really serialize a connection. you can serialize the plain 
>> password and then create a new one, using the credentials the user gave you.
>>
>> On Wednesday, November 18, 2015 at 7:54:56 PM UTC+1, Jonathan R wrote:
>>>
>>> Hi, 
>>> I'm still working on an app connecting on a ldap server using the 
>>> credentials provided at login time by the user (in the webapp) and my 
>>> objective is to bind once to the ldap server right after login and use this 
>>> bind to make the different query requested by the user.
>>> I bind using a custom function added to the list :
>>>
>>> auth.settings.login_onaccept 
>>>
>>> I tried to use session to pass it to the app :
>>> my code looks like :
>>>
>>> def ldap_connect :
>>>
>>> # create a simpleLDAPObject named *con*
>>>
>>> # initialize this object
>>>
>>> # use username and password provided to bind 
>>> 
>>> # here comes the problem: make the con object available outside this 
>>> function as long as the user is logged in
>>> # I tried different flavor of : (session.con , session.vars.con, 
>>> session.vars[con]) the issue is not on the syntax 
>>> 
>>> session['con'] = con
>>>
>>> This send an internal error while processing the functions: 
>>> session.try_store_in ... [cookie_or_file, file] and return a Pikling Error 
>>> Can't pikle : attribute lookup thread.lock failed.
>>>  
>>> I suppose this is why there is a section called "Don't store user 
>>> defined object in session' in the book, my question is then where should I 
>>> store it ?
>>> 
>>>
>>

-- 
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 subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: exporting to csv

2015-11-18 Thread Johann Spies
On 18 November 2015 at 03:51, lucas  wrote:

nice job, any idea how to make it a tab delimited file instead of comma?
> lucas
>
> From the book:

Both export_to_csv_file and import_from_csv_file accept keyword arguments
that tell the csv parser the format to save/load the files:

   - delimiter: delimiter to separate values (default ',')
   - quotechar: character to use to quote string values (default to double
   quotes)
   - quoting: quote system (default csv.QUOTE_MINIMAL)

Here is some example usage:

>>> import csv
>>> rows = db(query).select()
>>> rows.export_to_csv_file(open('/tmp/test.txt', 'w'),
delimiter='|',
quotechar='"',
quoting=csv.QUOTE_NONNUMERIC)

Regards

Johann


-- 
Because experiencing your loyal love is better than life itself,
my lips will praise you.  (Psalm 63:3)

-- 
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 subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] executesql issue

2015-11-18 Thread Pierre
Hi everyone,

I cannot run an executesql command with the placeholders argument. Is there 
a robust example somewhere to use as a reference ?
I need to pass string and float variables via placeholders

I use a postgresql database

test code is

def test():
tablename = 'tablex'
query = 'select * from  %s'
result = db.executesql(query,placeholders=(tablename,))
return locals()

and the traceback:

 ('ERROR', '42601', 'syntax 
error at or near "$1"') Version web2py™ Version 
2.12.3-stable+timestamp.2015.08.19.00.18.03 Traceback 

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.

Traceback (most recent call last):
  File "/opt/web2py/gluon/restricted.py", line 227, in restricted
exec ccode in environment
  File "/opt/web2py/applications/proxima/controllers/default.py" 
, line 
89, in 
  File "/opt/web2py/gluon/globals.py", line 412, in 
self._caller = lambda f: f()
  File "/opt/web2py/applications/proxima/controllers/default.py" 
, line 
41, in test
result = db.executesql(query,placeholders=(tablename,))
  File "/opt/web2py/gluon/packages/dal/pydal/base.py", line 998, in executesql
adapter.execute(query, placeholders)
  File "/opt/web2py/gluon/packages/dal/pydal/adapters/postgres.py", line 360, 
in execute
return BaseAdapter.execute(self, *a, **b)
  File "/opt/web2py/gluon/packages/dal/pydal/adapters/base.py", line 1378, in 
execute
return self.log_execute(*a, **b)
  File "/opt/web2py/gluon/packages/dal/pydal/adapters/base.py", line 1372, in 
log_execute
ret = self.cursor.execute(command, *a[1:], **b)
  File "/opt/web2py/gluon/contrib/pg8000/core.py", line 573, in execute
self._c.execute(self, operation, args)
  File "/opt/web2py/gluon/contrib/pg8000/core.py", line 1626, in execute
self.handle_messages(cursor)
  File "/opt/web2py/gluon/contrib/pg8000/core.py", line 1774, in handle_messages
raise self.error
ProgrammingError: ('ERROR', '42601', 'syntax error at or near "$1"')



-- 
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 subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: ignore_field_case

2015-11-18 Thread Annet
Hi Anthony,

Sorry, I misunderstood your configuration and what you were trying to do. 
>

My fault, I did not provide you with sufficient information.
 

You probably want:

db.mytable.myfield.ilike(some_value)

That is what I wanted. Thanks for providing me with this solution.


Kind regards,

Annet

-- 
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 subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] A MCV-related question: global search form

2015-11-18 Thread Johann Spies
As I understand Web2py forms in views are managed by controllers.

I want to use a search form in the menubar like the  attached image.

[image: Inline images 1]

This form is presented by layout.html.

I want the form to be an auto-complete widget with sql-lookups in the
background.

So from where do I control that form?  From a model?

The form must be available from all parts of the app. I do not want to add
code in every controller to manage it.

Regards
Johann
-- 
Because experiencing your loyal love is better than life itself,
my lips will praise you.  (Psalm 63:3)

-- 
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 subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: A MCV-related question: global search form

2015-11-18 Thread Leonel Câmara
If you want to use the autocomplete widget you will have to use LOAD. I 
would not go this route. I would include the form in layout.html and then 
use javascript to do the lookups using a controller function specific for 
searching, probably using something like selectize 
https://brianreavis.github.io/selectize.js 

-- 
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 subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: web2py and python3

2015-11-18 Thread Richard Vézina
I agree that we should keep the name... It really difficult to explain that
it the same thing if the name change...

Richard

On Tue, Nov 17, 2015 at 1:29 AM, Paolo Valleri 
wrote:

> Maintaining web2py is not easy at all, how/who will maintain two
> web2py/web3py? I see this as the major issue
> The old discussions were about the whole web2py, now there is pydal
> already working on python 3.x.
>
> Having a roadmap is a good way to proceed and surely github wiki is the
> place where document it.
> Two things to discuss:
> - will be backward compatibility?
> - will be a new project (web3py), or not(web2py)?
> Today, I'd say, yes to first, no to the second, but we should start
> working on the porting and see later what will happen
>
> The first step of the roadmap is writing the roadmap :0
> The second making web2py "syntactically" compatible with python 3.x
> Who want to start?
>
>  Paolo
>
> 2015-11-17 2:53 GMT+01:00 Richard Vézina :
>
>> Here it goes :
>>
>> List of relevant posts :
>>
>> Most relevant:
>> https://groups.google.com/d/msg/web2py/X80Ol0Uumrg/vGrGtaeOVZwJ
>> https://groups.google.com/d/msg/web2py/mlG6-yHPa4g/MFAU9zX3jo4J
>> https://groups.google.com/d/msg/web2py/WJOWlTnoz5I/y0-dQTywoHwJ
>>
>>
>> The whole thread:
>> https://groups.google.com/forum/#!topic/web2py/hAiMQ1gLUo8
>> https://groups.google.com/forum/#!topic/web2py/291FhcxGvYc
>>
>> https://groups.google.com/forum/#!topicsearchin/web2py/web3py/web2py/lwdZ5vEMGdM
>>
>> Stackoverflow
>> http://stackoverflow.com/questions/22684906/web2py-and-python-3
>>
>> Funny:
>> https://www.quora.com/How-does-web2py-support-Python-3
>> https://www.quora.com/profile/Wei-Wei-1/Posts/10-reasons-not-to-use-web2py
>>
>> Old
>> https://groups.google.com/forum/#!topic/web2py/U1Ukbfhmais
>> https://groups.google.com/d/msg/web2py/xXDjA47a6nc/ZrMi5XXHUpgJ
>>
>> web2py-dev
>>
>> https://groups.google.com/forum/#!msg/web2py-developers/jXFLnyfkL2U/GQ0qHENepHEJ
>> https://groups.google.com/d/msg/web2py-developers/CFj5dH3ilew/x0KoevEfufIJ
>> https://groups.google.com/d/msg/web2py-developers/RCeiRd3Rzs0/vqA_PfmBvHgJ
>> https://groups.google.com/d/msg/web2py-developers/AEtuwHQgJnc/iKNMImHqoHUJ
>> https://groups.google.com/d/msg/web2py-developers/9ztv8ecT1Nk/7__jGmreZf8J
>> Gluino3 no answer :
>> https://groups.google.com/d/msg/web2py-developers/ilxA-aMDtLk/OSYp_uoWfVcJ
>> https://groups.google.com/d/msg/web2py/lwdZ5vEMGdM/D6BfYuwOWoUJ
>>
>>
>> I think I can still find some threads but I think the most important one
>> are there...
>>
>> Have a good read...
>>
>> :)
>>
>> Richard
>>
>> On Mon, Nov 16, 2015 at 4:45 PM, Jim S  wrote:
>>
>>> +1
>>>
>>> On Monday, November 16, 2015 at 3:38:48 PM UTC-6, Richard wrote:

 I would like to suggest a way to get out of these recurrent
 discussions...

 Why not adopt some guidance around the issue... I think the heart of
 the problem here is that not knowing what is coming or not make people
 insecure about the future of what is built (or could be build) with web2py.
 It may be true that no big corporate are not using Python 3 at the moment,
 though distros have already started sending the message that Python 3 is
 coming... To my knowledge, since 3.4 Python 3 is consider to be ready for
 real work...

 So, maybe we could write a section in the book about web2py and Python
 3 support, if the book is not the place we can put a text file in github
 somewhere in web2py about that and maybe a TODO-List of what is need to be
 done... Or a Roadmap on the web2py Web site... There is plenty of options
 to document out this "issue" and what is know about it and what is the
 heart of this issue... Also, if web2py will have to break it promise for
 backward compatibility or not and if it breaks it what work to expect in
 our apps to make them work in "web3py", etc.

 There is many threads on the mailing-lists... A good start could be to
 retrieve them and read them to extract the important things??

 Like that when the question pop again we can redirect people to the
 Documentation/Roadmap and they can make a better informed decision about
 using web2py or not, waiting for Python 3 support by web2py or not, etc.

 Thanks, regards

 Richard

 On Mon, Nov 16, 2015 at 4:13 PM, Stuart Rolinson  wrote:

> I wanted to add to this discussion as well.  I think that developing
> with python 2.7 and web2py has been fine, however I have been really
> concerned as my application gets bigger that we are going to have to
> migrate to a .net or java based solution in the future.  The more I
> develop, the more I worry about the amount of re-work I am creating for
> myself in the future.  I would feel better about my decision to choose
> web2py if this supported the current version of the 

Re: [web2py] Re: New Web2py Materialize CSS Welcome app scaffold

2015-11-18 Thread Richard Vézina
:D

On Wed, Nov 18, 2015 at 9:11 AM, Alessio Varalta <
alessio.vara...@ethicalsoftware.it> wrote:

> Thanks for the work. Is good but I have doubt about the color of
> header,footer and the position of the text in the footer.
>
>
> On Friday, 13 November 2015 18:55:56 UTC+1, Mark Graves wrote:
>>
>> Hey everyone,
>>
>> I just put up a new web2py welcome scaffold app based on materializecss.
>>
>> The repository is available at:
>>
>>  https://bitbucket.org/MarkGraves/welcome_materialize/
>>
>> You can preview it at:
>>
>> https://gravesmedical.pythonanywhere.com/welcome/
>>
>> There are definitely some issues, but I thought it might be useful for
>> some folks.
>>
>> -Mark
>>
> --
> 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 subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: New Web2py Materialize CSS Welcome app scaffold

2015-11-18 Thread Alessio Varalta
Thanks for the work. Is good but I have doubt about the color of 
header,footer and the position of the text in the footer.

On Friday, 13 November 2015 18:55:56 UTC+1, Mark Graves wrote:
>
> Hey everyone,
>
> I just put up a new web2py welcome scaffold app based on materializecss.
>
> The repository is available at:
>
>  https://bitbucket.org/MarkGraves/welcome_materialize/
>
> You can preview it at:
>
> https://gravesmedical.pythonanywhere.com/welcome/
>
> There are definitely some issues, but I thought it might be useful for 
> some folks.
>
> -Mark
>

-- 
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 subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: A MCV-related question: global search form

2015-11-18 Thread Ian Ryder
It could be pretty straight forward - as Leonel says, you would use 
Javascript / Ajax. If you rolled your own autocomplete you would have a 
controller in default (for example) and the layout would refer back to that 
controller. Doesn't matter what page you are looking at, the Ajax call is 
always back to the 'default' controller.

Have a look at the jQuery / Ajax section of the 
book: http://web2py.com/books/default/chapter/29/11/jquery-and-ajax

There's even a built-in autocomplete in web2py which might 
suit: 
http://web2py.com/books/default/chapter/29/11/jquery-and-ajax#Auto-completion

On Wednesday, 18 November 2015 09:40:26 UTC+1, Johann Spies wrote:
>
> As I understand Web2py forms in views are managed by controllers.
>
> I want to use a search form in the menubar like the  attached image.
>
> [image: Inline images 1]
>
> This form is presented by layout.html.
>
> I want the form to be an auto-complete widget with sql-lookups in the 
> background.
>
> So from where do I control that form?  From a model?
>
> The form must be available from all parts of the app. I do not want to add 
> code in every controller to manage it.
>
> Regards
> Johann
> -- 
> Because experiencing your loyal love is better than life itself, 
> my lips will praise you.  (Psalm 63:3)
>

-- 
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 subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: web2py and python3

2015-11-18 Thread Richard Vézina
What about a relax about backward compatibility with web2py 3.0?

On Wed, Nov 18, 2015 at 6:08 PM, Dave S  wrote:

>
>
> On Wednesday, November 18, 2015 at 2:09:45 PM UTC-8, p a wrote:
>>
>> I like the idea of a new framework, using python 3 but that's not the
>> most important. These days if we want to attract developers to our projects
>> we also need to have an API, and separated front end and back end. web2py
>> is great for the backend. The DAL is fantastic, and every time I get close
>> to an ORM I appreciate it even more. After trying out ractive for myself, I
>> really like Massimo's idea of integrating web2py and ractive.
>> So I would love to see a new framework, if we can work on a clear upgrade
>> path that would take existing web2py apps to the new framework. It's much
>> easier to port a web app than a framework, on which many web apps rely. I
>> think we should release the web2py dev team from the chains of backwards
>> compatibility once every few years. If there is a new framework based on
>> the DAL and the other good stuff from web2py, but also using ractive and
>> other technologies and good ideas suggested on this list, then porting our
>> web apps would take a reasonable effort, and it would be well worth it.
>>
>
>
> Maybe call it web2py-R ?
>
> /dps "only half in jest"
>
>
> --
> 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 subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: How to make a simpleLDAPObject accessible in an app ?

2015-11-18 Thread Richard Vézina
Hello Jonathan,

What are you trying to do exactly? Are you trying to write an App that can
manage an LDAP server? Something like PHPldapadmin for instance?

Richard

On Wed, Nov 18, 2015 at 3:45 PM, Niphlod  wrote:

> if you expose it to him, yes.
> Unfortunately in your situation the only way to create an ldap connection
> is to save somewhere what you need to bind to the AD server, which at the
> very LEAST is username and password. Once again I urge to speak with AD
> administrators and require a dedicated set of credentials to let your app
> connect to AD servers.
> I'm pretty sure that if you explain them what you're trying to do without
> it (really scary stuff), they'll be happy to comply.
>
> On a totally different path, you can subclass or make your own
> login_method (mostly copy/pasting web2py's one) and append your queries to
> it.
>
>
> On Wednesday, November 18, 2015 at 9:20:34 PM UTC+1, Jonathan R wrote:
>>
>> Hi Niphlod,
>> I used your method but the downside is that I have a plain text password
>> stored in my application then, I'm not really aware how secure it is to do
>> so, is there a way for an attacker to extract this info ?
>>
>> On Wednesday, November 18, 2015 at 3:09:08 PM UTC-5, Niphlod wrote:
>>>
>>> you can't really serialize a connection. you can serialize the plain
>>> password and then create a new one, using the credentials the user gave you.
>>>
>>> On Wednesday, November 18, 2015 at 7:54:56 PM UTC+1, Jonathan R wrote:

 Hi,
 I'm still working on an app connecting on a ldap server using the
 credentials provided at login time by the user (in the webapp) and my
 objective is to bind once to the ldap server right after login and use this
 bind to make the different query requested by the user.
 I bind using a custom function added to the list :

 auth.settings.login_onaccept

 I tried to use session to pass it to the app :
 my code looks like :

 def ldap_connect :

 # create a simpleLDAPObject named *con*

 # initialize this object

 # use username and password provided to bind

 # here comes the problem: make the con object available outside
 this function as long as the user is logged in
 # I tried different flavor of : (session.con , session.vars.con,
 session.vars[con]) the issue is not on the syntax

 session['con'] = con

 This send an internal error while processing the functions:
 session.try_store_in ... [cookie_or_file, file] and return a Pikling Error
 Can't pikle : attribute lookup thread.lock failed.

 I suppose this is why there is a section called "Don't store user
 defined object in session' in the book, my question is then where should I
 store it ?


>>> --
> 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 subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Small issue in DAL using ``

2015-11-18 Thread Maxwell Morais
Thank you so much for the answer!

Yes, I'm sure!

Em quarta-feira, 18 de novembro de 2015 18:12:46 UTC-2, Niphlod escreveu:
>
> are you sure that the referencED table exists before the referencING one ?
>
> On Wednesday, November 18, 2015 at 5:01:03 PM UTC+1, Maxwell Morais wrote:
>>
>> Any suggestion?
>>
>> Em segunda-feira, 16 de novembro de 2015 18:31:07 UTC-2, Maxwell Morais 
>> escreveu:
>>>
>>> Hi all!
>>>
>>> I'm trying to implement a small layer over DAL, for my meta-schemas, and 
>>> I'm facing a very strange issue!
>>>
>>> My model is hosted here 
>>> https://github.com/MaxMorais/esquema/blob/master/esquema/lds.py#L248, I 
>>> commented the line that is raising a error in SQLite3.
>>>
>>> What is going wrong is:
>>>
>>> When I use my class to define a model, each sub-model make a explicity 
>>> reference to the master model, until here nothing special, I guess!
>>>
>>> While DAL try to create the table, I receive a error from SQLite3, 
>>> basicaly the SQL Statement is right, but the order of the statemets is 
>>> wrong, see it here 
>>> https://gist.github.com/MaxMorais/8c22caec9789032ea99a, the fine.SQL is 
>>> the file that I edited the order of the statements, and the wrong.SQL is 
>>> the untouched SQL from DAL.
>>>
>>> Inspecting the code, I found the stretch of code that is generating this 
>>> statement, the stretch is this: 
>>> https://github.com/web2py/pydal/blob/fef5ed36f07f211aee7c9a5d2218d2b9f3b77c99/pydal/adapters/base.py#L312,
>>>  
>>> but I dont have idea, why it is in this way!
>>>
>>>
>>>
>>> -- 
>>>
>>> Best Regards.
>>>
>>> Maxwell Morais
>>> Python Developer powered by Webnotes framework <3
>>> +55 11 954329659
>>>
>>>

-- 
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 subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: web2py and python3

2015-11-18 Thread Dave S


On Wednesday, November 18, 2015 at 2:09:45 PM UTC-8, p a wrote:
>
> I like the idea of a new framework, using python 3 but that's not the most 
> important. These days if we want to attract developers to our projects we 
> also need to have an API, and separated front end and back end. web2py is 
> great for the backend. The DAL is fantastic, and every time I get close to 
> an ORM I appreciate it even more. After trying out ractive for myself, I 
> really like Massimo's idea of integrating web2py and ractive.
> So I would love to see a new framework, if we can work on a clear upgrade 
> path that would take existing web2py apps to the new framework. It's much 
> easier to port a web app than a framework, on which many web apps rely. I 
> think we should release the web2py dev team from the chains of backwards 
> compatibility once every few years. If there is a new framework based on 
> the DAL and the other good stuff from web2py, but also using ractive and 
> other technologies and good ideas suggested on this list, then porting our 
> web apps would take a reasonable effort, and it would be well worth it.
>


Maybe call it web2py-R ?

/dps "only half in jest"
 

-- 
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 subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: web2py and python3

2015-11-18 Thread p a
I like the idea of a new framework, using python 3 but that's not the most 
important. These days if we want to attract developers to our projects we 
also need to have an API, and separated front end and back end. web2py is 
great for the backend. The DAL is fantastic, and every time I get close to 
an ORM I appreciate it even more. After trying out ractive for myself, I 
really like Massimo's idea of integrating web2py and ractive.
So I would love to see a new framework, if we can work on a clear upgrade 
path that would take existing web2py apps to the new framework. It's much 
easier to port a web app than a framework, on which many web apps rely. I 
think we should release the web2py dev team from the chains of backwards 
compatibility once every few years. If there is a new framework based on 
the DAL and the other good stuff from web2py, but also using ractive and 
other technologies and good ideas suggested on this list, then porting our 
web apps would take a reasonable effort, and it would be well worth it.

-- 
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 subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: web2py and python3

2015-11-18 Thread Carlos Cesar Caballero Díaz
I think that backward compatibility, when we look it from the distance, 
is more a bug that a feature.


Let me explain before they fall on me like wolves...

In my opinion, the backward compatibility restricts innovation, because 
we do not know what will happen within the next five years, and the new 
way to go can be difficult or impossible (I mean with impossible not 
feasible) to adapt. The other thing is that with the time, there is lot 
of old code making the framework bigger, slower, and harder to maintain.


With this I dont say that we need to change things every week, is very 
good always work thinking in backward compatibility, but can not be a 
straitjacket.


But that's just my opinion.

Greetings.

PD: I can take to write because I'll be out most of the time the next 
two weeks.


El 18/11/15 a las 20:22, Richard Vézina escribió:

What about a relax about backward compatibility with web2py 3.0?

On Wed, Nov 18, 2015 at 6:08 PM, Dave S > wrote:




On Wednesday, November 18, 2015 at 2:09:45 PM UTC-8, p a wrote:

I like the idea of a new framework, using python 3 but that's
not the most important. These days if we want to attract
developers to our projects we also need to have an API, and
separated front end and back end. web2py is great for the
backend. The DAL is fantastic, and every time I get close to
an ORM I appreciate it even more. After trying out ractive for
myself, I really like Massimo's idea of integrating web2py and
ractive.
So I would love to see a new framework, if we can work on a
clear upgrade path that would take existing web2py apps to the
new framework. It's much easier to port a web app than a
framework, on which many web apps rely. I think we should
release the web2py dev team from the chains of backwards
compatibility once every few years. If there is a new
framework based on the DAL and the other good stuff from
web2py, but also using ractive and other technologies and good
ideas suggested on this list, then porting our web apps would
take a reasonable effort, and it would be well worth it.



Maybe call it web2py-R ?

/dps "only half in jest"

-- 
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 subscribed to the Google
Groups "web2py-users" group.
To unsubscribe from this group and stop receiving emails from it,
send an email to web2py+unsubscr...@googlegroups.com
.
For more options, visit https://groups.google.com/d/optout.


--
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 subscribed to the Google 
Groups "web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to web2py+unsubscr...@googlegroups.com 
.

For more options, visit https://groups.google.com/d/optout.




--
Este mensaje le ha llegado mediante el servicio de correo electronico que 
ofrece Infomed para respaldar el cumplimiento de las misiones del Sistema 
Nacional de Salud. La persona que envia este correo asume el compromiso de usar 
el servicio a tales fines y cumplir con las regulaciones establecidas

Infomed: http://www.sld.cu/

--
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 subscribed to the Google Groups "web2py-users" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.