annotate import_personas.py @ 146:612212345759

Persona thumbnails are now displayed on the edit persona form.
author Atul Varma <varmaa@toolness.com>
date Fri, 04 Apr 2008 11:34:44 -0700
parents 9bcc77e37c19
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
80
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
1 # Imports the personas from personas_all.dat and
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
2 # personas_categories.dat (the contents of which are contained in this
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
3 # file as constants) into the database.
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
4
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
5 import os
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
6
128
9bcc77e37c19 Renamed all references of PersonasBackend to personasbackend, matching PEP-8.
Atul Varma <varmaa@toolness.com>
parents: 106
diff changeset
7 os.environ["DJANGO_SETTINGS_MODULE"] = "personasbackend.settings"
80
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
8
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
9 from django.utils import simplejson
128
9bcc77e37c19 Renamed all references of PersonasBackend to personasbackend, matching PEP-8.
Atul Varma <varmaa@toolness.com>
parents: 106
diff changeset
10 from personasbackend.personas import models
80
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
11
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
12 def makeCategory( name ):
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
13 return models.Category( name = name )
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
14
106
5ecef2f8ce69 Initial data fixture doesn't contain accent color now.
Atul Varma <varmaa@toolness.com>
parents: 100
diff changeset
15 def makePersona( name, category, text_color, json_id ):
99
a9a08cac1271 Added a new URL syntax that allows special personas to be entered in a way that's independent of the location of the personas server.
Atul Varma <varmaa@toolness.com>
parents: 98
diff changeset
16 url = "http://personas-view/legacy-cbeard-persona?name=%s" % json_id
80
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
17 return models.Persona(
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
18 name = name,
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
19 category = category,
90
f9c59266abaf Modified scheme to use text_color and accent_color instead of color_scheme.
Atul Varma <varmaa@toolness.com>
parents: 80
diff changeset
20 text_color = text_color,
80
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
21 description = "&nbsp;",
98
305fb3a1e0ca Modified the personas app to take a single url to a persona, rather than two separate urls/two separate images.
Atul Varma <varmaa@toolness.com>
parents: 90
diff changeset
22 url = url,
80
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
23 status = "published"
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
24 )
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
25
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
26 personas_categories_dat = """
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
27 { "categories": [
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
28 {"label": "Most Popular", "id" : "personas-popular-menu", "type" : "list", "parent" : "top" },
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
29 {"label": "Recent", "id" : "personas-recent-menu", "type" : "recent", "parent" : "top" },
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
30 {"label": "New", "id" : "personas-new-menu", "type" : "list", "parent" : "top" },
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
31 {"label": "All", "id" : "personas-category-menu", "type" : "category", "parent" : "top" },
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
32 {"label": "Other", "id" : "personas-other-menu", "type" : "list", "parent" : "personas-category-menu" },
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
33 {"label": "Geometric", "id" : "personas-geometric-menu", "type" : "list", "parent" : "personas-category-menu" },
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
34 {"label": "Sports", "id" : "personas-sports-menu", "type" : "list", "parent" : "personas-category-menu" },
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
35 {"label": "Scenery", "id" : "personas-scenery-menu", "type" : "list", "parent" : "personas-category-menu" },
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
36 {"label": "Nature", "id" : "personas-nature-menu", "type" : "list", "parent" : "personas-category-menu" },
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
37 {"label": "Holidays", "id" : "personas-holiday-menu", "type" : "list", "parent" : "personas-category-menu" },
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
38 {"label": "Foxkeh", "id" : "personas-foxkeh-menu", "type" : "list", "parent" : "personas-category-menu" },
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
39 {"label": "Firefox", "id" : "personas-firefox-menu", "type" : "list", "parent" : "personas-category-menu" }
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
40 ]
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
41 }
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
42 """
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
43
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
44 personas_all_dat = """
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
45 { "personas": [
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
46 {"label": "Firefox Logo", "id" : "firefox_b", "menu" : "personas-firefox-menu", "preview" : "yes" },
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
47 {"label": "Firefox Flicks", "id" : "firefox_flicks", "menu" : "personas-firefox-menu", "dark" : "true", "preview" : "yes" },
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
48 {"label": "Mozilla Classic", "id" : "mozilla_classic", "menu" : "personas-firefox-menu", "preview" : "yes" },
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
49 {"label": "Foxkeh Straw", "id" : "foxkeh_straw", "menu" : "personas-foxkeh-menu", "preview" : "yes" },
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
50 {"label": "Foxkeh Hanami", "id" : "foxkeh_hanami", "menu" : "personas-foxkeh-menu", "preview" : "yes" },
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
51 {"label": "Foxkeh Hinimatsuri", "id" : "foxkeh_hinimatsuri", "menu" : "personas-foxkeh-menu", "preview" : "yes" },
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
52 {"label": "Foxkeh Kodomo No Hi", "id" : "foxkeh_kodomo_no_hi", "menu" : "personas-foxkeh-menu", "preview" : "yes" },
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
53 {"label": "Foxkeh Setsubun", "id" : "foxkeh_setsubun", "menu" : "personas-foxkeh-menu", "preview" : "yes" },
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
54 {"label": "Foxkeh Giant Butterbur", "id" : "foxkeh_butterbur", "menu" : "personas-foxkeh-menu", "preview" : "yes" },
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
55 {"label": "Foxkeh Tanabata", "id" : "foxkeh_tanabata", "menu" : "personas-foxkeh-menu", "dark" : "true", "preview" : "yes" },
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
56 {"label": "Viva Firefox", "id" : "viva","menu" : "personas-firefox-menu", "preview" : "yes" },
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
57 {"label": "Developer Kit", "id" : "kit","menu" : "personas-firefox-menu,personas-popular-menu", "dark" : "true", "preview" : "yes" },
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
58 {"label": "Tranquility", "id" : "tranquility","menu" : "personas-nature-menu", "dark" : "true", "preview" : "yes" },
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
59 {"label": "California Sunset", "id" : "california_sunset", "menu" : "personas-scenery-menu,personas-popular-menu", "preview" : "yes" },
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
60 {"label": "Wood Paneling", "id" : "wood_paneling", "menu" : "personas-other-menu", "preview" : "yes" },
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
61 {"label": "Hearts", "id" : "hearts", "menu" : "personas-other-menu", "preview" : "yes" },
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
62 {"label": "Blue Spheres", "id" : "blue_spheres", "menu" : "personas-other-menu", "preview" : "yes" },
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
63 {"label": "Les Diablerets", "id" : "les_diablerets", "menu" : "personas-scenery-menu", "preview" : "yes" },
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
64 {"label": "Seagull", "id" : "seagull", "menu" : "personas-scenery-menu", "preview" : "yes" },
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
65 {"label": "Verdelet", "id" : "verdelet", "menu" : "personas-scenery-menu", "preview" : "yes" },
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
66 {"label": "Green Wave", "id" : "green_wave", "menu" : "personas-other-menu", "preview" : "yes" },
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
67 {"label": "Golf", "id" : "golf", "menu" : "personas-sports-menu", "preview" : "yes" },
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
68 {"label": "Basketball", "id" : "bball", "menu" : "personas-sports-menu", "preview" : "yes" },
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
69 {"label": "Antique Wallpaper", "id" : "antique_wallpaper", "menu" : "personas-other-menu,personas-new-menu", "preview" : "yes" },
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
70 {"label": "Bamboo", "id" : "bamboo", "menu" : "personas-nature-menu,personas-new-menu", "dark" : "true", "preview" : "yes" },
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
71 {"label": "Plaid", "id" : "plaid", "menu" : "personas-geometric-menu,personas-new-menu", "preview" : "no" },
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
72 {"label": "Soccer", "id" : "soccer", "menu" : "personas-sports-menu,personas-new-menu", "dark" : "true", "preview" : "no" },
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
73 {"label": "Suede", "id" : "suede", "menu" : "personas-other-menu,personas-new-menu,personas-popular-menu", "dark" : "true", "preview" : "yes" },
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
74 {"label": "Aquarium", "id" : "aquarium", "menu" : "personas-nature-menu,personas-new-menu", "dark" : "true", "preview" : "no" },
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
75 {"label": "Dialogonal Lines", "id" : "diagonal_lines", "menu" : "personas-geometric-menu,personas-new-menu", "preview" : "no" },
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
76 {"label": "Dots", "id" : "dots", "menu" : "personas-geometric-menu,personas-new-menu", "preview" : "no" },
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
77 {"label": "Golden Gate Bridge", "id" : "golden_gate_bridge", "menu" : "personas-scenery-menu,personas-new-menu", "preview" : "yes" },
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
78 {"label": "Grass", "id" : "grass", "menu" : "personas-nature-menu,personas-new-menu", "dark" : "true", "preview" : "no" },
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
79 {"label": "Foxkeh Green Winter", "id" : "foxkeh_green_winter", "menu" : "personas-foxkeh-menu,personas-new-menu,personas-popular-menu", "dark" : "true", "preview" : "yes" },
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
80 {"label": "Jellyfish", "id" : "jellyfish", "menu" : "personas-nature-menu,personas-new-menu", "preview" : "yes" },
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
81 {"label": "Yosemite", "id" : "yosemite", "menu" : "personas-scenery-menu,personas-new-menu", "preview" : "yes" },
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
82 {"label": "Snowman", "id" : "snowman", "menu" : "personas-holiday-menu,personas-new-menu,personas-popular-menu", "preview" : "yes" },
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
83 {"label": "Snowflakes", "id" : "snowflakes", "menu" : "personas-holiday-menu,personas-new-menu", "preview" : "no" },
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
84 {"label": "Reindeer", "id" : "reindeer", "menu" : "personas-holiday-menu,personas-new-menu,personas-popular-menu", "dark" : "true", "preview" : "yes" },
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
85 {"label": "Foxkeh Canoe", "id" : "foxkeh_canoe", "menu" : "personas-foxkeh-menu,personas-new-menu", "preview" : "yes" },
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
86 {"label": "Foxkeh Helloween", "id" : "foxkeh_helloween", "menu" : "personas-foxkeh-menu,personas-new-menu", "dark" : "true", "preview" : "yes" },
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
87 {"label": "Foxkeh Susuki", "id" : "foxkeh_susuki", "menu" : "personas-foxkeh-menu,personas-new-menu", "preview" : "yes" },
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
88 {"label": "Foxkeh Hanabi", "id" : "foxkeh_hanabi", "menu" : "personas-foxkeh-menu,personas-new-menu", "dark" : "true", "preview" : "yes" },
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
89 {"label": "Paper", "id" : "paper", "menu" : "personas-other-menu,personas-new-menu", "preview" : "yes" },
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
90 {"label": "Winter", "id" : "winter", "menu" : "personas-holiday-menu,personas-new-menu", "preview" : "yes" },
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
91 {"label": "Leather", "id" : "leather", "menu" : "personas-other-menu,personas-new-menu", "preview" : "yes" },
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
92 {"label": "Niagra Falls", "id" : "niagra_falls", "menu" : "personas-scenery-menu,personas-new-menu", "preview" : "yes" },
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
93 {"label": "Groovy Blue", "id" : "groovy_blue", "menu" : "personas-other-menu,personas-new-menu", "preview" : "yes" },
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
94 {"label": "Groovy Hearts", "id" : "groovy_hearts", "menu" : "personas-other-menu,personas-new-menu", "preview" : "yes" },
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
95 {"label": "Groovy Orange", "id" : "groovy_orange", "menu" : "personas-other-menu,personas-new-menu,personas-popular-menu", "preview" : "yes" },
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
96 {"label": "Groovy Pink", "id" : "groovy_pink", "menu" : "personas-other-menu,personas-new-menu", "preview" : "yes" }
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
97 ]
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
98 }
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
99
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
100 """
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
101
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
102 if __name__ == "__main__":
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
103 personas = simplejson.loads( personas_all_dat )
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
104 personas = personas["personas"]
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
105
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
106 categories = simplejson.loads( personas_categories_dat )
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
107 categories = categories["categories"]
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
108
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
109 json_cats = {}
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
110
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
111 for category in categories:
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
112 if category["parent"] == "personas-category-menu":
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
113 cat = makeCategory(
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
114 name = category["label"],
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
115 )
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
116 print "Saving category %s" % cat.name
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
117 cat.save()
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
118 json_cats[category["id"]] = cat
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
119
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
120 for persona in personas:
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
121 menu = persona["menu"].split( "," )[0]
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
122 if persona.get( "dark", "false" ) == "true":
90
f9c59266abaf Modified scheme to use text_color and accent_color instead of color_scheme.
Atul Varma <varmaa@toolness.com>
parents: 80
diff changeset
123 text_color = "#FFFFFF"
80
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
124 else:
90
f9c59266abaf Modified scheme to use text_color and accent_color instead of color_scheme.
Atul Varma <varmaa@toolness.com>
parents: 80
diff changeset
125 text_color = "#000000"
80
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
126 persona = makePersona(
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
127 name = persona["label"],
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
128 category = json_cats[menu],
90
f9c59266abaf Modified scheme to use text_color and accent_color instead of color_scheme.
Atul Varma <varmaa@toolness.com>
parents: 80
diff changeset
129 text_color = text_color,
80
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
130 json_id = persona["id"],
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
131 )
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
132 print "Saving persona %s" % persona.name
c094aa28a697 Added import_personas.py, the script that was used to import the personas that were committed as a fixture in my last commit.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
133 persona.save()