This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

Pyjon.Versionning is a little helper to use mercurial to version objects in your application.

Those objects can be stored in a database for example, allowing changes from the filesystem to be synchronised in the database and the other way around (while maintaining an history).

Versionning managers are classes that get a repository folder and initialize it if not existing yet.

The base managers available are :

  • pyjon.versionning.Repository: the base repository.
  • pyjon.versionning.SARepository: the base repository to version sqlalchemy objects.

Basically, the default classes assume you have a payload or payload_xml field in your objects, and this field will get written to file.

If you want to have other field (or version your whole object serializing it as json for example), you have to create your own repository class basen on the base one.

Example using a simple json serializer

import simplejson
from myapp import get_vehicles, get_people, get_adresses
from pyjon.versionning import Repository

# for an sqlalchemy repository :
# class MyRepository(SARepository):
# for a normal one (or manual fetching) :
class MyRepository(Repository):
     def get_file_content(self, item):
        # we will assume your objects have an "serializable_fields" attribute
        # this is to support multiple object types (each object type will be stored in a separate folder)

        output_dict = dict()
        for field in item.serializable_fields:
            output_dict[field] = getattr(item, field)

        return simplejson.dumps(output_dict)



    def update_content(self, item, value):

        input_dict = simplejson.loads(value)
        for field in item.serializable_fields:
            setattr(item, field, input_dict[field])

        return simplejson.dumps(my_output_dict)

    # this is used to init the repository with all existing data
    # not necessary with SARepository as it will do it himself with the given classes and dbsession
    def get_all_objects(self):
        for item in get_vehicle():
            yield item

        for item in get_people():
            yield item

        for item in get_adresses():
            yield item

To call it, here is how

# it's thread safe, so you can define it as a global var (imported like "from my_app.versionning import repository")
repository = MyRepository('./repository',
                          default_user="our_great_app <system@ourgreatapp.com>")

# if you have an SARepository, here is how to call it:
from my_app.model import session, vehicles, people, adresses
repository = MyRepository('./repository', session,
                          [vehicles, people, adresses],
                          default_user="our_great_app <system@ourgreatapp.com>")

# now, before using an item in your app (to check changes in the repo), just do that:
repository.check_item(item)

# after saving or creating an item:
repository.store_item(item) # you can define user= to specify the user who did that

# after deleting an item:
repository.delete_item(item) # you can define user= to specify the user who did that
Release History

Release History

0.4.2

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.4.2dev

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.4.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.4

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.3

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.3dev

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
pyjon.versionning-0.4.2-py2.6.egg (9.0 kB) Copy SHA256 Checksum SHA256 2.6 Egg Oct 4, 2010
pyjon.versionning-0.4.2.tar.gz (3.2 kB) Copy SHA256 Checksum SHA256 Source Oct 4, 2010

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting