[web2py] Re: web2py 2.15.3-stable: trying to re-bind a field?

2017-08-08 Thread Scott Hunter
How would I determine that, and what would I do about it?  I upgraded using 
the "wizard".

- Scott

On Tuesday, August 8, 2017 at 11:09:42 PM UTC-4, Anthony wrote:
>
> Is it possible when you upgraded to 2.15.3, you failed to get the updated 
> pydal that goes with it?
>
> On Tuesday, August 8, 2017 at 10:20:58 PM UTC-4, Scott Hunter wrote:
>>
>> I have code in my db.py model to add fields to auth_user:
>>
>> auth_extras = [
>> Field('paid', 'boolean',writable=False,readable=False),
>> Field('paidwhen', 'date',writable=False,readable=False),
>> Field('paidamount', 'float',writable=False,readable=False),
>> Field('paymentid',writable=False,readable=False),
>> Field('paidYears','list:integer',default=list(), 
>> writable=False,readable=False )
>> ]
>> auth.settings.extra_fields['auth_user'] = auth_extras
>> auth.define_tables(username=False, signature=False)
>>
>> Which worked fine, until I upgraded to 2.15.3; now I get:
>>
>> 1.
>> 2.
>> 3.
>> 4.
>> 5.
>> 6.
>> 7.
>> 8.
>> 9.
>> 10.
>> 11.
>> 12.
>> 13.
>> 14.
>> 15.
>> 16.
>> 17.
>> 18.
>> 19.
>> 20.
>> 21.
>> 22.
>> 23.
>> 24.
>> 25.
>> 26.
>> 27.
>> 28.
>> 29.
>> 30.
>> 31.
>>
>> Traceback (most recent call last):
>>   File "/Users/shunter/Dropbox/web2py_uki/gluon/restricted.py", line 219, in 
>> restricted
>> exec(ccode, environment)
>>   File "/Users/shunter/Dropbox/web2py_uki/applications/init/models/menu.py" 
>> , line 178, in 
>> 
>> if DEVELOPMENT_MENU: _()
>>   File "/Users/shunter/Dropbox/web2py_uki/applications/init/models/menu.py" 
>> , line 49, in _
>> if auth.has_membership('admin'):
>>   File "/Users/shunter/Dropbox/web2py_uki/gluon/authapi.py", line 575, in 
>> has_membership
>> membership = self.table_membership()
>>   File "/Users/shunter/Dropbox/web2py_uki/gluon/authapi.py", line 175, in 
>> table_membership
>> return self.db[self.settings.table_membership_name]
>>   File "/Users/shunter/Dropbox/web2py_uki/gluon/packages/dal/pydal/base.py", 
>> line 663, in __getitem__
>> return self.__getattr__(str(key))
>>   File "/Users/shunter/Dropbox/web2py_uki/gluon/packages/dal/pydal/base.py", 
>> line 669, in __getattr__
>> return self.lazy_define_table(tablename, *fields, **args)
>>   File "/Users/shunter/Dropbox/web2py_uki/gluon/packages/dal/pydal/base.py", 
>> line 603, in lazy_define_table
>> table._create_references()
>>   File 
>> "/Users/shunter/Dropbox/web2py_uki/gluon/packages/dal/pydal/objects.py", 
>> line 456, in _create_references
>> rtable = db[rtablename]
>>   File "/Users/shunter/Dropbox/web2py_uki/gluon/packages/dal/pydal/base.py", 
>> line 663, in __getitem__
>> return self.__getattr__(str(key))
>>   File "/Users/shunter/Dropbox/web2py_uki/gluon/packages/dal/pydal/base.py", 
>> line 669, in __getattr__
>> return self.lazy_define_table(tablename, *fields, **args)
>>   File "/Users/shunter/Dropbox/web2py_uki/gluon/packages/dal/pydal/base.py", 
>> line 599, in lazy_define_table
>> table = table_class(self, tablename, *fields, **args)
>>   File 
>> "/Users/shunter/Dropbox/web2py_uki/gluon/packages/dal/pydal/objects.py", 
>> line 351, in __init__
>> field.bind(self)
>>   File 
>> "/Users/shunter/Dropbox/web2py_uki/gluon/packages/dal/pydal/objects.py", 
>> line 1633, in bind
>> 'Field %s is already bound to a table' % self.longname)
>> ValueError: Field auth_user.paid is already bound to a table
>>
>>
>> Which is true, but web2py used to know that.  Doesn't matter if 
>> migrations are enabled or not; I get the same part of the trace from the 
>> call to self.lazy_define_table if I comment out the call to 
>> auth.has_membership.
>>
>>

-- 
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: redirect fails with only an error ticket from deep inside the framework

2017-08-08 Thread Anthony
Looks like you don't have a Python MySQL driver installed on your system. 
It works in web2py because web2py includes pymysql in /gluon/contrib (but 
/gluon/contrib is not part of sys.path when running a Python program 
outside of the web2py context).

Anthony

On Tuesday, August 8, 2017 at 9:42:27 PM UTC-4, jim kaubisch wrote:
>
> I would have thought so, but it fails !!!  What am I missing?
>
> about as basic as can be - 
> a plain 2-line vanilla python app  (with a running mysql db, created with 
> the same  "db = DAL('mysql://root:password@localhost/mfm_curr_lib', 
> pool_size = 10) "  and accessed happily by the web2py app)
>
> from pydal import DAL, Field
>
> db = DAL('mysql://root:password@localhost/mfm_curr_lib', pool_size = 10)
>
>
>  … produces 
>
>
> RuntimeError: 'Failure to connect, tried 5 times:\nTraceback (most recent 
> call last):\n File "/Library/Python/2.7/site-packages/pydal/base.py", line 
> 455, in __init__\n self._adapter = adapter(**kwargs)\n File 
> "/Library/Python/2.7/site-packages/pydal/adapters/__init__.py", line 40, in 
> __call__\n obj = super(AdapterMeta, cls).__call__(*args, **kwargs)\n File 
> "/Library/Python/2.7/site-packages/pydal/adapters/base.py", line 373, in 
> __init__\n super(SQLAdapter, self).__init__(*args, **kwargs)\n File 
> "/Library/Python/2.7/site-packages/pydal/adapters/base.py", line 50, in 
> __init__\n self.find_driver()\n File 
> "/Library/Python/2.7/site-packages/pydal/adapters/base.py", line 101, in 
> find_driver\n str(self.drivers))\nRuntimeError: No driver of supported ones 
> (\'MySQLdb\', \'pymysql\', \'mysqlconnector\') is available\n'
>
> module body in mfm_media_model.py at line 63
>
> db = DAL('mysql://root:password@localhost:3306/mfm_curr_lib/', pool_size = 
> 10)
>
> function __call__ in base.py at line 170
>
> obj = super(MetaDAL, cls).__call__(*args, **kwargs)
>
> function __init__ in base.py at line 475
>
> "Failure to connect, tried %d times:\n%s" % (attempts, tb)
> On Tuesday, August 8, 2017 at 6:01:16 PM UTC-7, Anthony wrote:
>>
>> Sure, you can access the same database from multiple applications (web2py 
>> or not).
>>
>> On Tuesday, August 8, 2017 at 6:29:30 PM UTC-4, jim kaubisch wrote:
>>>
>>> Thanks, I think you're right. But its working now, so I'll revisit it 
>>> once the delivery heat is off.
>>>
>>> Please, on the related topic of my other post, I'm I missing something 
>>> by thinking I should be able to access the SAME mysql db both from web2py 
>>> as well as a standard Python program, assuming the same version of DAL? 
>>> In fact, the web2py app creates the db and uses it fine, but the 
>>> standalone app claims it can't connect to it.
>>>
>>> I haven't tried it, but what about 2 web2py apps? Can they access the 
>>> same (mysql) db
>>>
>>> Thanks
>>>
>>> On Tuesday, August 8, 2017 at 12:56:23 PM UTC-7, Anthony wrote:

 As I was developing the app, I realized that I was writing basically 
> the same code over and over and over, just with slight differences, e.g. 
> the table name, the criteria, the fields I wanted to return and their 
> display order...
> so a couple of dictionaries to define (1) the tableviews criteria and 
> (2) ordered list of fields to return and the core becomes a small 
> parameterization of basically the same db query - 10s of lines of code.
>

 Sounds like something you could handle by abstracting everything into a 
 special function and maybe using Python argument unpacking:

 db(db.table).select(*list_of_fields, **dictonary_of_named_arguments)

 Anthony

>>>

-- 
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: web2py 2.15.3-stable: trying to re-bind a field?

2017-08-08 Thread Anthony
Is it possible when you upgraded to 2.15.3, you failed to get the updated 
pydal that goes with it?

On Tuesday, August 8, 2017 at 10:20:58 PM UTC-4, Scott Hunter wrote:
>
> I have code in my db.py model to add fields to auth_user:
>
> auth_extras = [
> Field('paid', 'boolean',writable=False,readable=False),
> Field('paidwhen', 'date',writable=False,readable=False),
> Field('paidamount', 'float',writable=False,readable=False),
> Field('paymentid',writable=False,readable=False),
> Field('paidYears','list:integer',default=list(), 
> writable=False,readable=False )
> ]
> auth.settings.extra_fields['auth_user'] = auth_extras
> auth.define_tables(username=False, signature=False)
>
> Which worked fine, until I upgraded to 2.15.3; now I get:
>
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
> 10.
> 11.
> 12.
> 13.
> 14.
> 15.
> 16.
> 17.
> 18.
> 19.
> 20.
> 21.
> 22.
> 23.
> 24.
> 25.
> 26.
> 27.
> 28.
> 29.
> 30.
> 31.
>
> Traceback (most recent call last):
>   File "/Users/shunter/Dropbox/web2py_uki/gluon/restricted.py", line 219, in 
> restricted
> exec(ccode, environment)
>   File "/Users/shunter/Dropbox/web2py_uki/applications/init/models/menu.py" 
> , line 178, in 
> 
> if DEVELOPMENT_MENU: _()
>   File "/Users/shunter/Dropbox/web2py_uki/applications/init/models/menu.py" 
> , line 49, in _
> if auth.has_membership('admin'):
>   File "/Users/shunter/Dropbox/web2py_uki/gluon/authapi.py", line 575, in 
> has_membership
> membership = self.table_membership()
>   File "/Users/shunter/Dropbox/web2py_uki/gluon/authapi.py", line 175, in 
> table_membership
> return self.db[self.settings.table_membership_name]
>   File "/Users/shunter/Dropbox/web2py_uki/gluon/packages/dal/pydal/base.py", 
> line 663, in __getitem__
> return self.__getattr__(str(key))
>   File "/Users/shunter/Dropbox/web2py_uki/gluon/packages/dal/pydal/base.py", 
> line 669, in __getattr__
> return self.lazy_define_table(tablename, *fields, **args)
>   File "/Users/shunter/Dropbox/web2py_uki/gluon/packages/dal/pydal/base.py", 
> line 603, in lazy_define_table
> table._create_references()
>   File 
> "/Users/shunter/Dropbox/web2py_uki/gluon/packages/dal/pydal/objects.py", line 
> 456, in _create_references
> rtable = db[rtablename]
>   File "/Users/shunter/Dropbox/web2py_uki/gluon/packages/dal/pydal/base.py", 
> line 663, in __getitem__
> return self.__getattr__(str(key))
>   File "/Users/shunter/Dropbox/web2py_uki/gluon/packages/dal/pydal/base.py", 
> line 669, in __getattr__
> return self.lazy_define_table(tablename, *fields, **args)
>   File "/Users/shunter/Dropbox/web2py_uki/gluon/packages/dal/pydal/base.py", 
> line 599, in lazy_define_table
> table = table_class(self, tablename, *fields, **args)
>   File 
> "/Users/shunter/Dropbox/web2py_uki/gluon/packages/dal/pydal/objects.py", line 
> 351, in __init__
> field.bind(self)
>   File 
> "/Users/shunter/Dropbox/web2py_uki/gluon/packages/dal/pydal/objects.py", line 
> 1633, in bind
> 'Field %s is already bound to a table' % self.longname)
> ValueError: Field auth_user.paid is already bound to a table
>
>
> Which is true, but web2py used to know that.  Doesn't matter if migrations 
> are enabled or not; I get the same part of the trace from the call to self
> .lazy_define_table if I comment out the call to auth.has_membership.
>
>

