From cb4c70c822b6c740aca9fe21d5bf0eb2dc161201 Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Sat, 22 Sep 2012 03:16:23 -0400 Subject: [PATCH] Disable XML format, add initial nullifier per type support --- apps/bootstrap/literals.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/apps/bootstrap/literals.py b/apps/bootstrap/literals.py index f341e2cb0b..8d2e97d54c 100644 --- a/apps/bootstrap/literals.py +++ b/apps/bootstrap/literals.py @@ -1,5 +1,7 @@ from __future__ import absolute_import +import re + from django.utils.translation import ugettext_lazy as _ FIXTURE_TYPE_JSON = 'json' @@ -9,7 +11,8 @@ FIXTURE_TYPE_XML = 'xml' FIXTURE_TYPES_CHOICES = ( (FIXTURE_TYPE_JSON, _(u'JSON')), (FIXTURE_TYPE_YAML, _(u'YAML')), - (FIXTURE_TYPE_XML, _(u'XML')), + # Disabing XML until a way to specify a null pk is found + #(FIXTURE_TYPE_XML, _(u'XML')), ) FIXTURE_FILE_TYPE = { @@ -18,3 +21,8 @@ FIXTURE_FILE_TYPE = { FIXTURE_TYPE_XML: 'xml', } +FIXTURE_TYPE_PK_NULLIFIER = { + FIXTURE_TYPE_JSON: lambda x: re.sub('"pk": [0-9]{1,5}', '"pk": null', x), + FIXTURE_TYPE_YAML: lambda x: re.sub('pk: [0-9]{1,5}', 'pk: null', x), + FIXTURE_TYPE_XML: lambda x: re.sub('pk="[0-9]{1,5}"', 'pk=null', x), +}