Skip to content

Instantly share code, notes, and snippets.

@grimradical
Created March 12, 2010 23:23
Show Gist options
  • Save grimradical/330925 to your computer and use it in GitHub Desktop.
Save grimradical/330925 to your computer and use it in GitHub Desktop.
import os, sys
import json
apps = ["account", "offer", "publisher", "transaction", "advertiser"]
skip = ["contenttypes.contenttype", "offer.vouchercodesequence"]
d = json.load(open(sys.argv[1]))
converted = []
for o in d:
if "model" in o:
m = o["model"]
if m in skip:
continue
for app in apps:
if m.startswith(app+"."):
o["model"] = m.replace(app+".", "core.", 1)
converted.append(o)
print json.dumps(converted, indent=2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment