Permalink
Browse files

prepared it to work with django 1.4

  • Loading branch information...
1 parent 9b0d248 commit 62b999a7fe2f8f28940a330f76ec49544ad1458b @peterbe committed Aug 11, 2012
Showing with 298 additions and 350 deletions.
  1. +4 −4 django_mongokit/mongodb/base.py
  2. +4 −5 django_mongokit/test_settings.py
  3. +1 −1 django_mongokit/version.txt
  4. +0 −11 exampleproject/manage.py
  5. +0 −86 exampleproject/settings.py
  6. +0 −107 exampleproject/settings_django11.py
  7. +0 −42 exampleproject/test_runner.py
  8. +0 −8 exampleproject/test_settings.py
  9. +0 −20 exampleproject/urls.py
  10. 0 {exampleproject/exampleapp_sql → exampleproject2/exampleproject}/__init__.py
  11. 0 {exampleproject/exampleapp/templatetags → exampleproject2/exampleproject/benchmarker}/__init__.py
  12. 0 { → exampleproject2}/exampleproject/benchmarker/models.py
  13. 0 { → exampleproject2}/exampleproject/benchmarker/tests.py
  14. 0 { → exampleproject2}/exampleproject/benchmarker/urls.py
  15. +26 −28 { → exampleproject2}/exampleproject/benchmarker/views.py
  16. 0 { → exampleproject2}/exampleproject/exampleapp/__init__.py
  17. 0 { → exampleproject2}/exampleproject/exampleapp/forms.py
  18. 0 { → exampleproject2}/exampleproject/exampleapp/models.py
  19. +9 −7 {exampleproject → exampleproject2/exampleproject/exampleapp}/templates/exampleapp/home.html
  20. 0 {exampleproject/benchmarker → exampleproject2/exampleproject/exampleapp/templatetags}/__init__.py
  21. 0 { → exampleproject2}/exampleproject/exampleapp/templatetags/django11.py
  22. 0 { → exampleproject2}/exampleproject/exampleapp/tests.py
  23. +2 −2 { → exampleproject2}/exampleproject/exampleapp/urls.py
  24. +5 −2 { → exampleproject2}/exampleproject/exampleapp/views.py
  25. 0 {exampleproject → exampleproject2/exampleproject/exampleapp_sql}/__init__.py
  26. 0 { → exampleproject2}/exampleproject/exampleapp_sql/forms.py
  27. 0 { → exampleproject2}/exampleproject/exampleapp_sql/models.py
  28. +15 −17 { → exampleproject2}/exampleproject/exampleapp_sql/tests.py
  29. 0 { → exampleproject2}/exampleproject/exampleapp_sql/urls.py
  30. +6 −5 { → exampleproject2}/exampleproject/exampleapp_sql/views.py
  31. +156 −0 exampleproject2/exampleproject/settings.py
  32. +9 −0 exampleproject2/exampleproject/urls.py
  33. +28 −0 exampleproject2/exampleproject/wsgi.py
  34. +10 −0 exampleproject2/manage.py
  35. +4 −4 setup.py
  36. +19 −1 tox.ini
