I have this in my modules-file:

def howmanyPages(total_found, items_per_page):
    if (total_found % items_per_page):
        pages = total_found / items_per_page
    else:
        pages = total_found / items_per_page -1
    return(pages)

def is_empty(u):
    if not u or u == "":
        return(None)
    else:
        return(u)


And I use
exec('from applications.%s.modules import local as local' %
request.application)

to import it.

pages = local.howmanyPages(total_found, items_per_page)
is working as expected but

db.policies_and_strategies.url.represent = lambda value:
local.is_empty(value) == None  or A('url',_href=value)
ends in a ticket:

 File "/home/js/web2py/applications/sadec/controllers/default.py",
line 21, in <lambda>
    db.policies_and_strategies.url.represent = lambda value:
local.is_empty(value) == None  or A('url',_href=value)
AttributeError: 'module' object has no attribute 'is_empty'

Why?

Johann
-- 
       "Every good gift and every perfect gift is from above,
      and cometh down from the Father of lights, with whom
      is no variableness, neither shadow of turning."
                             James 1:17

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.

Reply via email to