-- 
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: web2py with js framework

2017-08-08 Thread 黄祥
thanks for reference anthony, already seen and learned from web2py scaffold 
(vue + whoosh) but for me, it's complex
i want to learn it start from simple first, perhaps there is another simple 
web2py app with whatever js framework (1 table with 1 field that have CRUD 
operation or GRID is enough to know web2py job's part and js framework jobs 
part)

thanks and 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 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] web2py 2.15.3-stable: trying to re-bind a field?

2017-08-08 Thread Scott Hunter
I have code in my db.py model to add fields to auth_user:

auth_extras = [
Field('paid', 'boolean',writable=False,readable=False),
Field('paidwhen', 'date',writable=False,readable=False),
Field('paidamount', 'float',writable=False,readable=False),
Field('paymentid',writable=False,readable=False),
Field('paidYears','list:integer',default=list(), 
writable=False,readable=False )
]
auth.settings.extra_fields['auth_user'] = auth_extras
auth.define_tables(username=False, signature=False)

Which worked fine, until I upgraded to 2.15.3; now I get:

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.

Traceback (most recent call last):
  File "/Users/shunter/Dropbox/web2py_uki/gluon/restricted.py", line 219, in 
restricted
exec(ccode, environment)
  File "/Users/shunter/Dropbox/web2py_uki/applications/init/models/menu.py" 
, line 178, in 

if DEVELOPMENT_MENU: _()
  File "/Users/shunter/Dropbox/web2py_uki/applications/init/models/menu.py" 
, line 49, in _
if auth.has_membership('admin'):
  File "/Users/shunter/Dropbox/web2py_uki/gluon/authapi.py", line 575, in 
has_membership
membership = self.table_membership()
  File "/Users/shunter/Dropbox/web2py_uki/gluon/authapi.py", line 175, in 
table_membership
return self.db[self.settings.table_membership_name]
  File "/Users/shunter/Dropbox/web2py_uki/gluon/packages/dal/pydal/base.py", 
line 663, in __getitem__
return self.__getattr__(str(key))
  File "/Users/shunter/Dropbox/web2py_uki/gluon/packages/dal/pydal/base.py", 
line 669, in __getattr__
return self.lazy_define_table(tablename, *fields, **args)
  File "/Users/shunter/Dropbox/web2py_uki/gluon/packages/dal/pydal/base.py", 
line 603, in lazy_define_table
table._create_references()
  File "/Users/shunter/Dropbox/web2py_uki/gluon/packages/dal/pydal/objects.py", 
line 456, in _create_references
rtable = db[rtablename]
  File "/Users/shunter/Dropbox/web2py_uki/gluon/packages/dal/pydal/base.py", 
line 663, in __getitem__
return self.__getattr__(str(key))
  File "/Users/shunter/Dropbox/web2py_uki/gluon/packages/dal/pydal/base.py", 
line 669, in __getattr__
return self.lazy_define_table(tablename, *fields, **args)
  File "/Users/shunter/Dropbox/web2py_uki/gluon/packages/dal/pydal/base.py", 
line 599, in lazy_define_table
table = table_class(self, tablename, *fields, **args)
  File "/Users/shunter/Dropbox/web2py_uki/gluon/packages/dal/pydal/objects.py", 
line 351, in __init__
field.bind(self)
  File "/Users/shunter/Dropbox/web2py_uki/gluon/packages/dal/pydal/objects.py", 
line 1633, in bind
'Field %s is already bound to a table' % self.longname)
ValueError: Field auth_user.paid is already bound to a table


Which is true, but web2py used to know that.  Doesn't matter if migrations 
are enabled or not; I get the same part of the trace from the call to self.
lazy_define_table if I comment out the call to auth.has_membership.

-- 
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: redirect fails with only an error ticket from deep inside the framework

2017-08-08 Thread 黄祥
seen the error you provide seems that there is no mysql driver python 
module installed

