def merchant_home(request, venue_id, venue_slug, template_name="autologinclient_merchant.html"):
    venue_styling = venue_id
    page_title = "Skipola"
    if request.user.is_authenticated():
        user_profile = profile.retrieve(request)
        if user_profile.user_level > 1:

            if venue_id == "0":
                venue_id = user_profile.place_id

            venue_cache_key = request.path
            v = cache.get(venue_cache_key)
            if not v:
                v = get_object_or_404(Venue, id=venue_id)
                cache.set(venue_cache_key, v, CACHE_TIMEOUT)


            """ make sure we're using the right url slug """
            if venue_slug != v.slug:
                return HttpResponsePermanentRedirect('/merchant/%d-%s/' % (v.id, v.slug))

            """ load general page data """
            page_title = v.name
            support_orders = True

            """ load chat room """
            room = 'venue-' + venue_id
            username = request.user.username
            userpassword = None
            pcjid = None
            pcresource = None
            ip_address = request.META.get('HTTP_X_FORWARDED_FOR',
                                          request.META.get('REMOTE_ADDR', '')).split(', ')[-1]
            if not 'nologin' in request.GET and request.user.is_authenticated(): 
                userpassword = request.session.get('user_password', None)
                    
                if 'cred' in request.GET and userpassword:
                    resp = HttpResponse(userpassword)
                    resp['Expires'] = datetime.datetime.now().strftime('%a, %d %b %Y %T GMT')
                    return resp
        else:
            from django.contrib.auth import logout
            logout(request)
            return HttpResponseRedirect('/merchant')
    variables = RequestContext(request)
    return render_to_response(template_name, locals(), context_instance=RequestContext(request))
def account_info(request, venue_id, template_name="registration/account_info.html"):
    user_profile = profile.retrieve(request)
    form = UserProfileForm(instance=user_profile)
    return render_to_response(template_name, locals(), context_instance=RequestContext(request))