Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Minor changes to djopenid to make it work with Django 1.4 #51

Closed
wants to merge 2 commits into from

1 participant

Commits on Nov 21, 2012
  1. @rodrigoprimo
Commits on Apr 12, 2013
  1. @rodrigoprimo
This page is out of date. Refresh to see the latest.
View
0  examples/djopenid/manage.py 100644 → 100755
File mode changed
View
20 examples/djopenid/settings.py
@@ -19,12 +19,16 @@
MANAGERS = ADMINS
-DATABASE_ENGINE = 'sqlite3' # 'postgresql', 'mysql', 'sqlite3' or 'ado_mssql'.
-DATABASE_NAME = '/tmp/test.db' # Or path to database file if using sqlite3.
-DATABASE_USER = '' # Not used with sqlite3.
-DATABASE_PASSWORD = '' # Not used with sqlite3.
-DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3.
-DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3.
+DATABASES = {
+ 'default': {
+ 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
+ 'NAME': '/tmp/test.db', # Or path to database file if using sqlite3.
+ 'USER': '', # Not used with sqlite3.
+ 'PASSWORD': '', # Not used with sqlite3.
+ 'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
+ 'PORT': '', # Set to empty string for default. Not used with sqlite3.
+ }
+}
# Local time zone for this installation. All choices can be found here:
# http://www.postgresql.org/docs/current/static/datetime-keywords.html#DATETIME-TIMEZONE-SET-TABLE
@@ -55,8 +59,8 @@
# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
- 'django.template.loaders.filesystem.load_template_source',
- 'django.template.loaders.app_directories.load_template_source',
+ 'django.template.loaders.filesystem.Loader',
+ 'django.template.loaders.app_directories.Loader',
# 'django.template.loaders.eggs.load_template_source',
)
View
12 examples/djopenid/util.py
@@ -41,7 +41,7 @@ def getOpenIDStore(filestore_path, table_prefix):
The result of this function should be passed to the Consumer
constructor as the store parameter.
"""
- if not settings.DATABASE_ENGINE:
+ if not settings.DATABASES.get('default', {'ENGINE':None}).get('ENGINE'):
return FileOpenIDStore(filestore_path)
# Possible side-effect: create a database connection if one isn't
@@ -55,18 +55,18 @@ def getOpenIDStore(filestore_path, table_prefix):
}
types = {
- 'postgresql': sqlstore.PostgreSQLStore,
- 'mysql': sqlstore.MySQLStore,
- 'sqlite3': sqlstore.SQLiteStore,
+ 'django.db.backends.postgresql': sqlstore.PostgreSQLStore,
+ 'django.db.backends.mysql': sqlstore.MySQLStore,
+ 'django.db.backends.sqlite3': sqlstore.SQLiteStore,
}
try:
- s = types[settings.DATABASE_ENGINE](connection.connection,
+ s = types[settings.DATABASES.get('default', {'ENGINE':None}).get('ENGINE')](connection.connection,
**tablenames)
except KeyError:
raise ImproperlyConfigured, \
"Database engine %s not supported by OpenID library" % \
- (settings.DATABASE_ENGINE,)
+ (settings.DATABASES.get('default', {'ENGINE':None}).get('ENGINE'),)
try:
s.createTables()
View
6 openid/server/server.py
@@ -128,7 +128,7 @@
from openid.server.trustroot import TrustRoot, verifyReturnTo
from openid.association import Association, default_negotiator, getSecretSize
from openid.message import Message, InvalidOpenIDNamespace, \
- OPENID_NS, OPENID2_NS, IDENTIFIER_SELECT, OPENID1_URL_LIMIT
+ OPENID_NS, OPENID1_NS, OPENID2_NS, IDENTIFIER_SELECT, OPENID1_URL_LIMIT
from openid.urinorm import urinorm
HTTP_OK = 200
@@ -1043,7 +1043,7 @@ def whichEncoding(self):
@change: 2.1.0 added the ENCODE_HTML_FORM response.
"""
if self.request.mode in BROWSER_REQUEST_MODES:
- if self.fields.getOpenIDNamespace() == OPENID2_NS and \
+ if self.fields.getOpenIDNamespace() == OPENID1_NS and \
len(self.encodeToURL()) > OPENID1_URL_LIMIT:
return ENCODE_HTML_FORM
else:
@@ -1719,7 +1719,7 @@ def whichEncoding(self):
displayed to the user.
"""
if self.hasReturnTo():
- if self.openid_message.getOpenIDNamespace() == OPENID2_NS and \
+ if self.openid_message.getOpenIDNamespace() == OPENID1_NS and \
len(self.encodeToURL()) > OPENID1_URL_LIMIT:
return ENCODE_HTML_FORM
else:
Something went wrong with that request. Please try again.