RuntimeError: No driver of supported ones (\'MySQLdb\', \'pymysql\', 
\'mysqlconnector\') is available\n'

perhaps installed mysql python module (using pip or etc) can solve the 
problem.

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 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: redirect fails with only an error ticket from deep inside the framework

2017-08-08 Thread 'jim kaubisch' via web2py-users
I would have thought so, but it fails !!!  What am I missing?

about as basic as can be - 
a plain 2-line vanilla python app  (with a running mysql db, created with 
the same  "db = DAL('mysql://root:password@localhost/mfm_curr_lib', 
pool_size = 10) "  and accessed happily by the web2py app)

from pydal import DAL, Field

db = DAL('mysql://root:password@localhost/mfm_curr_lib', pool_size = 10)


 … produces 


RuntimeError: 'Failure to connect, tried 5 times:\nTraceback (most recent 
call last):\n File "/Library/Python/2.7/site-packages/pydal/base.py", line 
455, in __init__\n self._adapter = adapter(**kwargs)\n File 
"/Library/Python/2.7/site-packages/pydal/adapters/__init__.py", line 40, in 
__call__\n obj = super(AdapterMeta, cls).__call__(*args, **kwargs)\n File 
"/Library/Python/2.7/site-packages/pydal/adapters/base.py", line 373, in 
__init__\n super(SQLAdapter, self).__init__(*args, **kwargs)\n File 
"/Library/Python/2.7/site-packages/pydal/adapters/base.py", line 50, in 
__init__\n self.find_driver()\n File 
"/Library/Python/2.7/site-packages/pydal/adapters/base.py", line 101, in 
find_driver\n str(self.drivers))\nRuntimeError: No driver of supported ones 
(\'MySQLdb\', \'pymysql\', \'mysqlconnector\') is available\n'

module body in mfm_media_model.py at line 63

db = DAL('mysql://root:password@localhost:3306/mfm_curr_lib/', pool_size = 
10)

function __call__ in base.py at line 170

obj = super(MetaDAL, cls).__call__(*args, **kwargs)

function __init__ in base.py at line 475

"Failure to connect, tried %d times:\n%s" % (attempts, tb)
On Tuesday, August 8, 2017 at 6:01:16 PM UTC-7, Anthony wrote:
>
> Sure, you can access the same database from multiple applications (web2py 
> or not).
>
> On Tuesday, August 8, 2017 at 6:29:30 PM UTC-4, jim kaubisch wrote:
>>
>> Thanks, I think you're right. But its working now, so I'll revisit it 
>> once the delivery heat is off.
>>
>> Please, on the related topic of my other post, I'm I missing something by 
>> thinking I should be able to access the SAME mysql db both from web2py as 
>> well as a standard Python program, assuming the same version of DAL? 
>> In fact, the web2py app creates the db and uses it fine, but the 
>> standalone app claims it can't connect to it.
>>
>> I haven't tried it, but what about 2 web2py apps? Can they access the 
>> same (mysql) db
>>
>> Thanks
>>
>> On Tuesday, August 8, 2017 at 12:56:23 PM UTC-7, Anthony wrote:
>>>
>>> As I was developing the app, I realized that I was writing basically the 
 same code over and over and over, just with slight differences, e.g. the 
 table name, the criteria, the fields I wanted to return and their display 
 order...
 so a couple of dictionaries to define (1) the tableviews criteria and 
 (2) ordered list of fields to return and the core becomes a small 
 parameterization of basically the same db query - 10s of lines of code.

>>>
>>> Sounds like something you could handle by abstracting everything into a 
>>> special function and maybe using Python argument unpacking:
>>>
>>> db(db.table).select(*list_of_fields, **dictonary_of_named_arguments)
>>>
>>> Anthony
>>>
>>

-- 
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: redirect fails with only an error ticket from deep inside the framework

2017-08-08 Thread 'jim kaubisch' via web2py-users


On Monday, August 7, 2017 at 4:29:30 PM UTC-7, jim kaubisch wrote:
>
> Hi,
>
> The following failure suddenly started in a piece of code thats been 
> running error free for months. I can think of nothing I’ve changed that 
> would cause this to happen (famous last words, I know).
> I've tried for hours to find something to explain this, without any 
> success 
> ANY ideas would be greatly appreciated. My hope is that people with a 
> deeper understanding of the web2py framework might have ideas..
>
> Thanks in advance!!
> Jim
> -
> The last moments of life are as follows..
>
> two variables, s and db_str,  are generated dynamically but end up having 
> values as follows...
>
> s= " 0)>"
> db_str = "s.select(db[media_table].id, db[media_table].name, 
> db[media_table].akaname, db[media_table].category)"
>
> try:
>session.media_list = eval(db_str)
> except Exception as e:
>logger.debug('This is what happened: %s' % e)
>raise
>
> logger.debug("redirecting...")
> redirect(URL('default', 'list_rows'))
>
> No exception thrown, 
> the debug message is displayed, 
> but it never gets to “list_rows” it seems (First line in list_rows is 
> another debug message
>
>
> instead, the following …
>
> Error ticket for "mfm_test"
> Ticket ID 
> 127.0.0.1.2017-08-07.15-22-39.88b049a9-c5f0-4b47-9aba-600839871461
> Version web2py™
> Version 2.14.6-stable+timestamp.2016.05.10.00.21.47
>
> Traceback
> 1.Traceback (most recent call last):
> 2.  File "/Users/jimkaubisch 1/Dropbox 
> (MFM)/MfMCurrAdmin/Development/web2py/start/gluon/main.py", line 438, in 
> wsgibase
> 3.session.connect(request, response)
> 4. File "/Users/jimkaubisch 1/Dropbox 
> (MFM)/MfMCurrAdmin/Development/web2py/start/gluon/globals.py", line 965, in 
> connect
> 5.   session_pickled = pickle.dumps(self, pickle.HIGHEST_PROTOCOL)
> 6. File "/Library/Python/2.7/site-packages/pydal/objects.py", line 2946, 
> in __getstate__
> 7.   del ret['fields']
> 8. KeyError: 'fields'
> 9.
>
> In file: Framework
> 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: redirect fails with only an error ticket from deep inside the framework

2017-08-08 Thread Anthony
Sure, you can access the same database from multiple applications (web2py 
or not).

On Tuesday, August 8, 2017 at 6:29:30 PM UTC-4, jim kaubisch wrote:
>
> Thanks, I think you're right. But its working now, so I'll revisit it once 
> the delivery heat is off.
>
> Please, on the related topic of my other post, I'm I missing something by 
> thinking I should be able to access the SAME mysql db both from web2py as 
> well as a standard Python program, assuming the same version of DAL? 
> In fact, the web2py app creates the db and uses it fine, but the 
> standalone app claims it can't connect to it.
>
> I haven't tried it, but what about 2 web2py apps? Can they access the same 
> (mysql) db
>
> Thanks
>
> On Tuesday, August 8, 2017 at 12:56:23 PM UTC-7, Anthony wrote:
>>
>> As I was developing the app, I realized that I was writing basically the 
>>> same code over and over and over, just with slight differences, e.g. the 
>>> table name, the criteria, the fields I wanted to return and their display 
>>> order...
>>> so a couple of dictionaries to define (1) the tableviews criteria and 
>>> (2) ordered list of fields to return and the core becomes a small 
>>> parameterization of basically the same db query - 10s of lines of code.
>>>
>>
>> Sounds like something you could handle by abstracting everything into a 
>> special function and maybe using Python argument unpacking:
>>
>> db(db.table).select(*list_of_fields, **dictonary_of_named_arguments)
>>
>> Anthony
>>
>

-- 
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: $.web2py is undefined

2017-08-08 Thread Anthony
We probably need to see more code. It is not quite clear when/where you are 
getting that error. If all the code you have shown below is on the same 
page, you could not get that error with one tab but not the other, as 
obviously $.web2py is either defined or not on that page.

Anthony

On Tuesday, August 8, 2017 at 5:56:31 AM UTC-4, Filipe Reis wrote:
>
> Hey guys what I'm trying to do is using bootstrap tabs load other views 
> using $.web2py.component() the first time it works but the the other 
> controllers or tabs gives me TypeError: $.web2py is undefined. Anyone knows 
> how to fix this issue?
>
> $('.nav-tabs a[href="#tab_1"]').on('shown.bs.tab', function (e){
>  $.web2py.component("{{=URL('ctr1','show', args=id, 
> user_signature=True)}}", target="div1");
>  return false;
> });
> $('.nav-tabs a[href="#tab_2"]').on('show.bs.tab', function (e){
>  $.web2py.component("{{=URL('ctr2','show', args=id, 
> user_signature=True)}}", target="div2");
>  return false;
> });
>
>

-- 
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: web2py with js framework

2017-08-08 Thread Anthony
See if this helps: https://github.com/web2py/scaffold

On Tuesday, August 8, 2017 at 8:54:12 PM UTC-4, 黄祥 wrote:
>
> is there any simple web2py app with js framework (whatever) that have a 
> CRUD or GRID example?
> want to learn to combine it, but confuse, what is web2py job (define 
> models, provide restful api, any others ?), what is js framework job 
> (client side response) ? how about the form handling (web2py or js job?)
> some of dev in here talk about vuejs, so i just look at it and learn from 
> the example
> https://vuejs.org/v2/examples/grid-component.html
>
> but again, don't know how to connect it with web2py, any hints or example 
> maybe.
>
> thanks and 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 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] web2py with js framework

2017-08-08 Thread 黄祥
is there any simple web2py app with js framework (whatever) that have a 
CRUD or GRID example?
want to learn to combine it, but confuse, what is web2py job (define 
models, provide restful api, any others ?), what is js framework job 
(client side response) ? how about the form handling (web2py or js job?)
some of dev in here talk about vuejs, so i just look at it and learn from 
the example
https://vuejs.org/v2/examples/grid-component.html

