{ "info": { "author": "Ethan Jucovy", "author_email": "ejucovy@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "Programming Language :: Python" ], "description": "How it works\n============\n\nThere is an application-level API and a model-level API.\n\nUse the model-level API to define export behavior per model class, with\nautomatic exports on save.\n\nUse the application-level API to define export behavior in views (for\nexample) and explicitly trigger content export from your own code.\n\nThe model-level API\n-------------------\n\nThe design is inspired by Django's ModelAdmin and ModelForm aspect-oriented\npattern. The core behaviors are defined in the ``vcexport.models.Exporter``\nclass, which is analogous to ModelAdmin. Like ModelAdmin and ModelForm, you \nwill subclass the default base to customize the behavior on a per-model basis.\n\n1. For automatic versioning of models, register them with vcexport::\n\n import vcexport\n vcexport.register(MyModel)\n\n This will connect a post_save signal.\n\n2. You can customize the export behavior on a per-model basis by subclassing\n ``vcexport.models.Exporter`` and telling vcexport to register your model with\n the custom Exporter::\n\n class MyExporter(vcexport.models.Exporter):\n ...\n vcexport.register(MyModel, exporter=MyExporter)\n\n3. By default, models are serialized to django's XML format, because it\n works well with ``diff`` and is generic.\n\n4. You can customize the serialization per model by passing a custom\n template path as a class attribute::\n \n class MyExporter(Exporter):\n repository_template = 'fleem/document_format.txt'\n\n The template will be rendered with two context variables; ``object``\n which is the model instance that was saved, and a boolean ``created``::\n\n {% if created %}New object!{% endif %}\n {{object.title}}\n {{object.related_field.pk}}\n ****\n Color: {{object.color}}\n {{object.description}}\n\n This allows alternate use cases to be supported:\n\n * You want to version a model wholesale\n * You have a model which has one or two document-like text fields, \n and you want to version those fields only -- just don't write out\n any other fields in the serialization template.\n\n5. By default the document dumps of your model instances will be saved in\n repository paths that look like ``/app_name/ModelClassName/instance_pk``.\n\n You can customize the path::\n\n class MyExporter(Exporter):\n def repository_path(self):\n \t return '/my_custom/path_for/this_model/' + self.object.color\n\n Note that if you do this, you may end up with multiple model instances\n that save to the same file path in the repository. This is a feature.\n\n6. The default committing user is undefined. At present you cannot\n customize this.\n\n The default commit message is uninteresting: \"Object {{instance.pk}}\n (from '{{app_name}}.{{model_name}}') saved by django-vcexport.\"\n\n You can customize the commit message with a model method that\n takes a boolean ``created``, and returns a string::\n\n class MyExporter(Exporter):\n def repository_commit_message(self, created):\n if created:\n return \"User %s committed a new %s\" % (\n \t\t self.object.user.username, self.object.color)\n return \"User %s committed %s\" % (self.object.user.username, \n\t \t \t \t \t self.object.color)\n\nThe application-level API\n-------------------------\n\nYou can also export the content explicitly, for example in your model's\n``save()`` method, in view code, etc, with the ``vcexport.export_to_repository``\nfunction::\n\n def my_view(request):\n ...\n object = MyModel.objects.get(...)\n object.morx = request.POST['new_morx']\n object.save()\n\n import vcexport\n vcexport.export_to_repository(object)\n\nThe default template, commit message, etc are the same as with the model API.\nYou can customize them in your own code and pass them to ``export_to_repository``::\n\n def my_view(request):\n ...\n object, created = MyModel.objects.get_or_create(...)\n object.morx = request.POST['new_morx']\n object.save()\n\n import vcexport\n vcexport.export_to_repository(\n object, created=created,\n repository_template='fleem/morx.html',\n message=\"Changed the morx\",\n repository_path='/fleem/objects/%s' % object.pk)\n\nThe ``export_to_repository`` function will return the Revision of the commit,\nor None if there were no changes to commit. \n\nA middle ground\n---------------\n\nYou may want both the organizational benefits of grouping your behavioral\ndefinitions into an Exporter, and the flexibility of triggering exports\nexplicitly in your application code.\n\nYou can invoke an Exporter instance directly to satisfy this yen::\n\n def my_view(request):\n ...\n object, created = MyModel.objects.get_or_create(...)\n object.morx = request.POST['new_morx']\n object.save()\n\n exporter = MyExporterSubclass(object)\n\n exporter.export_to_repository(object, created=created)\n \nLike ``vcexport.export_to_repository`` this will return the Revision of\nthe commit or None if the operation resulted in no committed changes. \n\nIf you want to do this, you will likely not want to register the same\nmodels for automatic post_save export -- but maybe you do!\n\n\nConfiguration\n=============\n\nYou must provide one piece of configuration in your settings.py file:\n\n* VCEXPORT_CHECKOUT_DIR: the absolute path to a local checkout of the\n repository that you want to store your data in\n\nYou may provide additional settings.py configuration:\n\n * VCEXPORT_BACKEND: one of 'svn' or 'bzr'\n\nTo use with Subversion, you must have pysvn installed.\n\nTo use with Bazaar, you must have bazaar installed.\n\nIf this setting is not specified, the default is Subversion; however,\nBazaar is really a better backend in a lot of ways (including speed\nfor synchronous commits) and will likely become the primary supported\nbackend in the future.\n\nYou will have to initialize your repository // checkout on your own.\n\n\nCredits\n=======\n\nOriginally developed at Columbia University's Center for New Media\nTeaching & Learning \n\nThe source code is available on github \n\n\nNew in this version\n===================\n\n* Made ``Exporter`` importable as ``vcexport.Exporter``\n\n* Removed 'hg' option for VCEXPORT_BACKEND, since sven no longer supports this.\n\n* Added new 'bzr' option for VCEXPORT_BACKEND.\n\n\nHistory\n=======\n\n0.5.1 (06-12-09)\n----------------\n\nBrown-bag release; made ``export_to_repository`` function available as\npublic API (``vcexport.export_to_repository``)\n\n0.5 (06-12-09)\n--------------\n\nSplit apart distinct APIs for model-level behavior and application-level usage.\n\n0.4 (24-11-09)\n--------------\n\nInitial release. This package was previously called `svndjango`. It was\nredesigned from the ground up and renamed `django-vcexport` to describe\nmore accurately what it does.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "UNKNOWN", "keywords": "", "license": "GPL", "maintainer": null, "maintainer_email": null, "name": "django-vcexport", "package_url": "https://pypi.org/project/django-vcexport/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django-vcexport/", "project_urls": { "Download": "UNKNOWN", "Homepage": "UNKNOWN" }, "release_url": "https://pypi.org/project/django-vcexport/0.6/", "requires_dist": null, "requires_python": null, "summary": "a flexible library for exporting serialized django model instances to a version-controlled repository automatically or manually", "version": "0.6" }, "last_serial": 790976, "releases": { "0.4": [ { "comment_text": "", "digests": { "md5": "cb42701bcac00efff5fc3b406c8e334c", "sha256": "4ad3eaff6f4512f1c8a6fd85cc4542efcd1ddffbfdb8a4ac71373164c1f97bc3" }, "downloads": -1, "filename": "django-vcexport-0.4.tar.gz", "has_sig": false, "md5_digest": "cb42701bcac00efff5fc3b406c8e334c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4647, "upload_time": "2009-11-24T17:53:39", "url": "https://files.pythonhosted.org/packages/a4/bb/625a034df5ae6ca06991717ed32ddc9068ad2ca45250dffaadc3af874d26/django-vcexport-0.4.tar.gz" } ], "0.5": [ { "comment_text": "", "digests": { "md5": "842e0b8402d41907aeb557b58df653f4", "sha256": "d074477531d549d4e54c5d307fa20f432fd2a11ffffc874d36c2b36aec559f86" }, "downloads": -1, "filename": "django-vcexport-0.5.tar.gz", "has_sig": false, "md5_digest": "842e0b8402d41907aeb557b58df653f4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5200, "upload_time": "2009-12-06T16:12:15", "url": "https://files.pythonhosted.org/packages/6a/43/aa4258b6033ab10007f651f6857093175b19252e879380d01428b5a69b6b/django-vcexport-0.5.tar.gz" } ], "0.5.1": [ { "comment_text": "", "digests": { "md5": "78fbe55ec54385cd69f2656c5094ff30", "sha256": "73c6cf3671266fb97f3d1e000eabc5a7263d4c91885a2ed9ddb46a9890363bd6" }, "downloads": -1, "filename": "django-vcexport-0.5.1.tar.gz", "has_sig": false, "md5_digest": "78fbe55ec54385cd69f2656c5094ff30", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5176, "upload_time": "2009-12-06T16:24:40", "url": "https://files.pythonhosted.org/packages/d1/cf/d13853f6b077e4e490256b5dbbfd6c90b02201489716b2a2b016c772d8ff/django-vcexport-0.5.1.tar.gz" } ], "0.6": [ { "comment_text": "", "digests": { "md5": "ffdd5bd4c50c35a4c245b940b3ea10e6", "sha256": "276989e69911927710d30b6aea2e474657d903b6173c5399482cb4f14b7946fb" }, "downloads": -1, "filename": "django-vcexport-0.6.tar.gz", "has_sig": false, "md5_digest": "ffdd5bd4c50c35a4c245b940b3ea10e6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5962, "upload_time": "2010-08-26T18:39:45", "url": "https://files.pythonhosted.org/packages/09/d4/8972ea682fc9f7df0fed87dc6080a349484b95c727885f2505dbf40a2390/django-vcexport-0.6.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "ffdd5bd4c50c35a4c245b940b3ea10e6", "sha256": "276989e69911927710d30b6aea2e474657d903b6173c5399482cb4f14b7946fb" }, "downloads": -1, "filename": "django-vcexport-0.6.tar.gz", "has_sig": false, "md5_digest": "ffdd5bd4c50c35a4c245b940b3ea10e6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5962, "upload_time": "2010-08-26T18:39:45", "url": "https://files.pythonhosted.org/packages/09/d4/8972ea682fc9f7df0fed87dc6080a349484b95c727885f2505dbf40a2390/django-vcexport-0.6.tar.gz" } ] }