Changes for Django 1.4; should now be updated from gramps35

svn: r20766
This commit is contained in:
Doug Blank 2012-12-05 02:34:05 +00:00
parent 159d683ed7
commit 84ee7c8ff8
5 changed files with 18 additions and 12 deletions

View File

@ -50,7 +50,7 @@ from gramps.gen.db import (PERSON_KEY,
NOTE_KEY) NOTE_KEY)
from gramps.gen.utils.id import create_id from gramps.gen.utils.id import create_id
from gramps.gen.constfunc import STRTYPE from gramps.gen.constfunc import STRTYPE
from webapp.libdjango import DjangoInterface from gramps.webapp.libdjango import DjangoInterface
from django.db import transaction from django.db import transaction
class Cursor(object): class Cursor(object):

View File

@ -63,7 +63,7 @@ from gramps.webapp.utils import _, build_args
from gramps.webapp.grampsdb.models import * from gramps.webapp.grampsdb.models import *
from gramps.webapp.grampsdb.view import * from gramps.webapp.grampsdb.view import *
from gramps.webapp.dbdjango import DbDjango from gramps.webapp.dbdjango import DbDjango
from gramps.cli.user import User import gramps.cli.user
from gramps.gen.const import VERSION_TUPLE from gramps.gen.const import VERSION_TUPLE
from gramps.gen.utils.svn import get_svn_revision from gramps.gen.utils.svn import get_svn_revision
@ -220,7 +220,7 @@ def process_report_run(request, handle):
mimetype = 'application/%s' % args["off"] mimetype = 'application/%s' % args["off"]
elif report.report_type == "export": elif report.report_type == "export":
filename = "/tmp/%s-%s.%s" % (str(profile.user.username), str(handle), args["off"]) filename = "/tmp/%s-%s.%s" % (str(profile.user.username), str(handle), args["off"])
export_file(db, filename, User()) # callback export_file(db, filename, gramps.cli.user.User()) # callback
mimetype = 'text/plain' mimetype = 'text/plain'
elif report.report_type == "import": elif report.report_type == "import":
filename = download(args["i"], "/tmp/%s-%s.%s" % (str(profile.user.username), filename = download(args["i"], "/tmp/%s-%s.%s" % (str(profile.user.username),
@ -231,14 +231,14 @@ def process_report_run(request, handle):
import threading import threading
def background(): def background():
try: try:
import_file(db, filename, User()) # callback import_file(db, filename, gramps.cli.user.User()) # callback
except: except:
make_message(request, "import_file failed: " + traceback.format_exc()) make_message(request, "import_file failed: " + traceback.format_exc())
threading.Thread(target=background).start() threading.Thread(target=background).start()
make_message(request, "Your data is now being imported...") make_message(request, "Your data is now being imported...")
return redirect("/report/") return redirect("/report/")
else: else:
success = import_file(db, filename, User()) # callback success = import_file(db, filename, gramps.cli.user.User()) # callback
if not success: if not success:
make_message(request, "Failed to load imported.") make_message(request, "Failed to load imported.")
return redirect("/report/") return redirect("/report/")

View File

@ -60,6 +60,7 @@ SECRET_KEY = 'zd@%vslj5sqhx94_8)0hsx*rk9tj3^ly$x+^*tq4bggr&uh$ac'
TEMPLATE_LOADERS = ( TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader', # 1.4 'django.template.loaders.filesystem.Loader', # 1.4
'django.template.loaders.app_directories.Loader', # 1.4
#'django.template.loaders.filesystem.load_template_source', #'django.template.loaders.filesystem.load_template_source',
#'django.template.loaders.app_directories.load_template_source', #'django.template.loaders.app_directories.load_template_source',
) )
@ -69,10 +70,12 @@ MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware', 'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
# 'debug_toolbar.middleware.DebugToolbarMiddleware', # 'debug_toolbar.middleware.DebugToolbarMiddleware',
) )
ROOT_URLCONF = 'gramps.webapp.urls' ROOT_URLCONF = 'gramps.webapp.urls'
STATIC_URL = '/static/' # 1.4
TEMPLATE_DIRS = ( TEMPLATE_DIRS = (
# Use absolute paths, not relative paths. # Use absolute paths, not relative paths.
@ -81,6 +84,7 @@ TEMPLATE_DIRS = (
TEMPLATE_CONTEXT_PROCESSORS = ( TEMPLATE_CONTEXT_PROCESSORS = (
"django.contrib.auth.context_processors.auth", # 1.4 "django.contrib.auth.context_processors.auth", # 1.4
"django.contrib.messages.context_processors.messages", # 1.4
# "django.core.context_processors.auth", # "django.core.context_processors.auth",
# "django.core.context_processors.debug", # "django.core.context_processors.debug",
"django.core.context_processors.i18n", "django.core.context_processors.i18n",
@ -93,6 +97,7 @@ INSTALLED_APPS = (
'django.contrib.auth', 'django.contrib.auth',
'django.contrib.contenttypes', 'django.contrib.contenttypes',
'django.contrib.sessions', 'django.contrib.sessions',
'django.contrib.messages', # 1.4
'django.contrib.sites', 'django.contrib.sites',
'django.contrib.admin', 'django.contrib.admin',
'gramps.webapp.grampsdb', 'gramps.webapp.grampsdb',

View File

@ -37,15 +37,15 @@ except RuntimeError:
# already configured; ignore # already configured; ignore
pass pass
from .grampsdb.models import * from gramps.webapp.grampsdb.models import *
from .grampsdb.forms import * from gramps.webapp.grampsdb.forms import *
from .dbdjango import DbDjango from gramps.webapp.dbdjango import DbDjango
from .reports import import_file from gramps.webapp.reports import import_file
from .libdjango import DjangoInterface, totime, todate from gramps.webapp.libdjango import DjangoInterface, totime, todate
from gramps.gen.datehandler import displayer, parser from gramps.gen.datehandler import displayer, parser
from .utils import StyledNoteFormatter, parse_styled_text from gramps.webapp.utils import StyledNoteFormatter, parse_styled_text
from gramps.gen.lib import StyledText from gramps.gen.lib import StyledText
from gramps.cli.user import User #from gramps.cli.user import User
db = DbDjango() db = DbDjango()
dji = DjangoInterface() dji = DjangoInterface()

View File

@ -36,6 +36,7 @@ import os
from gramps.gen.const import IMAGE_DIR, ROOT_DIR from gramps.gen.const import IMAGE_DIR, ROOT_DIR
from django.conf.urls.defaults import * from django.conf.urls.defaults import *
from django.contrib import admin from django.contrib import admin
admin.autodiscover() admin.autodiscover()
from gramps.webapp.grampsdb.views import * from gramps.webapp.grampsdb.views import *