but again, don't know how to connect it with web2py, any hints or example 
maybe.

thanks and 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 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: Select image path and content from a db(table).select()

2017-08-08 Thread Leonel Câmara
I haven't tested it, but you could do something like 

import base64


def my_awesome_api():
def b64representer(path, row):
fname, stream = db.table_name.your_upload_field.retrieve(path)
return {'filename': fname, 'data': base64.b64encode(stream.read())}

db.table_name.your_upload_field.represent = b64representer
return response.json(list(db(db.table_name.id > 0).select().render()))

-- 
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: redirect fails with only an error ticket from deep inside the framework

2017-08-08 Thread 'jim kaubisch' via web2py-users
Thanks, I think you're right. But its working now, so I'll revisit it once 
the delivery heat is off.

Please, on the related topic of my other post, I'm I missing something by 
thinking I should be able to access the SAME mysql db both from web2py as 
well as a standard Python program, assuming the same version of DAL? 
In fact, the web2py app creates the db and uses it fine, but the standalone 
app claims it can't connect to it.

I haven't tried it, but what about 2 web2py apps? Can they access the same 
(mysql) db

Thanks

On Tuesday, August 8, 2017 at 12:56:23 PM UTC-7, Anthony wrote:
>
> As I was developing the app, I realized that I was writing basically the 
>> same code over and over and over, just with slight differences, e.g. the 
>> table name, the criteria, the fields I wanted to return and their display 
>> order...
>> so a couple of dictionaries to define (1) the tableviews criteria and (2) 
>> ordered list of fields to return and the core becomes a small 
>> parameterization of basically the same db query - 10s of lines of code.
>>
>
> Sounds like something you could handle by abstracting everything into a 
> special function and maybe using Python argument unpacking:
>
> db(db.table).select(*list_of_fields, **dictonary_of_named_arguments)
>
> Anthony
>

-- 
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] Select image path and content from a db(table).select()

2017-08-08 Thread Luciano Laporta Podazza
Hello,

I was wondering how to do a web service (json) to select all rows from a 
table, where there's an 'upload' field type and return them in JSON, with 
"upload" field data (images) encoded in base64. 
The problem I'm having is that when I do the db(table_name).select() I'm 
only getting the image path but not the conten. It would be nice to get 
that in a few lines of code instead of having to build my own logic.

Hope it makes sense to you.

Thanks in advance!

-- 
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] pycharm and web2py - setup project

2017-08-08 Thread Kirill Shatalaev
Hello, I have Pycharm 2017.2 (Professional version).

And autocompletion and Parameter info (ctrl+p) does not work out of the box 
for my project.

But, when I install pyDAL package on my project interpreter options, and it 
starts to work (see attached screenshot).

This is not the right way: using pydal as a separate package; this causes 
troubles. For example, 2.15.3 web2py crashing on start if pyDAL is 
installed to my venv as additional package.

What can I do to make autocompletion and parameter info usable?

-- 
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] $.web2py is undefined

2017-08-08 Thread Filipe Reis
What I'm trying to do is to only load a tab content when its shown, then it 
loads with the web2py_component... Would you do differently? How so? It 
works on the first time... but then I get the undefined error...

terça-feira, 8 de Agosto de 2017 às 20:38:05 UTC+1, Richard escreveu:
>
> I would have embeded all the bts codes in the web2py component... You 
> appears to try to apply bootstrap tabs feature over 2 differents web2py 
> component, this doesn't make much sens, I guess it all coming from there...
>
> Richard
>
> On Tue, Aug 8, 2017 at 3:34 PM, Richard Vézina  > wrote:
>
>> Why doing that with web2py_component??
>>
>> On Tue, Aug 8, 2017 at 5:56 AM, Filipe Reis > > wrote:
>>
>>> Hey guys what I'm trying to do is using bootstrap tabs load other views 
>>> using $.web2py.component() the first time it works but the the other 
>>> controllers or tabs gives me TypeError: $.web2py is undefined. Anyone knows 
>>> how to fix this issue?
>>>
>>> $('.nav-tabs a[href="#tab_1"]').on('shown.bs.tab', function (e){
>>>  $.web2py.component("{{=URL('ctr1','show', args=id, 
>>> user_signature=True)}}", target="div1");
>>>  return false;
>>> });
>>> $('.nav-tabs a[href="#tab_2"]').on('show.bs.tab', function (e){
>>>  $.web2py.component("{{=URL('ctr2','show', args=id, 
>>> user_signature=True)}}", target="div2");
>>>  return false;
>>> });
>>>
>>> -- 
>>> 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+un...@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: redirect fails with only an error ticket from deep inside the framework

2017-08-08 Thread Anthony

>
> As I was developing the app, I realized that I was writing basically the 
> same code over and over and over, just with slight differences, e.g. the 
> table name, the criteria, the fields I wanted to return and their display 
> order...
> so a couple of dictionaries to define (1) the tableviews criteria and (2) 
> ordered list of fields to return and the core becomes a small 
> parameterization of basically the same db query - 10s of lines of code.
>

Sounds like something you could handle by abstracting everything into a 
special function and maybe using Python argument unpacking:

db(db.table).select(*list_of_fields, **dictonary_of_named_arguments)

Anthony

-- 
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: Documenting a file with sphinx, that has local_import in it

2017-08-08 Thread Richard Vézina
Saddly never had time to integrate such tools in my project... I never
really understand the concept of Epydoc for my part haha!!

Richard

On Tue, Aug 8, 2017 at 3:45 PM, Carl Hunter Roach 
wrote:

> Thanks Richard.
> Are you using an alernative to Sphinx with your web2py projects?
> I've tried epydoc which is straightforward but I found  its docstring
> format a little labourious.
>
> On Tue, 8 Aug 2017 at 18:24, Richard Vézina 
> wrote:
>
>> I look at sphinx a long time ago, so you kind of lost me now... But I
>> tought after I press send that fact that web2py doc is available with
>> readthedoc which is (correct me if I am wrong) base on sphinx, so web2py is
>> suppose to work with sphinx... But web2py apps, I guess it another story,
>> for some of the reasons you mention... About request and other web2py
>> environnement objects maybe you can work something base on this workaround
>> related to IDE :
>>
>> http://web2py.com/books/default/chapter/29/14/other-
>> recipes#Using-general-purpose-IDEs-with-web2py
>>
>> On Tue, Aug 8, 2017 at 12:39 PM, Carl Hunter Roach 
>> wrote:
>>
>>> thanks Richard.
>>>
>>> I saw the changelog thanking Niphold wrt docstrings but only found
>>> Massimo's suggestion of additional code to add to each .py file to get
>>> Sphinx to "find" all my project files.
>>>
>>> Off the bat, after I point Sphinx at gluon, I get errors about request,
>>> current et al not being found. This is what I expected given web2py's
>>> architecture. I'm just on the hunt for a workaround.
>>>
>>> I see that gluon/packages/dal has Sphinx definition files but these, I
>>> don't think, provide clues to how to deal with request et al. And gluon
>>> itself doesn't have Sphinx config files so, perhaps, Sphinx-support has a
>>> way to go?
>>>
>>>
>>> On Tue, 8 Aug 2017 at 16:51 Richard Vézina 
>>> wrote:
>>>
 I think web2py is sphinx compliant now, I recall that Simone (Niphold)
 had refactor docstring to do so... To be confirmed...

 Richard

 On Tue, Aug 8, 2017 at 11:06 AM, Carl Hunter Roach <
 c...@hunterroach.com> wrote:

