Пример #1
0
def add_url(id, url):
    if(url.startswith('http://')):
        wall = fetch(id)
        if wall:
            wall.item_count += 1
            item = WallItem(id=wall.item_count, wall=wall, url=url)
            item.put()
            wall.put()
            return item
    else:
        raise ValueError('Must be a well formatted URL')
Пример #2
0
def fetch_item(wall_id, item_id):
    wall = fetch(wall_id)
    if wall:
        q = WallItem.gql('WHERE wall = :1 and id = :2', wall, item_id)
        item = q.get()
        return item