-
Notifications
You must be signed in to change notification settings - Fork 10
Package dictionary .. how it varies
David Read edited this page Aug 2, 2013
·
10 revisions
Here we follow the package in its various formats, from form submission to storing it in the database.
- Parameters are serialized
UnicodeMultiDict(
[('title', u'OpenStreetMap'),
('name', u'openstreetmap'),
('url', u''),
('license_id', u'odc-pddl'),
('notes', u'OpenStreetMap (OSM) is aimed at creating and providing free geographic data such as street maps to anyone who wants them. The project was started because most maps you think of as free actually have legal or technical restrictions on their use, holding back people from using them in creative, productive or unexpected ways.'),
('tag_string', u''),
('add-resource-url', u''),
('add-resource-url', u'http://ftp://ftp.spline.de/pub/openstreetmap/planet/planet-latest.osm.bz2'),
('resources__0__name', u'Planet dump'),
('resources__0__description', u'Full dump of the planet'),
('resources__0__url', u'ftp://ftp.spline.de/pub/openstreetmap/planet/planet-latest.osm.bz2'),
('resources__0__format', u'OSM'),
('resources__0__resource_type', u'file'),
('resources__0__webstore_url', u''),
('resources__0__last_modified', u''),
('resources__0__size', u'234555'),
('resources__0__mimetype', u''),
('resources__0__mimetype_inner', u''),
('resources__0__id', u''),
('resources__0__hash', u''),
('resources__0__KEY', u'VALUE'),
('author', u''),
('author_email', u''),
('maintainer', u''),
('maintainer_email', u''),
('version', u''),
('extras__0__key', u''),
('extras__0__value', u''),
('extras__1__key', u''),
('extras__1__value', u''),
('extras__2__key', u''),
('extras__2__value', u''),
('extras__3__key', u''),
('extras__3__value', u''),
('log_message', u'Created new dataset.'),
('save', u'Add Dataset')
])
- Dictionary
- Keyed by a tuple containing the index and whether it is key or value, to make it easier to group them in the next 'unflatten' stage.
{
('title',): u'OpenStreetMap',
('name',): u'openstreetmap',
('url',): u'',
('license_id',): u'odc-pddl',
('notes',): u'OpenStreetMap (OSM) is aimed at creating and providing free geographic data such as street maps to anyone who wants them. The project was started because most maps you think of as free actually have legal or technical restrictions on their use, holding back people from using them in creative, productive or unexpected ways.',
('tag_string',): u'',
('add-resource-url',): [u'',
u'http://ftp://ftp.spline.de/pub/openstreetmap/planet/planet-latest.osm.bz2'],
('resources', 0, 'KEY'): u'VALUE',
('resources', 0, 'description'): u'Full dump of the planet',
('resources', 0, 'format'): u'OSM',
('resources', 0, 'hash'): u'',
('resources', 0, 'id'): u'',
('resources', 0, 'last_modified'): u'',
('resources', 0, 'mimetype'): u'',
('resources', 0, 'mimetype_inner'): u'',
('resources', 0, 'name'): u'Planet dump',
('resources', 0, 'resource_type'): u'file',
('resources', 0, 'size'): u'234555',
('resources', 0, 'url'): u'ftp://ftp.spline.de/pub/openstreetmap/planet/planet-latest.osm.bz2',
('resources', 0, 'webstore_url'): u'',
('author',): u'',
('author_email',): u'',
('maintainer',): u'',
('maintainer_email',): u'',
('version',): u''
('extras', 0, 'key'): u'',
('extras', 0, 'value'): u'',
('extras', 1, 'key'): u'',
('extras', 1, 'value'): u'',
('extras', 2, 'key'): u'',
('extras', 2, 'value'): u'',
('extras', 3, 'key'): u'',
('extras', 3, 'value'): u'',
('log_message',): u'Created new dataset.',
('save',): u'Add Dataset',
}
- converts to lists of dicts: extras, resources
{
'title': u'OpenStreetMap',
'name': u'openstreetmap',
'url': u'',
'license_id': u'odc-pddl',
'notes': u'OpenStreetMap (OSM) is aimed at creating and providing free geographic data such as street maps to anyone who wants them. The project was started because most maps you think of as free actually have legal or technical restrictions on their use, holding back people from using them in creative, productive or unexpected ways.',
'tag_string': u'',
'add-resource-url': [u'',
u'http://ftp://ftp.spline.de/pub/openstreetmap/planet/planet-latest.osm.bz2'],
'resources': [{'KEY': u'VALUE',
'description': u'Full dump of the planet',
'format': u'OSM',
'hash': u'',
'id': u'',
'last_modified': u'',
'mimetype': u'',
'mimetype_inner': u'',
'name': u'Planet dump',
'resource_type': u'file',
'size': u'234555',
'url': u'ftp://ftp.spline.de/pub/openstreetmap/planet/planet-latest.osm.bz2',
'webstore_url': u''}],
'author': u'',
'author_email': u'',
'maintainer': u'',
'maintainer_email': u'',
'version': u''
'extras': [{'key': u'', 'value': u''},
{'key': u'', 'value': u''},
{'key': u'', 'value': u''},
{'key': u'', 'value': u''}],
'log_message': u'Created new dataset.',
'save': u'Add Dataset',
}
- Removes blank values
{
'title': u'OpenStreetMap',
'name': u'openstreetmap',
'url': u'',
'license_id': u'odc-pddl',
'notes': u'OpenStreetMap (OSM) is aimed at creating and providing free geographic data such as street maps to anyone who wants them. The project was started because most maps you think of as free actually have legal or technical restrictions on their use, holding back people from using them in creative, productive or unexpected ways.',
'tag_string': u'',
'add-resource-url': [u'',
u'http://ftp://ftp.spline.de/pub/openstreetmap/planet/planet-latest.osm.bz2'],
'resources': [{'KEY': u'VALUE',
'description': u'Full dump of the planet',
'format': u'OSM',
'hash': u'',
'id': u'',
'last_modified': u'',
'mimetype': u'',
'mimetype_inner': u'',
'name': u'Planet dump',
'resource_type': u'file',
'size': u'234555',
'url': u'ftp://ftp.spline.de/pub/openstreetmap/planet/planet-latest.osm.bz2',
'webstore_url': u''}],
'author': u'',
'author_email': u'',
'maintainer': u'',
'maintainer_email': u'',
'version': u''
'extras': [],
'log_message': u'Created new dataset.',
'save': u'Add Dataset',
}
And 'type': 'package' is inserted (for example) before sending to package_create.