@@ -130,17 +130,17 @@ def _drop_database(self, database_name):
self.connection.connection.drop_database(database_name)
-
-
class DatabaseWrapper(BaseDatabaseWrapper):
operators = {}
_commit = ignore
_rollback = ignore
- autocommit = None # ignore
+ autocommit = None # ignore
- def __init__(self, settings_dict, alias=None, # alias was added in Django 1.2
+ def __init__(self, settings_dict, alias=None, # alias was added in Django 1.2
*args, **kwargs):
+ super(DatabaseWrapper, self).__init__(settings_dict, alias=alias, *args, **kwargs)
+
if settings_dict['HOST']:
kwargs['host'] = settings_dict['HOST']
if settings_dict['PORT']:
@@ -14,16 +14,16 @@
DATABASES = {
'default': {
- 'ENGINE': 'sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
+ 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'example-sqlite3.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.
- },
+ },
'mongodb': {
- 'ENGINE': 'django_mongokit.mongodb',
- 'NAME': 'example',
+ 'ENGINE': 'django_mongokit.mongodb',
+ 'NAME': 'example',
'USER': '', # Not used with sqlite3.
'PASSWORD': '', # Not used with sqlite3.
'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
@@ -99,4 +99,3 @@
# Uncomment the next line to enable the admin:
# 'django.contrib.admin',
)
-
@@ -1 +1 @@
-0.2.2
+0.2.3
@@ -1,11 +0,0 @@
-#!/usr/bin/env python
-from django.core.management import execute_manager
-try:
- import settings # Assumed to be in the same directory.
-except ImportError:
- import sys
- sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__)
- sys.exit(1)
-
-if __name__ == "__main__":
- execute_manager(settings)
@@ -1,86 +0,0 @@
-# Django settings for exampleproject project.
-import os
-
-HERE = os.path.dirname(__file__)
-
-DEBUG = True
-TEMPLATE_DEBUG = DEBUG
-
-ADMINS = (
- # ('Your Name', 'your_email@domain.com'),
-)
-
-MANAGERS = ADMINS
-
-DATABASES = {
-# 'default': {
-# 'ENGINE': 'postgresql_psycopg2', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
-# 'NAME': 'exampleapp', # Or path to database file if using sqlite3.
-# },
- 'default': {
- 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
- 'NAME': 'example-sqlite3.db', # Or path to database file if using sqlite3.
- },
- 'mongodb': {
- 'ENGINE': 'django_mongokit.mongodb',
- 'NAME': 'example',
- '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. Choices can be found here:
-# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
-# although not all choices may be available on all operating systems.
-# If running in a Windows environment this must be set to the same as your
-# system time zone.
-TIME_ZONE = 'America/Chicago'
-
-# Language code for this installation. All choices can be found here:
-# http://www.i18nguy.com/unicode/language-identifiers.html
-LANGUAGE_CODE = 'en-us'
-
-SITE_ID = 1
-
-# If you set this to False, Django will make some optimizations so as not
-# to load the internationalization machinery.
-USE_I18N = True
-
-# Absolute path to the directory that holds media.
-# Example: "/home/media/media.lawrence.com/"
-MEDIA_ROOT = ''
-
-# URL that handles the media served from MEDIA_ROOT. Make sure to use a
-# trailing slash if there is a path component (optional in other cases).
-# Examples: "http://media.lawrence.com", "http://example.com/media/"
-MEDIA_URL = ''
-
-# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
-# trailing slash.
-# Examples: "http://foo.com/media/", "/media/".
-ADMIN_MEDIA_PREFIX = '/media/'
-
-# Make this unique, and don't share it with anybody.
-SECRET_KEY = '7o!nbm=a=j-%6m3vhd&m*8%&u-rdr)b(t%ksei)d+w$$(xb=2+'
-
-ROOT_URLCONF = 'exampleproject.urls'
-
-TEMPLATE_DIRS = (
- os.path.join(HERE, 'templates'),
-)
-
-INSTALLED_APPS = (
- 'django.contrib.auth',
- 'django.contrib.contenttypes',
- 'django.contrib.sessions',
- 'django.contrib.sites',
- 'django.contrib.messages',
- 'exampleapp',
- 'exampleapp_sql',
- # Uncomment the next line to enable the admin:
- # 'django.contrib.admin',
-)
@@ -1,107 +0,0 @@
-# Django settings for exampleproject project.
-import os
-
-HERE = os.path.dirname(__file__)
-
-DEBUG = True
-TEMPLATE_DEBUG = DEBUG
-
-ADMINS = (
- # ('Your Name', 'your_email@domain.com'),
-)
-
-MANAGERS = ADMINS
-
-DATABASE_ENGINE = 'sqlite3'
-DATABASE_NAME = 'example-sqlite3.db'
-
-#MONGO_DATABASE_ENGINE = 'django_mongokit.mongodb'
-MONGO_DATABASE_NAME = 'example'
-
-#DATABASES = {
-# 'default': {
-# 'ENGINE': 'postgresql_psycopg2', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
-# 'NAME': 'exampleapp', # Or path to database file if using sqlite3.
-# },
-# 'default': {
-# 'ENGINE': 'sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
-# 'NAME': 'example-sqlite3.db', # Or path to database file if using sqlite3.
-# },
-# 'mongodb': {
-# 'ENGINE': 'django_mongokit.mongodb',
-# 'NAME': 'example',
-# '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. Choices can be found here:
-# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
-# although not all choices may be available on all operating systems.
-# If running in a Windows environment this must be set to the same as your
-# system time zone.
-TIME_ZONE = 'America/Chicago'
-
-# Language code for this installation. All choices can be found here:
-# http://www.i18nguy.com/unicode/language-identifiers.html
-LANGUAGE_CODE = 'en-us'
-
-SITE_ID = 1
-
-# If you set this to False, Django will make some optimizations so as not
-# to load the internationalization machinery.
-USE_I18N = True
-
-# Absolute path to the directory that holds media.
-# Example: "/home/media/media.lawrence.com/"
-MEDIA_ROOT = ''
-
-# URL that handles the media served from MEDIA_ROOT. Make sure to use a
-# trailing slash if there is a path component (optional in other cases).
-# Examples: "http://media.lawrence.com", "http://example.com/media/"
-MEDIA_URL = ''
-
-# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
-# trailing slash.
-# Examples: "http://foo.com/media/", "/media/".
-ADMIN_MEDIA_PREFIX = '/media/'
-
-# Make this unique, and don't share it with anybody.
-SECRET_KEY = '7o!nbm=a=j-%6m3vhd&m*8%&u-rdr)b(t%ksei)d+w$$(xb=2+'
-
-# 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.eggs.load_template_source',
-)
-
-
-MIDDLEWARE_CLASSES = (
- 'django.middleware.common.CommonMiddleware',
- 'django.contrib.sessions.middleware.SessionMiddleware',
- 'django.contrib.auth.middleware.AuthenticationMiddleware',
-)
-
-
-ROOT_URLCONF = 'exampleproject.urls'
-
-TEMPLATE_DIRS = (
- os.path.join(HERE, 'templates'),
-)
-
-INSTALLED_APPS = (
- 'django.contrib.auth',
- 'django.contrib.contenttypes',
- 'django.contrib.sessions',
- 'django.contrib.sites',
- 'exampleapp',
- 'exampleapp_sql',
- # Uncomment the next line to enable the admin:
- # 'django.contrib.admin',
-)
-
@@ -1,42 +0,0 @@
-from django.conf import settings
-from django.test.simple import run_tests as django_test_runner
-import coverage
-def test_runner_with_coverage(test_labels, verbosity=1, interactive=True,
- extra_tests=[], failfast=None):
- """
- Custom test runner. Follows the django.test.simple.run_tests() interface.
- """
- # Start code coverage before anything else if necessary
- if hasattr(settings, 'COVERAGE_MODULES'):
- cov = coverage.coverage()
- #coverage.use_cache(0) # Do not cache any of the coverage.py stuff
- cov.use_cache(0) # Do not cache any of the coverage.py stuff
- cov.start()
-
- test_results = django_test_runner(test_labels,
- verbosity=verbosity,
- interactive=interactive,
- extra_tests=extra_tests,
- failfast=failfast)
-
- # Stop code coverage after tests have completed
- if hasattr(settings, 'COVERAGE_MODULES'):
- cov.stop()
-
- # Print code metrics header
- print ''
- print '----------------------------------------------------------------------'
- print ' Unit Test Code Coverage Results'
- print '----------------------------------------------------------------------'
-
- # Report code coverage metrics
- if hasattr(settings, 'COVERAGE_MODULES'):
- coverage_modules = []
- for module in settings.COVERAGE_MODULES:
- coverage_modules.append(__import__(module, globals(), locals(), ['']))
- cov.report(coverage_modules, show_missing=1)
- #cov.html_report(coverage_modules, directory='coverage_report')
- # Print code metrics footer
- print '----------------------------------------------------------------------'
-
- return test_results
@@ -1,8 +0,0 @@
-from settings import *
-TEST_RUNNER='test_runner.test_runner_with_coverage'
-
-COVERAGE_MODULES = [
- 'exampleapp.views',
- 'exampleapp.models',
-]
-
@@ -1,20 +0,0 @@
-from django.conf.urls.defaults import *
-
-# Uncomment the next two lines to enable the admin:
-# from django.contrib import admin
-# admin.autodiscover()
-
-urlpatterns = patterns('',
- # Example:
- (r'^exampleapp/', include('exampleapp.urls')),
- (r'^exampleapp_sql/', include('exampleapp_sql.urls', namespace='sql',
- app_name='exampleapp_sql')),
- (r'^benchmarker/', include('benchmarker.urls')),
-
- # Uncomment the admin/doc line below and add 'django.contrib.admindocs'
- # to INSTALLED_APPS to enable admin documentation:
- # (r'^admin/doc/', include('django.contrib.admindocs.urls')),
-
- # Uncomment the next line to enable the admin:
- # (r'^admin/', include(admin.site.urls)),
-)
Oops, something went wrong. Retry.

0 comments on commit 62b999a

Please sign in to comment.