# -*- coding: utf-8 -*-

import os
import time
import socket
import random
import logging
import datetime
import base64, pickle

import urllib2, json
from pprint import pprint

from django.shortcuts import render_to_response
from django.template import RequestContext

from django.http import HttpResponseForbidden
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import redirect, render

logger = logging.getLogger(__name__)

from django.contrib.auth.models import User
from django.contrib.auth.decorators import login_required

from django.conf import settings

#@login_required()
def test(request):

    print '--  test page:', request.user

    ip = request.META['REMOTE_ADDR']

    print request.user

    if not request.user.is_authenticated():

        return render_to_response(
            'test.html',
            locals(),
            context_instance=RequestContext(request)
        )

    return render_to_response(
        'test-home.html',
        {
            'user':request.user,
        },
        context_instance=RequestContext(request)
    )
