Пример #1
0
def view(req, post_id=None):
    """
    Buyer view 
    """
    post_id = post_id or _getPostId(req)
    post = _getPost(req, post_id)
    #ctx = getContext()
    _fillContext(post)
    ctx = getContext()
    ctx.template = 'adview.html'
    
    return renderResponse()
Пример #2
0
def update(req, item_id=None):
    """
    Update item properties. 
    
    Usage::
    
        /<item_id>/update?name=value&name=value
    
    Example::
    
        /item121107220305425262/update?status=on&price=1990&negotiable=on&location=30303
        
    """
    props = {}
    for key,val in req.REQUEST.iteritems():
        if(key.find('_') != 0): 
            props[key] = val
    itemManager.update(item_id, props)
    #ctx = getContext()
    return renderResponse()
Пример #3
0
def activate(req, post_id=None):
    """
    This handles the case when seller accepts invitation and clicks the link
    """
    post_id = post_id or _getPostId(req)
    post = _getPost(req, post_id)    
    item = Item.collection.find_one({'post_id': post._id})
    
    if(not item):
        item = Item({'hello':1})
        item._id = idtool.generate("item")
        item.post_id = post._id
        item.save()
        #post.sellervisits = post.sellervisits+1 if ('sellervisits' in post) else 1
        #post.mongo_update()
    item.id = item._id
    post.update(item)
    _fillContext(post)
    ctx = getContext()
    ctx.template = 'adedit.html'
    ctx.item = item
    return renderResponse()