def get_image_group_or_404(self, group_id): try: group = ImageGroup.get_by_id(int(group_id)) except ValueError: group = ImageGroup.get_by_key_name(group_id) if not group: # raise NotFound() self.abort(404) return group
def create_account(user): """ This function creates account for new user """ account = Account(user=user, newsletter=True) account.put() ig = ImageGroup(name='Custom Images', owner=account, priority=0) ig.save() notify_admins_about_new_user_signup(user) return account
def create_account(user): """ This function creates account for new user """ account = Account(user=user, newsletter=True) account.put() ig = ImageGroup(name="Custom Images", owner=account, priority=0) ig.save() notify_admins_about_new_user_signup(user) return account
def get(self, user, account, **kwargs): images = [] for group in ImageGroup.all().filter("owner", None).order("priority").fetch(1000): images += [format_group(group, False)] for group in account.imagegroup_set.order("priority"): images += [format_group(group, True)] return render_json_response(self, images)
def get(self, user, account, **kwargs): images = [] for group in ImageGroup.all().filter( 'owner', None).order('priority').fetch(1000): images += [format_group(group, False)] for group in account.imagegroup_set.order('priority'): images += [format_group(group, True)] return render_json_response(self, images)