# Path: User/models.py
# def start_user_session(request, user_id, user_class):
# 	if request.session is not None:
# 		request.session["user_mail_id"] = user_id
# 		request.session["user_class"] = user_class
# 	return request
# 
# def check_if_auth_user(request):
# 	if (request.session is not None) and request.session.has_key("user_mail_id"):
# 		return request.session["user_mail_id"]
# 	else:
# 		return None
# 
# def stop_user_session(request):
# 	if (request.session is not None) and request.session.has_key("user_mail_id"):
# 		del request.session["user_mail_id"]
# 		del request.session["user_class"]
# 		return True
# 	return False


from django.shortcuts import render, redirect, get_object_or_404
from django.http import HttpResponse
from django.contrib import messages
from django.db import connection, transaction
from passlib.hash import bcrypt
from .models import start_user_session, check_if_auth_user, stop_user_session
from collections import namedtuple
import datetime
import re
# -*- coding: utf-8 -*-
from __future__ import unicode_literals





# Create your views here.


def namedtuplefetchall(cursor):
	"Return all rows from a cursor as a namedtuple"
	desc = cursor.description
	nt_result = namedtuple('Result', [col[0] for col in desc])
	return [nt_result(*row) for row in cursor.fetchall()]

# Create your views here.
def view_profile(request):

# Path: User/models.py
# def start_user_session(request, user_id, user_class):
# 	if request.session is not None:
# 		request.session["user_mail_id"] = user_id
# 		request.session["user_class"] = user_class
# 	return request
# 
# def check_if_auth_user(request):
# 	if (request.session is not None) and request.session.has_key("user_mail_id"):
# 		return request.session["user_mail_id"]
# 	else:
# 		return None
# 
# def stop_user_session(request):
# 	if (request.session is not None) and request.session.has_key("user_mail_id"):
# 		del request.session["user_mail_id"]
# 		del request.session["user_class"]
# 		return True
# 	return False


# Path: User/views.py
from django.shortcuts import render, redirect, get_object_or_404
from django.http import HttpResponse
from django.contrib import messages
from django.db import connection, transaction
from passlib.hash import bcrypt
from .models import start_user_session, check_if_auth_user, stop_user_session
from collections import namedtuple
import datetime
import re

# -*- coding: utf-8 -*-
from __future__ import unicode_literals





# Create your views here.


def namedtuplefetchall(cursor):
	"Return all rows from a cursor as a namedtuple"
	desc = cursor.description
	nt_result = namedtuple('Result', [col[0] for col in desc])
	return [nt_result(*row) for row in cursor.fetchall()]

# Create your views here.
def view_profile(request):

	check = check_if_auth_user(request)