{ "info": { "author": "Brendan W. McAdams", "author_email": "bwmcadams@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 7 - Inactive" ], "description": "=========================\r\nThis package is DEPRECATED\r\n=========================\r\n\r\nAll of the changes in this package have been merged back into the original \r\nproject, MongoKit ... As a result, it makes the most sense to deprecate \r\nmongokit-pylons. MongoKit has, since the merge, added a large body of \r\nadditional functionality. I am working on a bridge version to assist with \r\nmigration, but for now you should look towards moving over to the main \r\nproject.\r\n\r\n\r\n=========================\r\nWhat is MongoDB/MongoKit?\r\n=========================\r\nMongoDB is a free & open source, schemaless document oriented\r\ndatabase (available at http://mongodb.org). The MongoKit \r\nframework is an ORM-like layer which provides an enhanced \r\napproach to managing your MongoDB data by providing an object \r\nlayer. This layer allows you to define rough schema outlines\r\nincluding default values and allowed & required fields.\r\nWhile schemaless databases have power in their lack of schema,\r\nit helps to control what fields are and aren't permitted \r\n(even if you only use 3 of 10 most times) to ensure consistency.\r\n\r\nThe original MongoKit is written by Namlook, and is available at \r\nhttp://bitbucket.org/namlook/mongokit/\r\n\r\nMongoKit-Pylons is a (hopefully temporary) fork which provides a \r\ntoolset for easily integrating MongoKit within the Pylons web \r\nframework. It provides the ability to parse mongo configuration\r\nfrom Pylons ini config files, and setup easily in \r\nconfig/environment.py as an always-available, threadlocal \r\nconnection pool (similar to how SQLAlchemy is typically setup in Pylons). \r\n\r\nFrom my own usage of MongoKit following integrating \r\nPylons support into my production systems, I have added several\r\nenhancements to the MongoKit-Pylons fork which I've found useful.\r\nThese features include property-like setter/getter proxying for \r\nvalues (instead of pure dictionary access) and support for the \r\nMongoDB driver's autoreferencing features. Autoreferencing \r\nallows you to embed MongoKit objects/instances inside another\r\nMongoKit object. With autoreferencing enabled, MongoKit and\r\nthe pymongo driver will translate the embedded MongoKit object\r\nvalues into internal MongoDB DBRefs. The (de)serialization is \r\nhandled automatically by the pymongo driver.\r\n\r\nIt is my hope/intention to merge this fork back into the main\r\nproject. \r\n\r\n===============\r\nMongoKit-Pylons\r\n===============\r\n[Note that if you used an earlier version of this fork, I have\r\nrecently changed the namespace to mongokit.pylons so as not to\r\nconflict. The latest release can be grabbed from pypi]\r\n\r\n.. _release: http://pypi.python.org/pypi/mongokit-pylons\r\n.. _pypi: http://pypi.python.org/pypi/mongokit-pylons\r\n\r\nThis is a fork (hopefully temporary, as I'd like to merge into \r\none codebase) of the fantastic MongoKit_ to add better support \r\nfor Pylons_. Along the way I have added a few features such as \r\n__setattr__ / __getattr__ to set / get values as properties \r\nrather than talking to the dictionary. \r\n\r\nThis fork also supports the autoreferencing feature from the \r\npymongo_. driver. \r\n\r\nMongoPylonsEnv is a helper class for using MongoKit_ inside of \r\nPylons_. - The recommended deployment is to add a call to \r\ninit_mongo() in config/environment.py for your pylons project.\r\nLike with SQLAlchemy_, this will setup your connections\r\nat Pylons boot; the MongoDB_ Pool code should ensure you have \r\nenough connections.\r\n\r\n.. _MongoKit: http://bitbucket.org/namlook/mongokit/wiki/Home\r\n.. _Pylons: http://pylonshq.com\r\n.. _SQLAlchemy: http://sqlalchemy.org\r\n.. _pymongo: http://github.com/mongodb/mongo-python-driver/\r\n.. _autoref_sample: http://github.com/mongodb/mongo-python-\r\ndriver/blob/cd47b2475c5fe567e98696e6bc5af3c402891d12/examples/auto_r\r\neference.py\r\n\r\nAdd the import at the top::\r\n\r\n >>> from mongokit.pylons.pylons_env import MongoPylonsEnv\r\n\r\nAnd lower down, in load_environment()::\r\n\r\n >>> MongoPylonsEnv.init_mongo()\r\n \r\nAdditionally, you'll need to add several items to your \r\nconfiguration ini file::\r\n\r\n\r\n >>> # Mongo Database settings \r\n\t... mongodb.host = localhost \r\n\t... mongodb.port = 27017\r\n ... mongodb.db = your_db_name\r\n ... mongodb.connection_timeout = 30\r\n ... mongodb.pool.enable = True\r\n ... mongodb.pool.size = 20\r\n\r\nTo enable pylons support, your document class MUST specify::\r\n\r\n >>> _use_pylons = True \r\n\r\nas a class level attribute. MongoKit's document connection \r\nmanagement is class based, so if you need the same document to \r\nwork in and out of pylons, it is recommended you create a \r\n\"normal\" MongoDocument subclass, and a subclass of THAT which \r\ndefines _use_pylons.\r\n\r\nAlternately, for the ultimate in lazy::\r\n \r\n >>> from mongokit.pylons.document import MongoPylonsDocument\r\n \r\nAnd then subclass from that (It's a proxy subclass of \r\nMongoDocument which enables use_pylons).\r\n\r\nOne further perk of this version is AutoReferences. \r\nAutoreferences allow you to pass other MongoDocuments as values. \r\npymongo_. (with help from MongoKit) automatically \r\ntranslates these object values into DBRefs before persisting to \r\nMongo. When fetching, it translates them back, so that you have \r\nthe data values for your referenced object. \r\nSee the autoref_sample_. for further details/internals on this \r\ndriver-level functionality. As for enabling it in your own \r\nMongoKit code, simply define the following class attribute \r\nupon your Document subclass::\r\n \r\n >>> _enable_autoref = True\r\n\r\nWith autoref enabled, MongoKit's connection management will \r\nattach the appropriate BSON manipulators to your document's \r\nconnection handles. We require you to explicitly enable autoref \r\nfor two reasons:\r\n\r\n - Using autoref and it's BSON manipulators (As well as DBRefs) come with a \r\nperformance penalty, so we don't load them unless you opt-in at class-level.\r\n - You may not wish to use auto-referencing in some cases where you're \r\nusing DBRefs.\r\n\r\nOnce you have autoref enabled, MongoKit will allow you to define \r\nany valid subclass of MongoDocument as part of your document \r\nstructure. **If your class does not define _enable_autoref as \r\nTrue, MongoKit's structure validation code will REJECT your \r\nstructure. The rules are *autoref enabled*, *issubclass(, \r\nMongoDocument)*.**\r\n\r\nA detailed example::\r\n\r\n >>> class BlogEntry(MongoPylonsDocument):\r\n ... collection_name = 'blog'\r\n ... structure = {\r\n ... 'author': AdminUser,\r\n ... 'publish_date': datetime.datetime,\r\n ... 'title': unicode,\r\n ... 'entry': unicode,\r\n ... }\r\n ...\r\n ... _enable_autoref = True \r\n ... required_fields = ['author', 'publish_date', 'entry', 'title']\r\n ... default_values = {'publish_date': datetime.datetime.now()}\r\n\r\nAdditionally, with this codebase, MongoDocument supports property \r\nstyle set/get. Where in the original codebase you had to do::\r\n\r\n >>> user = TestUserDocument()\r\n ... user['password'] = 'p455'\r\n\r\nWith this code you can invoke it as::\r\n\r\n >>> user = TestUserDocument()\r\n ... user.password = 'p455'\r\n\r\nFor any questions related to this fork, especially the Pylons & \r\nAutoref (and properties) support, please contact myself (Brendan \r\nMcAdams ) rather than namlook. I can be reached at \r\nNO*bwmcadams*SPAM@gmail.*OMGSPAM*.com, and sometimes lurk on \r\nfreenode #mongodb as bwmcadams.\r\n\r\nDocs for core MongoKit follow...\r\n\r\n========\r\nMongoKit\r\n========\r\n\r\nMongoDB_ is a great schema-less document oriented database. It have a lot of\r\ndriver for many langages (python, ruby, perl, java, php...).\r\n\r\n.. _MongoDB : http://www.mongodb.org/display/DOCS/Home\r\n\r\nMongoKit is a python module that brings structured schema and validation layer\r\non top of the great pymongo driver. It has be written to be simpler and lighter\r\nas possible with the KISS and DRY principles in mind.\r\n\r\nFeatures\r\n========\r\n\r\n * schema validation (wich use simple python type for the declaration)\r\n * nested and complex schema declaration\r\n * required fields validation\r\n * default values\r\n * custom validators\r\n * inheritance and polymorphisme support\r\n * versionized document support (still in alpha stage)\r\n * partial auth support (it brings a simple User model) \r\n\r\nA quick example\r\n===============\r\n\r\nMongoDocument are enhanced python dictionnary with a ``validate()`` \r\nmethod.\r\nA MongoDocument declaration look like that::\r\n\r\n >>> from mongokit.pylons import MongoDocument\r\n >>> import datetime\r\n\r\n >>> class BlogPost(MongoDocument):\r\n ... db_name = 'test'\r\n ... collection_name = 'tutorial'\r\n ... structure = {\r\n ... 'title':unicode,\r\n ... 'body':unicode,\r\n ... 'author':unicode,\r\n ... 'date_creation':datetime.datetime,\r\n ... 'rank':int\r\n ... }\r\n ... required_fields = ['title','author', 'date_creation']\r\n ... default_values = {'rank':0, 'date_creation':datetime.datetime.utcnow}\r\n ... \r\n >>> blogpost = BlogPost()\r\n >>> blogpost['title'] = u'my title'\r\n >>> blogpost['body'] = u'a body'\r\n >>> blogpost['author'] = u'me'\r\n >>> blogpost.validate()\r\n >>> blogpost # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE\r\n {'body': u'a body', 'title': u'my title', 'date_creation': datetime.datetime(...), \r\n'rank': 0, 'author': u'me'}\r\n >>> blogpost.save()\r\n \r\nAnd you can use more complex structure::\r\n\r\n >>> class ComplexDoc(MongoDocument):\r\n ... db_name = 'test'\r\n ... collection_name = 'tutorial'\r\n ... structure = {\r\n ... \"foo\" : {\"content\":int},\r\n ... \"bar\" : {\r\n ... int:{unicode:int}\r\n ... }\r\n ... }\r\n ... required_fields = ['foo.content', 'bar.$int']\r\n \r\nPlease, see the tutorial_ for more examples.\r\n\r\n.. _tutorial : http://bitbucket.org/namlook/mongokit/wiki/Home\r\n\r\n[ For any questions related to this fork, especially the Pylons & Autoref (and \r\nproperties) support, rather than the core mongokit code, please contact myself \r\n(Brendan McAdams ) rather than namlook. I can be reached at \r\nNO*bwmcadams*SPAM@gmail.*OMGSPAM*.com, and sometimes lurk on \r\nfreenode #mongodb as bwmcadams.]", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://bitbucket.org/bwmcadams/mongokit-pylons/", "keywords": "mongo mongodb mongokit pylons", "license": "New BSD License", "maintainer": "", "maintainer_email": "", "name": "mongokit-pylons", "package_url": "https://pypi.org/project/mongokit-pylons/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/mongokit-pylons/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://bitbucket.org/bwmcadams/mongokit-pylons/" }, "release_url": "https://pypi.org/project/mongokit-pylons/0.2.0/", "requires_dist": null, "requires_python": null, "summary": "MongoDB interface for ORM-like object mapping (w/ Pylons support)", "version": "0.2.0" }, "last_serial": 803092, "releases": { "0.1.1": [ { "comment_text": "", "digests": { "md5": "2fcac39253d2205f978b72d3e79ad036", "sha256": "746a15da94401bd08999f8be5b128628e4786095c9dd49255e6ec5123af7174f" }, "downloads": -1, "filename": "mongokit_pylons-0.1.1-py2.6.egg", "has_sig": false, "md5_digest": "2fcac39253d2205f978b72d3e79ad036", "packagetype": "bdist_egg", "python_version": "2.6", "requires_python": null, "size": 63892, "upload_time": "2009-08-10T06:59:48", "url": "https://files.pythonhosted.org/packages/1e/80/a50ded43c9c572c48e30e416877555eea5907e90b679816e8310eea19203/mongokit_pylons-0.1.1-py2.6.egg" }, { "comment_text": "", "digests": { "md5": "a938687b1f762d88ac38192c7921745f", "sha256": "5f4e55318e7f20d89d3efc9be332e81f2f4ef48bb09c110c0056b88ab3f2f738" }, "downloads": -1, "filename": "mongokit-pylons-0.1.1.tar.gz", "has_sig": false, "md5_digest": "a938687b1f762d88ac38192c7921745f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 29522, "upload_time": "2009-08-10T06:59:50", "url": "https://files.pythonhosted.org/packages/87/47/b6de9e8ad98aeaaf2c41318e4bdd9af9a216d0c959af0f2ee7959b7aa807/mongokit-pylons-0.1.1.tar.gz" } ], "0.1a": [], "0.2.0": [ { "comment_text": "", "digests": { "md5": "4ed112b2d602315b2f7f39b85a543f14", "sha256": "ced5d730489a6bda63781e6d385fcab088ffc4b1305c27754481d9dc08cffed6" }, "downloads": -1, "filename": "mongokit-pylons-0.2.0.tar.gz", "has_sig": false, "md5_digest": "4ed112b2d602315b2f7f39b85a543f14", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 28333, "upload_time": "2009-10-11T04:08:04", "url": "https://files.pythonhosted.org/packages/80/48/3e7641c81d900b4a830eb24b45f6bedbca14683fd8afff99c542fe0333cd/mongokit-pylons-0.2.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "4ed112b2d602315b2f7f39b85a543f14", "sha256": "ced5d730489a6bda63781e6d385fcab088ffc4b1305c27754481d9dc08cffed6" }, "downloads": -1, "filename": "mongokit-pylons-0.2.0.tar.gz", "has_sig": false, "md5_digest": "4ed112b2d602315b2f7f39b85a543f14", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 28333, "upload_time": "2009-10-11T04:08:04", "url": "https://files.pythonhosted.org/packages/80/48/3e7641c81d900b4a830eb24b45f6bedbca14683fd8afff99c542fe0333cd/mongokit-pylons-0.2.0.tar.gz" } ] }