> Is this still the recommended workaround to get Sphinx to generate
> documentation for projects built upon Web2py?
>
>
>
> On Saturday, 28 May 2011 16:18:42 UTC+1, Massimo Di Pierro wrote:
>>
>> controllers and models in web2py are written in python but are not
>> python modules. They use objects
>> (request,response,...,local_import,...) that are not imported.
>>
>> Sphinx does not understand this.
>>
>> I am sure there is a way around (for example add to your models and
>> controllers:
>>
>> if 1:
>> from gluon import *
>> request,response,session,cache,T = \
>>current.request,current.response,
>>current.session,current.cache,current.T
>> from gluon.compileapp import local_import_aux as local_import
>>
>> ) but I cannot say for sure without details about what you are trying
>> to do.
>>
>>
>>
>>
>>
>> On May 28, 3:47 am, Vasil Petkov  wrote:
>> > Hello!
>> >
>> > I use web2py 1.94 on Ubuntu with Python 2.7 and Sphinx 1.0.7. For
>> the
>> > documentation purposes, i have created a 'doc'-directory inside my
>> > web2py-application. My web2py project has the following structure:
>> >
>> > web2py
>> >|_ server
>> >|  |_ applications
>> >||_ init
>> >|| |_ controllers
>> >||   |_ myapp.py
>> >   ... ...
>> >||_ modules
>> >|  |_ xml2obj.py
>> >   ...
>> >|_ doc
>> >
>> > When i try to generate documentation for the myapp.py-file with
>> > sphinx, i get the following warning:
>> >
>> >  Traceback (most recent call
>> > last):
>> >   File "/usr/local/lib/python2.7/dist-packages/Sphinx-1.0.7-py2.7.egg/
>>
>> > sphinx/ext/autodoc.py", line 329, in import_object
>> > __import__(self.modname)
>> >   File "/home/vpetkov/Documents/web2py/server/applications/init/
>> > controllers/myapp.py", line 16, in 
>> > xml2obj = local_import('xml2obj', reload=False)
>> > NameError: name 'local_import' is not defined
>> >
>> > /home/vpetkov/Documents/web2py/server/doc/myapp.rst:7: (WARNING/2)
>> > autodoc can't import/find module 'myapp', it reported error: "name
>> > 'local_import' is not defined", please check your spelling and
>> > sys.path
>> >
>> > Additionally. in conf.py Sphinx file, i added
>> > sys.path.append(os.path.abspath('../applications/init/modules/'))
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source 

Re: [web2py] Re: Documenting a file with sphinx, that has local_import in it

2017-08-08 Thread Carl Hunter Roach
Thanks Richard.
Are you using an alernative to Sphinx with your web2py projects?
I've tried epydoc which is straightforward but I found  its docstring
format a little labourious.

On Tue, 8 Aug 2017 at 18:24, Richard Vézina 
wrote:

> I look at sphinx a long time ago, so you kind of lost me now... But I
> tought after I press send that fact that web2py doc is available with
> readthedoc which is (correct me if I am wrong) base on sphinx, so web2py is
> suppose to work with sphinx... But web2py apps, I guess it another story,
> for some of the reasons you mention... About request and other web2py
> environnement objects maybe you can work something base on this workaround
> related to IDE :
>
>
> http://web2py.com/books/default/chapter/29/14/other-recipes#Using-general-purpose-IDEs-with-web2py
>
> On Tue, Aug 8, 2017 at 12:39 PM, Carl Hunter Roach 
> wrote:
>
>> thanks Richard.
>>
>> I saw the changelog thanking Niphold wrt docstrings but only found
>> Massimo's suggestion of additional code to add to each .py file to get
>> Sphinx to "find" all my project files.
>>
>> Off the bat, after I point Sphinx at gluon, I get errors about request,
>> current et al not being found. This is what I expected given web2py's
>> architecture. I'm just on the hunt for a workaround.
>>
>> I see that gluon/packages/dal has Sphinx definition files but these, I
>> don't think, provide clues to how to deal with request et al. And gluon
>> itself doesn't have Sphinx config files so, perhaps, Sphinx-support has a
>> way to go?
>>
>>
>> On Tue, 8 Aug 2017 at 16:51 Richard Vézina 
>> wrote:
>>
>>> I think web2py is sphinx compliant now, I recall that Simone (Niphold)
>>> had refactor docstring to do so... To be confirmed...
>>>
>>> Richard
>>>
>>> On Tue, Aug 8, 2017 at 11:06 AM, Carl Hunter Roach >> > wrote:
>>>
 Is this still the recommended workaround to get Sphinx to generate
 documentation for projects built upon Web2py?



 On Saturday, 28 May 2011 16:18:42 UTC+1, Massimo Di Pierro wrote:
>
> controllers and models in web2py are written in python but are not
> python modules. They use objects
> (request,response,...,local_import,...) that are not imported.
>
> Sphinx does not understand this.
>
> I am sure there is a way around (for example add to your models and
> controllers:
>
> if 1:
> from gluon import *
> request,response,session,cache,T = \
>current.request,current.response,
>current.session,current.cache,current.T
> from gluon.compileapp import local_import_aux as local_import
>
> ) but I cannot say for sure without details about what you are trying
> to do.
>
>
>
>
>
> On May 28, 3:47 am, Vasil Petkov  wrote:
> > Hello!
> >
> > I use web2py 1.94 on Ubuntu with Python 2.7 and Sphinx 1.0.7. For
> the
> > documentation purposes, i have created a 'doc'-directory inside my
> > web2py-application. My web2py project has the following structure:
> >
> > web2py
> >|_ server
> >|  |_ applications
> >||_ init
> >|| |_ controllers
> >||   |_ myapp.py
> >   ... ...
> >||_ modules
> >|  |_ xml2obj.py
> >   ...
> >|_ doc
> >
> > When i try to generate documentation for the myapp.py-file with
> > sphinx, i get the following warning:
> >
> >  Traceback (most recent call
> > last):
> >   File
> "/usr/local/lib/python2.7/dist-packages/Sphinx-1.0.7-py2.7.egg/
> > sphinx/ext/autodoc.py", line 329, in import_object
> > __import__(self.modname)
> >   File "/home/vpetkov/Documents/web2py/server/applications/init/
> > controllers/myapp.py", line 16, in 
> > xml2obj = local_import('xml2obj', reload=False)
> > NameError: name 'local_import' is not defined
> >
> > /home/vpetkov/Documents/web2py/server/doc/myapp.rst:7: (WARNING/2)
> > autodoc can't import/find module 'myapp', it reported error: "name
> > 'local_import' is not defined", please check your spelling and
> > sys.path
> >
> > Additionally. in conf.py Sphinx file, i added
> > sys.path.append(os.path.abspath('../applications/init/modules/'))

 --
 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, 

[web2py] Re: AttributeError: 'SQLite' object has no attribute 'file_open'

2017-08-08 Thread Lisandro
Same problem here, but using PostgreSQL.
This is the function that I was using to connect to a database:

def connect_db(db_host, db_name, db_user, db_user_password):
# gets the table_hash from one of the .table files in the databases 
folder
table_hash = None
for file in os.listdir(databases_folder):
if archivo.endswith('.table'):
table_hash = file.split('_')[0]
break
return DAL('postgres://%s:%s@%s:5432/%s' % (db_user, db_user_password, 
db_host, db_name),
   migrate=False,
   folder=databases_folder,
   auto_import=True,
   table_hash=table_hash)


But after upgrading to 2.15.3, the function throws this error:

Traceback (most recent call last):
  File "/home/gonguinguen/medios/gluon/restricted.py", line 219, in restricted
exec(ccode, environment)
  File "/home/gonguinguen/medios/applications/webmedios/controllers/admin.py", 
line 550, in 
  File "/home/gonguinguen/medios/gluon/globals.py", line 409, in 
self._caller = lambda f: f()
  File "/home/gonguinguen/medios/applications/webmedios/controllers/admin.py", 
line 548, in prueba
dbs = sitio.conectar_db()
  File "/home/gonguinguen/medios/gluon/packages/dal/pydal/objects.py", line 
2368, in __call__
return self.method(self.row, *args, **kwargs)
  File "/home/gonguinguen/medios/applications/webmedios/models/db.py", line 
149, in 
Field.Method('conectar_db', lambda row: sitios_conectar_db(row.sitios)),
  File "applications/webmedios/modules/virtual_methods.py", line 79, in 
sitios_conectar_db
table_hash=table_hash)
  File "/home/gonguinguen/medios/gluon/packages/dal/pydal/base.py", line 170, 
in __call__
obj = super(MetaDAL, cls).__call__(*args, **kwargs)
  File "/home/gonguinguen/medios/gluon/packages/dal/pydal/base.py", line 500, 
in __init__
tables=tables)
  File "/home/gonguinguen/medios/gluon/packages/dal/pydal/base.py", line 522, 
in import_table_definitions
tfile = self._adapter.file_open(filename, 'r')
AttributeError: 'PostgrePsyco' object has no attribute 'file_open'



Meanwhile, I'll check if there is an opened issue about this.
Let me know if there is anything I can do to help you fix the problem.


