Massimo, 

I am running from tests code. Some acceptance tests with Selenium. 
Something like this:

class TestStockist(TestModuleSetup):
         
         def test_create_stock_register(self):         
      
         #item is a mock object with some unique id and some description
         stockister = Stockist()
         stockister.register_product_input(item) #error occurs here, cuz 
calls module method that uses corrent.db
        
         (...)
         # fetch db again to assert if item was registered and ends test 
unit


On Thursday, October 10, 2013 11:25:39 AM UTC-3, Matheus Cardoso wrote:
>
> Hi guys,
>
> Sorry if the following question was already answered,  but I could not 
> find nothing like this in this list, stack or in others lists. Here is the 
> thing: I wrote some tests that already was working. I got back to the code, 
> after some time, and then: 'thread._local' object has no attribute (in this 
> case, the classic 'db'). Here is my code:
>
> In models/0.py
>
> db = 
> DAL(db_postgres_url,pool_size=1,check_reserved=['all'],fake_migrate_all=False)
>
> from gluon import current
> current.db = db
>
> In module/my_module.py
>
> from gluon import *
> def some_function():
>       #some db stuff calling current.db
>
> However, the 'thread._local' object has no attribute db keeps raising. I 
> tried other approach like 
>       
> In models/0.py
>
> db = 
> DAL(db_postgres_url,pool_size=1,check_reserved=['all'],fake_migrate_all=False)
>
> from gluon import current
> from storage import Storage
> current.toc = Storage()
> current.toc.db = db
>
> But then, the same error, but with "toc", raises again. Is there any 
> changes in Web2py that changed this behavior? 
>
>
>
>
>

-- 
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/groups/opt_out.

Reply via email to