I'm trying out using simple multiple=True tagging-style for Many<>Many relationships (simpler than developing custom Forms & works on GAE). Currently my way to get the data out of such a field seems rather unwieldy - is there a better way?
e.g. if hiding menu options when users don't have access. if using a non-multiple: if auth.has_membership(module.access): response.menu_modules.append([T(module.name_nice), False, URL (r=request, c=module.name)]) with multiple: import re authorised = False groups = re.split('\|', module.access)[1:-1] for group in groups: if auth.has_membership(group): authorised = True if authorised == True: response.menu_modules.append([T(module.name_nice), False, URL (r=request, c=module.name)]) What seems useful would be a gluon routine which meant we didn't need to import the re module & was safer (i.e. handles either '1' or '|1|' in the field) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---