Hi,

What would be the best way to extend (add methods, not subclass) web2py 
classes?.

For reference if I want to add the method 'test' to db (DAL class)?.

I was doing something automated, but basically the following as a specific 
example:

   def test(self): return 'test from DAL'
   import gluon
   setattr(gluon.dal.DAL, 'test', test)

And that works ok so far:

   db.test()  >  'test from DAL'

But I believe that is NOT thread / concurrent safe, right?.

I need to add multiple methods to multiple web2py classes (the above is just 
a simple example to illustrate my goal).

And I also need to have access to the environment's own variables (db, 
request, response, my own instances, etc.) on each web request, in a *safe* 
way (without 'mixing' anything).

Is there anything you could recommend in order to accomplish this?.

I believe this has something (or everything) to do with the concurrency 
problems I describe in my other post:

   https://groups.google.com/d/topic/web2py/3qIJXnGV-mc/discussion

Thanks!,

   Carlos

Reply via email to