[damned-lies] Use more standard call_command to call dumpdata
- From: Claude Paroz <claudep src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [damned-lies] Use more standard call_command to call dumpdata
- Date: Fri, 5 Oct 2012 22:02:25 +0000 (UTC)
commit 875e86e83f28f1e5c938a98adb09abd06c290242
Author: Claude Paroz <claude 2xlibre net>
Date: Sat Oct 6 00:02:08 2012 +0200
Use more standard call_command to call dumpdata
stats/tests/fixture_factory.py | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)
---
diff --git a/stats/tests/fixture_factory.py b/stats/tests/fixture_factory.py
index 49f4d01..7967cd6 100644
--- a/stats/tests/fixture_factory.py
+++ b/stats/tests/fixture_factory.py
@@ -1,6 +1,6 @@
from tempfile import NamedTemporaryFile
-from django.core.management.commands.dumpdata import Command as Dumpdata
+from django.core.management import call_command
from django.test import TestCase
from languages.models import Language
@@ -163,9 +163,8 @@ class FixtureFactory(TestCase):
description="Error regenerating POT file for zenity:\n<pre>intltool-update -g 'zenity' -p\nERROR: xgettext failed to generate PO template file.</pre>"))
# Output fixture
- data = Dumpdata().handle(*['auth.User', 'people', 'teams', 'languages', 'stats'],
- **{'indent':1, 'exclude': [], 'format': 'json'})
out_file = NamedTemporaryFile(suffix=".json", dir=".", delete=False)
- out_file.write(data)
+ call_command('dumpdata', *['auth.User', 'people', 'teams', 'languages', 'stats'],
+ indent=1, format='json', stdout=out_file)
out_file.close()
print "Fixture created in the file %s" % out_file.name
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]