code: def process_permission_roles(perm, v):
      
      if isinstance(v, (tuple, list)):
          roles = v
      else:
          roles = [v]
      for r in roles:
          if isinstance(r, (tuple, list)):
              role_name, role_props = r
          else:
              role_name, role_props = r, ''
          role = Role.get(Role.c.name == role_name)
          if not role:
              raise Exception, 'Role [%s] not found.' % r
          rel = Rel.get((Rel.c.role==role.id) & (Rel.c.permission==perm.id))
          if not rel:
              rel = Rel(role=role, permission=perm, props=role_props)
              msg = 'Add Relation(Permision=%s, Role=%s)...' % (name, role_name)
          else:
              rel.update(props=role_props)
              msg = 'Update Relation(Permision=%s, Role=%s)...' % (name, role_name)
              
          flag = rel.save()
          if flag:
              print msg
docs: v is roles