def save(self, name, display_name, owner, group, description): show = Show.by_name(name) show.name = name show.long_name = display_name show.description = description owner = People.by_username(owner) show.owner = owner group = Groups.by_name(group) show.group = group session.flush() turbogears.redirect('/show/view/%s' % name)
def view(self, show): '''View Show''' username = turbogears.identity.current.user_name person = People.by_username(username) show = Show.by_name(show) if not can_view_group(person, show.group): turbogears.flash(_("You cannot view '%s'") % show.name) turbogears.redirect('/show/list') return dict() return dict(show=show)
def list(self, search='*'): username = turbogears.identity.current.user_name person = People.by_username(username) re_search = re.sub(r'\*', r'%', search).lower() results = Show.query.filter(Show.name.like(re_search)).order_by('name').all() shows = list() for show in results: if can_view_group(person, show.group): shows.append(show) if not len(shows): turbogears.flash(_("No Shows found matching '%s'") % search) return dict(shows=shows, search=search)
def list(self, search='*'): username = turbogears.identity.current.user_name person = People.by_username(username) re_search = re.sub(r'\*', r'%', search).lower() results = Show.query.filter( Show.name.like(re_search)).order_by('name').all() shows = list() for show in results: if can_view_group(person, show.group): shows.append(show) if not len(shows): turbogears.flash(_("No Shows found matching '%s'") % search) return dict(shows=shows, search=search)