Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Can only support Django 1.2 and up

  • Loading branch information...
commit 45f3c596a278618ce427c7296326f7bce944ce54 1 parent 2f0dd39
@palewire palewire authored
View
1  .travis.yml
@@ -4,7 +4,6 @@ python:
- "2.6"
- "2.7"
env:
- - DJANGO_VERSION=1.1.4
- DJANGO_VERSION=1.2.7
- DJANGO_VERSION=1.3.1
- DJANGO_VERSION=1.4
View
4 README.textile
@@ -25,6 +25,6 @@ h3. Credits
This module was developed by Ben Welsh, based on Brad Jasper's "django-jsonfield":https://github.com/bradjasper/django-jsonfield.
-h3. References
+h3. The rest
-* "Buildbot":http://travis-ci.org/#!/datadesk/django-yamlfield
+* Supports Django version 1.2 and up and Python versions 2.5, 2.6, 2.7, which is routinely tested using "Travis CI":http://travis-ci.org/#!/datadesk/django-yamlfield
View
67 run_tests.py
@@ -5,35 +5,52 @@
Base on a script published by Lukasz Dziedzia at:
http://stackoverflow.com/questions/3841725/how-to-launch-tests-for-django-reusable-app
"""
-
-import os, sys
+import os
+import sys
+import django
from django.conf import settings
DIRNAME = os.path.dirname(__file__)
-settings.configure(
- DEBUG = True,
- DATABASES = {
- 'default': {
- 'ENGINE': 'django.db.backends.sqlite3',
- 'NAME': os.path.join(DIRNAME, 'database.db'),
- 'USER': '',
- 'PASSWORD': '',
- 'HOST': '',
- 'PORT': '',
- }
- },
- INSTALLED_APPS = (
- 'django.contrib.auth',
- 'django.contrib.contenttypes',
- 'django.contrib.sessions',
- 'django.contrib.admin',
- 'yamlfield',
- )
+INSTALLED_APPS = (
+ 'django.contrib.auth',
+ 'django.contrib.contenttypes',
+ 'django.contrib.sessions',
+ 'django.contrib.admin',
+ 'yamlfield',
)
+if django.VERSION[0] == 1 and django.VERSION[1] >= 2:
+ # For versions 1.2 and up
+ settings.configure(
+ DEBUG = True,
+ DATABASES = {
+ 'default': {
+ 'ENGINE': 'django.db.backends.sqlite3',
+ 'NAME': os.path.join(DIRNAME, 'database.db'),
+ 'USER': '',
+ 'PASSWORD': '',
+ 'HOST': '',
+ 'PORT': '',
+ }
+ },
+ INSTALLED_APPS = INSTALLED_APPS
+ )
+
+ from django.test.simple import DjangoTestSuiteRunner
+ failures = DjangoTestSuiteRunner().run_tests(['yamlfield',], verbosity=1)
+ if failures:
+ sys.exit(failures)
+else:
+ # For earlier versions
+ settings.configure(DEBUG = True,
+ DATABASE_ENGINE = 'sqlite3',
+ DATABASE_NAME = os.path.join(DIRNAME, 'database.db'),
+ INSTALLED_APPS = INSTALLED_APPS
+ )
+ from django.test.simple import run_tests
+ failures = run_tests(['yamlfield',], verbosity=1)
+ if failures:
+ sys.exit(failures)
+
-from django.test.simple import DjangoTestSuiteRunner
-failures = DjangoTestSuiteRunner().run_tests(['yamlfield',], verbosity=1)
-if failures:
- sys.exit(failures)
View
2  yamlfield/fields.py
@@ -26,7 +26,7 @@ def to_python(self, value):
pass
return value
- def get_db_prep_save(self, value, connection, prepared=False):
+ def get_db_prep_save(self, value, connection):
"""
Convert our Python object to a string of YAML before we save.
"""
Please sign in to comment.
Something went wrong with that request. Please try again.