<http://stackoverflow.com/questions/24218339/how-to-use-getattr-in-web2py#>
My code:
from applications.Folders1.modules.myfolder1.main import mainfrom
applications.Folders1.modules.myfolder1.list1 import GAMES0
code.....
name3 = main() class Filters(object):
def Filter_cause(self):
for item in name3.split():
b = False
for c in FILTERTYPE:
b = b | (item.find(c) != -1)
if b:
for (func) in GAMES0:
func()
def Filter_cause(self):
code....
func()
o = Filters()for stuff in dir(o):
if 'Filter' in stuff:
getattr(o, stuff)()
in the controller:
import Filtersdef view_post():
code...
data = Filters()
form = codereturn locals()
in the HTML view
{{extend 'layout HTML'}} {{= data}}
I want the func() to help display data on the view HTML When I run this in
the controller, i get an error: communication error when I run in the
controller as:
data = Filters.getattr(o, stuff)()# obviously i may be wrong on code here
The local host goes very slow What should I do? N/B still new in Python and
web2py
--
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.