{
"info": {
"author": "George Gozadinos",
"author_email": "ggozad@qiweb.net",
"bugtrack_url": null,
"classifiers": [
"Environment :: Web Environment",
"Framework :: Plone",
"Intended Audience :: Developers",
"License :: OSI Approved :: GNU General Public License (GPL)",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Topic :: Software Development :: Libraries :: Python Modules"
],
"description": "Introduction\n------------\n\nThe purpose of this example package is to demonstrate how to migrate custom\nAT-based content types that use FileFields to use `plone.app.blob\n`_ based blobs.\n\n\nMigrating your own AT-based content types.\n------------------------------------------\n\nIn order to migrate your own content types to use blobs you need to perform\nthe following steps:\n\nUse a schema extender to replace the FileField(s) of your content type with\nBlobField(s). For detailed information on how to do so please look into the\n`archetypes.schemaextender\n`_ documentation. In\nessence this breaks down to:\n\n- Creating an *extension* field::\n\n class ExtensionBlobField(ExtensionField, BlobField):\n \"\"\" derivative of blobfield for extending schemas \"\"\"\n\n- Extending your content type to use the blob fields. So for instance if your\n content type ExampleATType has two fields, namely *afile* and *secondfile*\n you need to register an extender looking like::\n\n class ExampleATTypeExtender(object):\n adapts(IExampleATType)\n implements(ISchemaExtender)\n\n fields = [\n ExtensionBlobField('afile',\n widget=atapi.FileWidget(\n label=_(u\"A file\"),\n description=_(u\"Some file\"),\n ),\n required=True,\n validators=('isNonEmptyFile'),\n ),\n ExtensionBlobField('secondfile',\n widget=atapi.FileWidget(\n label=_(u\"Some other file\"),\n description=_(u\"Some other file\"),\n ),\n required=True,\n validators=('isNonEmptyFile'),\n ),\n ]\n\n def __init__(self, context):\n self.context = context\n\n def getFields(self):\n return self.fields\n\n If you want to be able to still use your content type without\n *plone.app.blob* on instances that do not support blobs yet, you will find\n it convenient to register the adapter with a conditional such as::\n\n \n\n This way, if plone.app.blob is not installed your original FileField(s) will\n be used.\n\n- Writing a migrator. We use `Products.contentmigration\n `_ to do so, and for\n the example above the migrator would like this::\n\n class ExampleATTypeMigrator(BaseInlineMigrator):\n \"\"\" example migrator \"\"\"\n\n src_portal_type = 'ExampleATType'\n src_meta_type = 'ExampleATType'\n dst_portal_type = 'ExampleATType'\n dst_meta_type = 'ExampleATType'\n\n fields_map = {\n 'afile': None,\n 'secondfile': None,\n }\n\n def migrate_data(self):\n f = self.obj.getField('afile').get(self.obj)\n self.obj.getField('afile').getMutator(self.obj)(f)\n f = self.obj.getField('secondfile').get(self.obj)\n self.obj.getField('secondfile').getMutator(self.obj)(f)\n\n def last_migrate_reindex(self):\n self.obj.reindexObject()\n\n You will also need to provide a *walker* iterating over your objects, in\n this case::\n\n def migrateExampleATTypes(context):\n portal = getToolByName(context, 'portal_url').getPortalObject()\n migrator = ExampleATTypeMigrator\n walker = CustomQueryWalker(portal, migrator, full_transaction=True)\n savepoint(optimistic=True)\n walker.go()\n return walker.getOutput()\n\n You can now call *migrateExampleATTypes* from a view or a script to convert\n your objects.\n\nChangelog\n=========\n\n1.0 Unreleased\n--------------\n\n- Initial version\n [ggozad]",
"description_content_type": null,
"docs_url": null,
"download_url": "UNKNOWN",
"downloads": {
"last_day": -1,
"last_month": -1,
"last_week": -1
},
"home_page": "http://pypi.python.org/pypi/example.blobattype",
"keywords": "plone cmf zope indexing queueing catalog asynchronous",
"license": "GPL",
"maintainer": null,
"maintainer_email": null,
"name": "example.blobattype",
"package_url": "https://pypi.org/project/example.blobattype/",
"platform": "Any",
"project_url": "https://pypi.org/project/example.blobattype/",
"project_urls": {
"Download": "UNKNOWN",
"Homepage": "http://pypi.python.org/pypi/example.blobattype"
},
"release_url": "https://pypi.org/project/example.blobattype/1.0/",
"requires_dist": null,
"requires_python": null,
"summary": "Example of migrating an AT-based content type using blob-enabled FileFields.",
"version": "1.0"
},
"last_serial": 791780,
"releases": {
"1.0": [],
"1.0b1": [
{
"comment_text": "",
"digests": {
"md5": "efae631b46e50c9d7835ccc670cade86",
"sha256": "066fa85128995646e61a38c7fdbcfe5d540c573e03a410fd9d4a49cbddb61310"
},
"downloads": -1,
"filename": "example.blobattype-1.0b1.zip",
"has_sig": true,
"md5_digest": "efae631b46e50c9d7835ccc670cade86",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 31446,
"upload_time": "2009-11-01T15:08:22",
"url": "https://files.pythonhosted.org/packages/9a/d7/0a9fe7ca0c0f738b7d77a973a939a88bee4f47db63cf763a92d32cb4f90c/example.blobattype-1.0b1.zip"
}
],
"1.0b2": [
{
"comment_text": "",
"digests": {
"md5": "51d923850560b8e4ca573f9751a1fb3a",
"sha256": "aa26cafbf9dff2a37f9b0b83cb46dc5793177d5c4b33034c59622221196bab32"
},
"downloads": -1,
"filename": "example.blobattype-1.0b2.zip",
"has_sig": true,
"md5_digest": "51d923850560b8e4ca573f9751a1fb3a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 31548,
"upload_time": "2009-11-06T17:45:01",
"url": "https://files.pythonhosted.org/packages/a2/23/3dfc86a7fab2acd94fd49be57d42b0addbada3d4d97d8628e50d9fa5c971/example.blobattype-1.0b2.zip"
}
]
},
"urls": []
}