Hello in my db.py
i have this
from gluon.custom_import import track_changes; track_changes(True)
from wf_validates import Validate
db.define_table(
"status",
...
Field.Virtual('isavailable', lambda row: Validate().Status(row,db)),
Format="%(title)s"
)
*my wf_validates.py*
from html import *
from gluon import current
import datetime
import importlib
class Validate(object):
def str_to_class(self,module_name, class_name,db):
try:
module_ = importlib.import_module(module_name)
try:
class_ = getattr(module_, class_name)()
except AttributeError:
logging.error('Class does not exist')
except ImportError:
logging.error('Module does not exist')
return class_ or None
def Status(self,row,db):
wf=db.workflows(id=row["status"]["workflow"])["workflow"]
theClass =
self.str_to_class("applications.fileit.modules."+"ficheiros3",wf,db)
cb=getattr(theClass, *"Draft"*)('row["status"]["title"]',db)
return cb
*ficheiros3* (this is static for now but will be dynamic)
inside *ficheiros3.py* i have
class Ficheiros(object):
def Draft(self,row,db):
return "Draft"
def Approved(self,row,db):
return "Approved"
def A(self,row,db):
return "A"
The problem is that each time i create another funcion in ficheiros3.py
that function is not visible to wf_validates i´m copying ficheiros3 to
ficheiros4 to see if it works..
How to solve this?
Regards
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.