Exemplo n.º 1
0
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
Exemplo n.º 2
0
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
Exemplo n.º 3
0
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
Exemplo n.º 4
0
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
Exemplo n.º 5
0
 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)
Exemplo n.º 6
0
 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)