I have a table 'subscribe':

db.define_table('subscribe',
    Field('viewID','reference view'),
    Field('moduleID','reference 
module',requires=IS_EMPTY_OR(IS_IN_DB(db,'module.id','%(name)s')),ondelete='RESTRICT',represent=lambda
 
moduleID, row: db(db.module.id==moduleID).select().first().name if moduleID 
else ''),
    ....
    migrate=False)


When someone subscribes he chooses a view and depending on the view one or 
more modules. In the subscribe function I take care of this:

if viewID==ONEMODULEVIEWID:
      db.subscribe.moduleID.mutiple=False
      db.subscribe.moduleID.widget=SQLFORM.widgets.radio.widget
if viewID==NMODULEVIEWID:
      db.subscribe.moduleID.mutiple=True
      db.subscribe.moduleID.widget=SQLFORM.widgets.checkboxes.widget

I wrote a test function to process the subscription:

def testsubscribe():
    mod1=mod2=mod3=False
    response.view='generic.html'
    row=db(db.subscribe.id==1).select(db.subscribe.ALL).first()
    if row:
        for i,moduleID in enumerate(row.moduleID):
            if moduleID==NETWORKMODULEID:
                mod1=True
            elif moduleID==WHQMODULEID:
                mod2=True
            elif moduleID==CALMODULEID:
                mod3=True
    return dict(row=row,mod1=mod1,mod2=mod2,mod3=mod3)

Running this functions brings web2py in an infinite loop, how do I retrieve 
the contents of the
moduleID field and evaluate the modules someone subscribed to?


Kind regards,

Annet.

-- 

--- 
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