El jueves, 20 de julio de 2017, 18:56:29 (UTC-3), Massimo Di Pierro 
escribió:
>
> Can you please open a PyDAL ticket so we can track. This should work.
>
> On Saturday, 15 July 2017 05:13:45 UTC-5, Jitun John wrote:
>>
>> Here is a Code that worked fine on 2.14.6 but doesn't on 2.15.1
>>
>>
>> import datetime
>> import gc
>> import os
>> from gluon import *
>> from current_config import *
>> from memory_profiler import memory_usage
>>
>>
>> manager_rows = ''
>>
>>
>> dummy_path = os.path.abspath('.') + 
>> '/applications/enLIGHTen/static/dummy/'
>>
>>
>> def read_alerts_rows():
>> alerts_db_conn = DAL('sqlite://alerts.sqlite', folder=
>> get_current_path(), auto_import=True)
>> global alerts_rows
>> alerts_rows = alerts_db_conn(alerts_db_conn.alerts_log.id > 0).select
>> (orderby=alerts_db_conn.alerts_log.datetime)
>> alerts_db_conn.close()
>>
>>
>> def get_alerts_rows():
>> return alerts_rows
>>
>>
>> 
>>
>>
>> def add_clear():
>> dummy_alerts_db_conn = DAL('sqlite://alerts.sqlite', folder=
>> dummy_path, auto_import=True)
>> global alerts_rows
>>
>>
>> 
>>
>>
>> Gives the following error.
>>
>> File "applications\enLIGHTen\modules\read_logs_to_rows.py", line 141, in 
>> add_clear
>>  dummy_alerts_db_conn = DAL('sqlite://alerts.sqlite', folder=dummy_path, 
>> auto_import=True)
>>  File 
>> "E:\Jitun_Backup\Web2py\web2py_win_2.15.1\gluon\packages\dal\pydal\base.py", 
>> line 170, in __call__
>>  obj = super(MetaDAL, cls).__call__(*args, **kwargs)
>>  File 
>> "E:\Jitun_Backup\Web2py\web2py_win_2.15.1\gluon\packages\dal\pydal\base.py", 
>> line 500, in __init__
>>  tables=tables)
>>  File 
>> "E:\Jitun_Backup\Web2py\web2py_win_2.15.1\gluon\packages\dal\pydal\base.py", 
>> line 522, in import_table_definitions
>>  tfile = self._adapter.file_open(filename, 'r')
>> AttributeError: 'SQLite' object has no attribute 'file_open'
>>
>> Any pointers/help is appreciated.
>>
>>
>>
>>
>>

-- 
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] $.web2py is undefined

2017-08-08 Thread Richard Vézina
I would have embeded all the bts codes in the web2py component... You
appears to try to apply bootstrap tabs feature over 2 differents web2py
component, this doesn't make much sens, I guess it all coming from there...

Richard

On Tue, Aug 8, 2017 at 3:34 PM, Richard Vézina 
wrote:

> Why doing that with web2py_component??
>
> On Tue, Aug 8, 2017 at 5:56 AM, Filipe Reis  wrote:
>
>> Hey guys what I'm trying to do is using bootstrap tabs load other views
>> using $.web2py.component() the first time it works but the the other
>> controllers or tabs gives me TypeError: $.web2py is undefined. Anyone knows
>> how to fix this issue?
>>
>> $('.nav-tabs a[href="#tab_1"]').on('shown.bs.tab', function (e){
>>  $.web2py.component("{{=URL('ctr1','show', args=id,
>> user_signature=True)}}", target="div1");
>>  return false;
>> });
>> $('.nav-tabs a[href="#tab_2"]').on('show.bs.tab', function (e){
>>  $.web2py.component("{{=URL('ctr2','show', args=id,
>> user_signature=True)}}", target="div2");
>>  return false;
>> });
>>
>> --
>> 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] $.web2py is undefined

2017-08-08 Thread Richard Vézina
Why doing that with web2py_component??

On Tue, Aug 8, 2017 at 5:56 AM, Filipe Reis  wrote:

> Hey guys what I'm trying to do is using bootstrap tabs load other views
> using $.web2py.component() the first time it works but the the other
> controllers or tabs gives me TypeError: $.web2py is undefined. Anyone knows
> how to fix this issue?
>
> $('.nav-tabs a[href="#tab_1"]').on('shown.bs.tab', function (e){
>  $.web2py.component("{{=URL('ctr1','show', args=id,
> user_signature=True)}}", target="div1");
>  return false;
> });
> $('.nav-tabs a[href="#tab_2"]').on('show.bs.tab', function (e){
>  $.web2py.component("{{=URL('ctr2','show', args=id,
> user_signature=True)}}", target="div2");
>  return false;
> });
>
> --
> 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: redirect fails with only an error ticket from deep inside the framework

2017-08-08 Thread 'jim kaubisch' via web2py-users

Anthony,

uninstalled pydal 17.07, installed 16.11 instead (seemed the most likely 
candidate for being the right version) - 
things now work normally! 

Thanks for the pointer to the problem



