Example #1
0
def serve(req, pagename=None):
    """
    Serve static pages    
    """
    pagename = pagename or "home.html"
    template = loader.get_template(pagename)
    # ctx = gf_template.get_context(req, {})
    ctx = application.getContext()

    return HttpResponse(template.render(ctx))
Example #2
0
def home(req):

    template = loader.get_template("howitworks.html")
    # ctx = gf_template.get_context(req, {})
    ctx = application.getContext()

    if "debug" in req.GET and req.GET["debug"]:
        ctx.debug_info = renderDebugInfo()

    return HttpResponse(template.render(ctx))
Example #3
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()
Example #4
0
def home(req):
    
    res = checkReferer(req)
    if(res): return res
    
    template = loader.get_template('home.html')
    #ctx = gf_template.get_context(req, {})
    ctx = application.getContext()
    ctx.node_url= settings.NODE_URL or 'http://ONE-CHART.COM:3000'
    
    if('debug' in req.GET and req.GET['debug']):
        ctx.debug_info = renderDebugInfo()
    
    return HttpResponse(template.render(ctx))
Example #5
0
def _fillContext(post):
    fetched = post
    ctx = getContext()
    ctx.template = 'howitworks.html'
    ctx.update(fetched)
    
    fetched = ObjDict(fetched)
    ctx.phone = fetched.annotations.phone if fetched.annotations else None
    # phone number
    if(fetched.body):
        parsed = parsePhone(fetched.body)
        if(parsed):  ctx.phone =  parsed
    if(fetched.images and len(fetched.images)>0):
        ctx.default_image = fetched.images[0]
    ctx.phone = ctx.phone or ""
    
    if('location' in fetched and 'zipCode' in fetched.location):
        ctx.location = ctx['location'] or {}
        ctx.location['zipCode'] = fetched.location['zipCode'].replace('USA-', '')
Example #6
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()
Example #7
0
 def process_request(self, request):        
     """
     This is where we can have all the auth check. redirect to login if no authentication info
     #TBD: for now we just get the user_id from session        
     """        
     application.getContext(request)