Skip to content

Commit

Permalink
Whitespace cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
acdha committed Sep 8, 2010
1 parent d422695 commit 3892b34
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 48 deletions.
78 changes: 39 additions & 39 deletions test_project/polls/fixtures/polls_testmaker.json
Original file line number Diff line number Diff line change
@@ -1,73 +1,73 @@
[
{
"pk": 1,
"model": "polls.poll",
"pk": 1,
"model": "polls.poll",
"fields": {
"pub_date": "2007-04-01 00:00:00",
"question": "What's up?",
"pub_date": "2007-04-01 00:00:00",
"question": "What's up?",
"slug": "whats-up"
}
},
},
{
"pk": 2,
"model": "polls.poll",
"pk": 2,
"model": "polls.poll",
"fields": {
"pub_date": "2009-04-25 21:46:44",
"question": "Test poll",
"pub_date": "2009-04-25 21:46:44",
"question": "Test poll",
"slug": "test-poll"
}
},
},
{
"pk": 1,
"model": "polls.choice",
"pk": 1,
"model": "polls.choice",
"fields": {
"votes": 3,
"poll": 1,
"votes": 3,
"poll": 1,
"choice": "Just hacking again"
}
},
},
{
"pk": 2,
"model": "polls.choice",
"pk": 2,
"model": "polls.choice",
"fields": {
"votes": 2,
"poll": 1,
"votes": 2,
"poll": 1,
"choice": "Playing with fire"
}
},
},
{
"pk": 3,
"model": "polls.choice",
"pk": 3,
"model": "polls.choice",
"fields": {
"votes": 0,
"poll": 1,
"votes": 0,
"poll": 1,
"choice": "Clapping my shoes together three times"
}
},
},
{
"pk": 4,
"model": "polls.choice",
"pk": 4,
"model": "polls.choice",
"fields": {
"votes": 0,
"poll": 2,
"votes": 0,
"poll": 2,
"choice": "Choice 1 "
}
},
},
{
"pk": 5,
"model": "polls.choice",
"pk": 5,
"model": "polls.choice",
"fields": {
"votes": 3,
"poll": 2,
"votes": 3,
"poll": 2,
"choice": "Choice too"
}
},
},
{
"pk": 6,
"model": "polls.choice",
"pk": 6,
"model": "polls.choice",
"fields": {
"votes": 0,
"poll": 2,
"votes": 0,
"poll": 2,
"choice": "New Choice"
}
}
Expand Down
16 changes: 8 additions & 8 deletions test_utils/management/commands/makefixture.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,24 +81,24 @@ def handle_reverse(self, **options):
related_set_name, model_name))
to_reverse.setdefault(model, []).append(related_set_name)
return to_reverse

def handle_models(self, models, **options):
format = options.get('format','json')
indent = options.get('indent',None)
show_traceback = options.get('traceback', False)
propagate = options.get('propagate', True)
follow_reverse = self.handle_reverse(**options)

# Check that the serialization format exists; this is a shortcut to
# avoid collating all the objects and _then_ failing.
if format not in serializers.get_public_serializer_formats():
raise CommandError("Unknown serialization format: %s" % format)

try:
serializers.get_serializer(format)
except KeyError:
raise CommandError("Unknown serialization format: %s" % format)

objects = []
for model, slice in models:
if isinstance(slice, basestring):
Expand All @@ -113,7 +113,7 @@ def handle_models(self, models, **options):
objects.extend(items)
else:
raise CommandError("Wrong slice: %s" % slice)

all = objects
if propagate:
collected = set([(x.__class__, x.pk) for x in all])
Expand All @@ -134,7 +134,7 @@ def handle_models(self, models, **options):
if new and not (new.__class__, new.pk) in collected:
collected.add((new.__class__, new.pk))
related.append(new)
# follow reverse relations as requested
# follow reverse relations as requested
for reverse_field in follow_reverse.get(x.__class__, []):
mgr = getattr(x, reverse_field)
for new in mgr.all():
Expand All @@ -143,7 +143,7 @@ def handle_models(self, models, **options):
related.append(new)
objects = related
all.extend(objects)

try:
return serializers.serialize(format, all, indent=indent)
except Exception, e:
Expand All @@ -156,7 +156,7 @@ def get_models(self):

def get_model_from_name(self, search):
"""Given a name of a model, return the model object associated with it
The name can be either fully specified or uniquely matching the
end of the model name. e.g.
django.contrib.auth.User
Expand Down
2 changes: 1 addition & 1 deletion test_utils/testmaker/processors/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def _log_context(self, context):
keys += self._get_context_keys(context)
keys = set(keys)

# Skip some keys
# Skip some keys
for discardkey in DISCARD_CONTEXT_KEYS:
keys.discard(discardkey)

Expand Down

0 comments on commit 3892b34

Please sign in to comment.