On Monday, August 7, 2017 at 4:29:30 PM UTC-7, jim kaubisch wrote:
>
> Hi,
>
> The following failure suddenly started in a piece of code thats been 
> running error free for months. I can think of nothing I’ve changed that 
> would cause this to happen (famous last words, I know).
> I've tried for hours to find something to explain this, without any 
> success 
> ANY ideas would be greatly appreciated. My hope is that people with a 
> deeper understanding of the web2py framework might have ideas..
>
> Thanks in advance!!
> Jim
> -
> The last moments of life are as follows..
>
> two variables, s and db_str,  are generated dynamically but end up having 
> values as follows...
>
> s= " 0)>"
> db_str = "s.select(db[media_table].id, db[media_table].name, 
> db[media_table].akaname, db[media_table].category)"
>
> try:
>session.media_list = eval(db_str)
> except Exception as e:
>logger.debug('This is what happened: %s' % e)
>raise
>
> logger.debug("redirecting...")
> redirect(URL('default', 'list_rows'))
>
> No exception thrown, 
> the debug message is displayed, 
> but it never gets to “list_rows” it seems (First line in list_rows is 
> another debug message
>
>
> instead, the following …
>
> Error ticket for "mfm_test"
> Ticket ID 
> 127.0.0.1.2017-08-07.15-22-39.88b049a9-c5f0-4b47-9aba-600839871461
> Version web2py™
> Version 2.14.6-stable+timestamp.2016.05.10.00.21.47
>
> Traceback
> 1.Traceback (most recent call last):
> 2.  File "/Users/jimkaubisch 1/Dropbox 
> (MFM)/MfMCurrAdmin/Development/web2py/start/gluon/main.py", line 438, in 
> wsgibase
> 3.session.connect(request, response)
> 4. File "/Users/jimkaubisch 1/Dropbox 
> (MFM)/MfMCurrAdmin/Development/web2py/start/gluon/globals.py", line 965, in 
> connect
> 5.   session_pickled = pickle.dumps(self, pickle.HIGHEST_PROTOCOL)
> 6. File "/Library/Python/2.7/site-packages/pydal/objects.py", line 2946, 
> in __getstate__
> 7.   del ret['fields']
> 8. KeyError: 'fields'
> 9.
>
> In file: Framework
> 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.


Re: [web2py] Re: Documenting a file with sphinx, that has local_import in it

2017-08-08 Thread Richard Vézina
I look at sphinx a long time ago, so you kind of lost me now... But I
tought after I press send that fact that web2py doc is available with
readthedoc which is (correct me if I am wrong) base on sphinx, so web2py is
suppose to work with sphinx... But web2py apps, I guess it another story,
for some of the reasons you mention... About request and other web2py
environnement objects maybe you can work something base on this workaround
related to IDE :

http://web2py.com/books/default/chapter/29/14/other-recipes#Using-general-purpose-IDEs-with-web2py

On Tue, Aug 8, 2017 at 12:39 PM, Carl Hunter Roach 
wrote:

> thanks Richard.
>
> I saw the changelog thanking Niphold wrt docstrings but only found
> Massimo's suggestion of additional code to add to each .py file to get
> Sphinx to "find" all my project files.
>
> Off the bat, after I point Sphinx at gluon, I get errors about request,
> current et al not being found. This is what I expected given web2py's
> architecture. I'm just on the hunt for a workaround.
>
> I see that gluon/packages/dal has Sphinx definition files but these, I
> don't think, provide clues to how to deal with request et al. And gluon
> itself doesn't have Sphinx config files so, perhaps, Sphinx-support has a
> way to go?
>
>
> On Tue, 8 Aug 2017 at 16:51 Richard Vézina 
> wrote:
>
>> I think web2py is sphinx compliant now, I recall that Simone (Niphold)
>> had refactor docstring to do so... To be confirmed...
>>
>> Richard
>>
>> On Tue, Aug 8, 2017 at 11:06 AM, Carl Hunter Roach 
>> wrote:
>>
>>> Is this still the recommended workaround to get Sphinx to generate
>>> documentation for projects built upon Web2py?
>>>
>>>
>>>
>>> On Saturday, 28 May 2011 16:18:42 UTC+1, Massimo Di Pierro wrote:

 controllers and models in web2py are written in python but are not
 python modules. They use objects
 (request,response,...,local_import,...) that are not imported.

 Sphinx does not understand this.

 I am sure there is a way around (for example add to your models and
 controllers:

 if 1:
 from gluon import *
 request,response,session,cache,T = \
current.request,current.response,
current.session,current.cache,current.T
 from gluon.compileapp import local_import_aux as local_import

 ) but I cannot say for sure without details about what you are trying
 to do.





 On May 28, 3:47 am, Vasil Petkov  wrote:
 > Hello!
 >
 > I use web2py 1.94 on Ubuntu with Python 2.7 and Sphinx 1.0.7. For the
 > documentation purposes, i have created a 'doc'-directory inside my
 > web2py-application. My web2py project has the following structure:
 >
 > web2py
 >|_ server
 >|  |_ applications
 >||_ init
 >|| |_ controllers
 >||   |_ myapp.py
 >   ... ...
 >||_ modules
 >|  |_ xml2obj.py
 >   ...
 >|_ doc
 >
 > When i try to generate documentation for the myapp.py-file with
 > sphinx, i get the following warning:
 >
 >  Traceback (most recent call
 > last):
 >   File "/usr/local/lib/python2.7/dist-packages/Sphinx-1.0.7-py2.7.egg/

 > sphinx/ext/autodoc.py", line 329, in import_object
 > __import__(self.modname)
 >   File "/home/vpetkov/Documents/web2py/server/applications/init/
 > controllers/myapp.py", line 16, in 
 > xml2obj = local_import('xml2obj', reload=False)
 > NameError: name 'local_import' is not defined
 >
 > /home/vpetkov/Documents/web2py/server/doc/myapp.rst:7: (WARNING/2)
 > autodoc can't import/find module 'myapp', it reported error: "name
 > 'local_import' is not defined", please check your spelling and
 > sys.path
 >
 > Additionally. in conf.py Sphinx file, i added
 > sys.path.append(os.path.abspath('../applications/init/modules/'))
>>>
>>> --
>>> 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 a topic in the
>> Google Groups "web2py-users" group.
>> To unsubscribe from this topic, visit 

Re: [web2py] Re: Documenting a file with sphinx, that has local_import in it

2017-08-08 Thread Carl Hunter Roach
thanks Richard.

I saw the changelog thanking Niphold wrt docstrings but only found
Massimo's suggestion of additional code to add to each .py file to get
Sphinx to "find" all my project files.

Off the bat, after I point Sphinx at gluon, I get errors about request,
current et al not being found. This is what I expected given web2py's
architecture. I'm just on the hunt for a workaround.

I see that gluon/packages/dal has Sphinx definition files but these, I
don't think, provide clues to how to deal with request et al. And gluon
itself doesn't have Sphinx config files so, perhaps, Sphinx-support has a
way to go?


On Tue, 8 Aug 2017 at 16:51 Richard Vézina 
wrote:

> I think web2py is sphinx compliant now, I recall that Simone (Niphold) had
> refactor docstring to do so... To be confirmed...
>
> Richard
>
> On Tue, Aug 8, 2017 at 11:06 AM, Carl Hunter Roach 
> wrote:
>
>> Is this still the recommended workaround to get Sphinx to generate
>> documentation for projects built upon Web2py?
>>
>>
>>
>> On Saturday, 28 May 2011 16:18:42 UTC+1, Massimo Di Pierro wrote:
>>>
>>> controllers and models in web2py are written in python but are not
>>> python modules. They use objects
>>> (request,response,...,local_import,...) that are not imported.
>>>
>>> Sphinx does not understand this.
>>>
>>> I am sure there is a way around (for example add to your models and
>>> controllers:
>>>
>>> if 1:
>>> from gluon import *
>>> request,response,session,cache,T = \
>>>current.request,current.response,
>>>current.session,current.cache,current.T
>>> from gluon.compileapp import local_import_aux as local_import
>>>
>>> ) but I cannot say for sure without details about what you are trying
>>> to do.
>>>
>>>
>>>
>>>
>>>
>>> On May 28, 3:47 am, Vasil Petkov  wrote:
>>> > Hello!
>>> >
>>> > I use web2py 1.94 on Ubuntu with Python 2.7 and Sphinx 1.0.7. For the
>>> > documentation purposes, i have created a 'doc'-directory inside my
>>> > web2py-application. My web2py project has the following structure:
>>> >
>>> > web2py
>>> >|_ server
>>> >|  |_ applications
>>> >||_ init
>>> >|| |_ controllers
>>> >||   |_ myapp.py
>>> >   ... ...
>>> >||_ modules
>>> >|  |_ xml2obj.py
>>> >   ...
>>> >|_ doc
>>> >
>>> > When i try to generate documentation for the myapp.py-file with
>>> > sphinx, i get the following warning:
>>> >
>>> >  Traceback (most recent call
>>> > last):
>>> >   File "/usr/local/lib/python2.7/dist-packages/Sphinx-1.0.7-py2.7.egg/
>>> > sphinx/ext/autodoc.py", line 329, in import_object
>>> > __import__(self.modname)
>>> >   File "/home/vpetkov/Documents/web2py/server/applications/init/
>>> > controllers/myapp.py", line 16, in 
>>> > xml2obj = local_import('xml2obj', reload=False)
>>> > NameError: name 'local_import' is not defined
>>> >
>>> > /home/vpetkov/Documents/web2py/server/doc/myapp.rst:7: (WARNING/2)
>>> > autodoc can't import/find module 'myapp', it reported error: "name
>>> > 'local_import' is not defined", please check your spelling and
>>> > sys.path
>>> >
>>> > Additionally. in conf.py Sphinx file, i added
>>> > sys.path.append(os.path.abspath('../applications/init/modules/'))
>>
>> --
>> 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 a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/cYQTCXeGVdU/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
-- 
Carl D Hunter Roach
Bisham Barn Owl Group
Runnymede Ringing Group

-- 
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 

Re: [web2py] Re: web2py 2.15.3 is OUT

2017-08-08 Thread Richard Vézina
Most of the time ticket unknown is the results of bad permissions settings
if I recall..

Richard

On Tue, Aug 8, 2017 at 7:01 AM, 黄祥  wrote:

> Internal error
>
> Ticket issued: unknown
>
> *error shown in terminal (previous version shown in appadmin errors)*
> ERROR:web2py:Traceback (most recent call last):
>   File "/Users/MacBookPro/site/web2py/gluon/restricted.py", line 219, in
> restricted
> exec(ccode, environment)
>   File "/Users/MacBookPro/site/web2py/applications/scaffold/models/db.py",
> line 25, in 
> check_reserved = ['all'])
>   File "/Users/MacBookPro/site/web2py/gluon/packages/dal/pydal/base.py",
> line 170, in __call__
> obj = super(MetaDAL, cls).__call__(*args, **kwargs)
>   File "/Users/MacBookPro/site/web2py/gluon/packages/dal/pydal/base.py",
> line 475, in __init__
> "Failure to connect, tried %d times:\n%s" % (attempts, tb)
> RuntimeError: Failure to connect, tried 5 times:
> Traceback (most recent call last):
>   File "/Users/MacBookPro/site/web2py/gluon/packages/dal/pydal/base.py",
> line 455, in __init__
> self._adapter = adapter(**kwargs)
>   File 
> "/Users/MacBookPro/site/web2py/gluon/packages/dal/pydal/adapters/__init__.py",
> line 40, in __call__
> obj = super(AdapterMeta, cls).__call__(*args, **kwargs)
>   File 
> "/Users/MacBookPro/site/web2py/gluon/packages/dal/pydal/adapters/base.py",
> line 368, in __init__
> super(SQLAdapter, self).__init__(*args, **kwargs)
>   File 
> "/Users/MacBookPro/site/web2py/gluon/packages/dal/pydal/adapters/base.py",
> line 52, in __init__
> self.reconnect()
>   File "/Users/MacBookPro/site/web2py/gluon/packages/dal/pydal/connection.py",
> line 152, in reconnect
> self.connection = self.connector()
>   File 
> "/Users/MacBookPro/site/web2py/gluon/packages/dal/pydal/adapters/sqlite.py",
> line 42, in connector
> return self.driver.Connection(self.dbpath, **self.driver_args)
> OperationalError: unable to open database file
>
> test using web2py scaffold (vue js + whoosh) appconfig.ini taken from
> welcome scaffolding app
>
> *solution*
> create databases folder
>
> 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 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: Documenting a file with sphinx, that has local_import in it

2017-08-08 Thread Richard Vézina
I think web2py is sphinx compliant now, I recall that Simone (Niphold) had
refactor docstring to do so... To be confirmed...

Richard

On Tue, Aug 8, 2017 at 11:06 AM, Carl Hunter Roach 
wrote:

