Update while working on Django 1.5 upgrade
This commit is contained in:
parent
2479b0a24d
commit
9c989d886b
25 changed files with 1112 additions and 357 deletions
|
@ -1,16 +1,10 @@
|
|||
from django.contrib.sites.models import Site
|
||||
from django.conf import settings
|
||||
from django_cas.backends import CASBackend
|
||||
from django.template import RequestContext, loader
|
||||
from django.http import HttpResponse
|
||||
from django.db import models, connection
|
||||
|
||||
from gestioncof.models import CofProfile
|
||||
|
||||
def render_page (request, data, template):
|
||||
template = loader.get_template (template)
|
||||
context = RequestContext (request, data)
|
||||
return HttpResponse (template.render (context))
|
||||
|
||||
class COFCASBackend(CASBackend):
|
||||
def authenticate(self, ticket, service):
|
||||
"""Authenticates CAS ticket and retrieves user data"""
|
||||
|
@ -39,3 +33,16 @@ def context_processor (request):
|
|||
"site": Site.objects.get_current(),
|
||||
}
|
||||
return data
|
||||
|
||||
def lock_table(model):
|
||||
cursor = connection.cursor()
|
||||
table = model._meta.db_table
|
||||
cursor.execute("LOCK TABLES %s WRITE" % table)
|
||||
row = cursor.fetchone()
|
||||
return row
|
||||
|
||||
def unlock_table(model):
|
||||
cursor = connection.cursor()
|
||||
cursor.execute("UNLOCK TABLES")
|
||||
row = cursor.fetchone()
|
||||
return row
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue