[web2py] Re: redirect fails with only an error ticket from deep inside the framework

2017-08-09 Thread 'jim kaubisch' via web2py-users
Thanks to both of you. 
I saw that line in the error ticket but dismissed it since the web2py 
access worked, the driver "must be there". Dumb :(

installed pymysql and reran my little test and it did indeed connect but 
generated the following:

cursors.py:166: 

 Warning: (3090, u"Changing sql mode 'NO_AUTO_CREATE_USER' is deprecated. 
It will be removed in a future release.")
  result = self._query(query)

Does that look familiar? Something to take note of? Briefly ldid a search 
for it but found nothing

Thanks again
Jim

On Tuesday, August 8, 2017 at 8:14:39 PM UTC-7, Anthony wrote:
>
> 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: 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: 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: 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] 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.


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


[web2py] Re: redirect fails with only an error ticket from deep inside the framework

2017-08-07 Thread 'jim kaubisch' via web2py-users
Thanks, Anthony!!

That's good news. Please, what IS the right version number and where do I 
get it it? GitHub I would guess. Haven't had a chance to investigate yet

As for the eval choice, firstly I realize it may not be truly the best 
solution and I realize there are risks involved (eval), but its been a 
godsend to me.

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.
Need a different view on the data? retrieve different fields? different 
order to the display of the data? A couple of minutes to add menu and 
dictionary entries and *no change of code* and you're there :)
Saved a LOT of duplicate code and effort.

BTW, what I'm developing is an INTERNAL web APP to manage thousands of 
media files and curricula activities in a non-technical environment 
(non-profit teaching ~25k kids music in elementary schools). Its NOT a 
webSITE.
So I guess I'm less a bit less concerned with the risks associated with 
eval than I might otherwise might be.


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-07 Thread Anthony
Yes, going back to the correct version of pydal should fix this issue.

Why are you eval'ing DAL code rather than building the query using DAL 
objects?

On Monday, August 7, 2017 at 9:01:31 PM UTC-4, jim kaubisch wrote:
>
> Hi Anthony,
>
> Yes, indeed :( 
> In connection with my other post, I updated pydal in case my problem there 
> could be fixed by updating pydal to the latest version. Didn't realize :(
>
> I'm at a critical stage of my project so don't really want to upgrade to 
> the new web2py version right now. 
> I assume I can fix the issue by going back to the "correct" version of 
> pydal for 2.14.6? If its still available?
>
> Is there something I need to watch out for when I try?
>
> Thanks
>
>
> 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-07 Thread 'jim kaubisch' via web2py-users
Hi Anthony,

Yes, indeed :( 
In connection with my other post, I updated pydal in case my problem there 
could be fixed by updating pydal to the latest version. Didn't realize :(

I'm at a critical stage of my project so don't really want to upgrade to 
the new web2py version right now. 
I assume I can fix the issue by going back to the "correct" version of 
pydal for 2.14.6? If its still available?

Is there something I need to watch out for when I try?

Thanks


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-07 Thread Anthony
Did you somehow update pydal without updating web2py? The version of pydal 
you are running is not the one associated with web2py 2.14.6 (you have a 
more recent version of pydal).

Anthony

On Monday, August 7, 2017 at 7:29:30 PM UTC-4, 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.