> Is this still the recommended workaround to get Sphinx to generate
> documentation for projects built upon Web2py?
>
>
>
> On Saturday, 28 May 2011 16:18:42 UTC+1, Massimo Di Pierro wrote:
>>
>> controllers and models in web2py are written in python but are not
>> python modules. They use objects
>> (request,response,...,local_import,...) that are not imported.
>>
>> Sphinx does not understand this.
>>
>> I am sure there is a way around (for example add to your models and
>> controllers:
>>
>> if 1:
>> from gluon import *
>> request,response,session,cache,T = \
>>current.request,current.response,
>>current.session,current.cache,current.T
>> from gluon.compileapp import local_import_aux as local_import
>>
>> ) but I cannot say for sure without details about what you are trying
>> to do.
>>
>>
>>
>>
>>
>> On May 28, 3:47 am, Vasil Petkov  wrote:
>> > Hello!
>> >
>> > I use web2py 1.94 on Ubuntu with Python 2.7 and Sphinx 1.0.7. For the
>> > documentation purposes, i have created a 'doc'-directory inside my
>> > web2py-application. My web2py project has the following structure:
>> >
>> > web2py
>> >|_ server
>> >|  |_ applications
>> >||_ init
>> >|| |_ controllers
>> >||   |_ myapp.py
>> >   ... ...
>> >||_ modules
>> >|  |_ xml2obj.py
>> >   ...
>> >|_ doc
>> >
>> > When i try to generate documentation for the myapp.py-file with
>> > sphinx, i get the following warning:
>> >
>> >  Traceback (most recent call
>> > last):
>> >   File "/usr/local/lib/python2.7/dist-packages/Sphinx-1.0.7-py2.7.egg/
>> > sphinx/ext/autodoc.py", line 329, in import_object
>> > __import__(self.modname)
>> >   File "/home/vpetkov/Documents/web2py/server/applications/init/
>> > controllers/myapp.py", line 16, in 
>> > xml2obj = local_import('xml2obj', reload=False)
>> > NameError: name 'local_import' is not defined
>> >
>> > /home/vpetkov/Documents/web2py/server/doc/myapp.rst:7: (WARNING/2)
>> > autodoc can't import/find module 'myapp', it reported error: "name
>> > 'local_import' is not defined", please check your spelling and
>> > sys.path
>> >
>> > Additionally. in conf.py Sphinx file, i added
>> > sys.path.append(os.path.abspath('../applications/init/modules/'))
>
> --
> 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: Documenting a file with sphinx, that has local_import in it

2017-08-08 Thread Carl Hunter Roach
Is this still the recommended workaround to get Sphinx to generate 
documentation for projects built upon Web2py?



On Saturday, 28 May 2011 16:18:42 UTC+1, Massimo Di Pierro wrote:
>
> controllers and models in web2py are written in python but are not 
> python modules. They use objects 
> (request,response,...,local_import,...) that are not imported. 
>
> Sphinx does not understand this. 
>
> I am sure there is a way around (for example add to your models and 
> controllers: 
>
> if 1: 
> from gluon import * 
> request,response,session,cache,T = \ 
>current.request,current.response, 
>current.session,current.cache,current.T 
> from gluon.compileapp import local_import_aux as local_import 
>
> ) but I cannot say for sure without details about what you are trying 
> to do. 
>
>
>
>
>
> On May 28, 3:47 am, Vasil Petkov  wrote: 
> > Hello! 
> > 
> > I use web2py 1.94 on Ubuntu with Python 2.7 and Sphinx 1.0.7. For the 
> > documentation purposes, i have created a 'doc'-directory inside my 
> > web2py-application. My web2py project has the following structure: 
> > 
> > web2py 
> >|_ server 
> >|  |_ applications 
> >||_ init 
> >|| |_ controllers 
> >||   |_ myapp.py 
> >   ... ... 
> >||_ modules 
> >|  |_ xml2obj.py 
> >   ... 
> >|_ doc 
> > 
> > When i try to generate documentation for the myapp.py-file with 
> > sphinx, i get the following warning: 
> > 
> >  Traceback (most recent call 
> > last): 
> >   File "/usr/local/lib/python2.7/dist-packages/Sphinx-1.0.7-py2.7.egg/ 
> > sphinx/ext/autodoc.py", line 329, in import_object 
> > __import__(self.modname) 
> >   File "/home/vpetkov/Documents/web2py/server/applications/init/ 
> > controllers/myapp.py", line 16, in  
> > xml2obj = local_import('xml2obj', reload=False) 
> > NameError: name 'local_import' is not defined 
> > 
> > /home/vpetkov/Documents/web2py/server/doc/myapp.rst:7: (WARNING/2) 
> > autodoc can't import/find module 'myapp', it reported error: "name 
> > 'local_import' is not defined", please check your spelling and 
> > sys.path 
> > 
> > Additionally. in conf.py Sphinx file, i added 
> > sys.path.append(os.path.abspath('../applications/init/modules/'))

-- 
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: web2py 2.15.3 is OUT

2017-08-08 Thread 黄祥
Internal error

Ticket issued: unknown

*error shown in terminal (previous version shown in appadmin errors)*
ERROR:web2py:Traceback (most recent call last):
  File "/Users/MacBookPro/site/web2py/gluon/restricted.py", line 219, in 
restricted
exec(ccode, environment)
  File "/Users/MacBookPro/site/web2py/applications/scaffold/models/db.py", 
line 25, in 
check_reserved = ['all'])
  File "/Users/MacBookPro/site/web2py/gluon/packages/dal/pydal/base.py", 
line 170, in __call__
obj = super(MetaDAL, cls).__call__(*args, **kwargs)
  File "/Users/MacBookPro/site/web2py/gluon/packages/dal/pydal/base.py", 
line 475, in __init__
"Failure to connect, tried %d times:\n%s" % (attempts, tb)
RuntimeError: Failure to connect, tried 5 times:
Traceback (most recent call last):
  File "/Users/MacBookPro/site/web2py/gluon/packages/dal/pydal/base.py", 
line 455, in __init__
self._adapter = adapter(**kwargs)
  File 
"/Users/MacBookPro/site/web2py/gluon/packages/dal/pydal/adapters/__init__.py", 
line 40, in __call__
obj = super(AdapterMeta, cls).__call__(*args, **kwargs)
  File 
"/Users/MacBookPro/site/web2py/gluon/packages/dal/pydal/adapters/base.py", 
line 368, in __init__
super(SQLAdapter, self).__init__(*args, **kwargs)
  File 
"/Users/MacBookPro/site/web2py/gluon/packages/dal/pydal/adapters/base.py", 
line 52, in __init__
self.reconnect()
  File 
"/Users/MacBookPro/site/web2py/gluon/packages/dal/pydal/connection.py", 
line 152, in reconnect
self.connection = self.connector()
  File 
"/Users/MacBookPro/site/web2py/gluon/packages/dal/pydal/adapters/sqlite.py", 
line 42, in connector
return self.driver.Connection(self.dbpath, **self.driver_args)
OperationalError: unable to open database file

test using web2py scaffold (vue js + whoosh) appconfig.ini taken from 
welcome scaffolding app

*solution* 
create databases folder

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 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: web2py 2.15.3 is OUT

2017-08-08 Thread 黄祥
already fixed leonel, the error caused by the sqlite database that already 
exist and fake_migrate settings (appears in terminal console that run 
web2py)

the different behaviour is in previous version an error will recorded in 
appadmin errors, while in latest version it appears in terminal console 
that run the web2py (python web2py.py)

thanks and 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 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] $.web2py is undefined

2017-08-08 Thread Filipe Reis
Hey guys what I'm trying to do is using bootstrap tabs load other views 
using $.web2py.component() the first time it works but the the other 
controllers or tabs gives me TypeError: $.web2py is undefined. Anyone knows 
how to fix this issue?

$('.nav-tabs a[href="#tab_1"]').on('shown.bs.tab', function (e){
 $.web2py.component("{{=URL('ctr1','show', args=id, 
user_signature=True)}}", target="div1");
 return false;
});
$('.nav-tabs a[href="#tab_2"]').on('show.bs.tab', function (e){
 $.web2py.component("{{=URL('ctr2','show', args=id, 
user_signature=True)}}", target="div2");
 return false;
});

-- 
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: Error in appadmin (database admin) on python 3

2017-08-08 Thread Kirill Shatalaev
#1727 on web2py

понедельник, 7 августа 2017 г., 18:20:30 UTC+4 пользователь Massimo Di 
Pierro написал:
>
> please open a ticket in web2py or pydal, I can fix this in either place.
>
>
>>

-- 
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: web2py 2.15.3 is OUT

2017-08-08 Thread Leonel Câmara
stifan can you provide the application causing that unknown ticket error?

-- 
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.