Download Shareware and Freeware Software for Windows, Linux, Macintosh, PDA

line Home  |  About Us  |  Link To Us  |  FAQ  |  Contact

Serving Software Downloads in 976 Categories, Downloaded 31.065.178 Times

django-picklefield 0.2.1

Company: Shrubbery Software
Date Added: November 11, 2013  |  Visits: 313


Report Broken Link
Printer Friendly Version

Product Homepage
Download (18 downloads)

**django-picklefield** provides an implementation of a pickled object field.<br />Such fields can contain any picklable objects.<br /><br />The implementation is taken and adopted from `Django snippet #1694<br />`_ by Taavi Taijala, which is in<br />turn based on `Django snippet #513 `_<br />by Oliver Beattie.<br /><br />django-picklefield is available under the MIT license.<br />First of all, you need to have **django-picklefield** installed; for your<br />convenience, recent versions should be available from PyPI.<br /><br />To use, just define a field in your model::<br /><br /> >>> from picklefield.fields import PickledObjectField<br /> ... class SomeObject(models.Model):<br /> ... args = PickledObjectField()<br /><br />and assign whatever you like (as long as it's picklable) to the field::<br /><br /> >>> obj = SomeObject()<br /> >>> obj.args = ['fancy', {'objects': 'inside'}]<br /> >>><br /><br />If you need to serialize an object with a PickledObjectField for transmission<br />to the browser, you may need to subclass the field and override the<br />``value_to_string()`` method. Currently pickle fields are serialized as<br />base64-encoded pickles, which allows reliable deserialization, but such a<br />format is not convenient for parsing in the browser. By overriding<br />``value_to_string()`` you can choose a more convenient serialization format.<br /><br />Here are the notes by taavi223, the original author:<br /><br />Incredibly useful for storing just about anything in the database (provided it<br />is Pickle-able, of course) when there isn't a 'proper' field for the job.<br /><br />PickledObjectField is database-agnostic, and should work with any database<br />backend you can throw at it. You can pass in any Python object and it will<br />automagically be converted behind the scenes. You never have to manually pickle<br />or unpickle anything. Also works fine when querying; supports exact, in, and<br />isnull lookups. It should be noted, however, that calling QuerySet.values()<br />will only return the encoded data, not the original Python object.<br /><br />This PickledObjectField has a few improvements over the one in snippet #513.<br /><br />This one solves the DjangoUnicodeDecodeError problem when saving an object<br />containing non-ASCII data by base64 encoding the pickled output stream. This<br />ensures that all stored data is ASCII, eliminating the problem.<br /><br />PickledObjectField will now optionally use zlib to compress (and uncompress)<br />pickled objects on the fly. This can be set per-field using the keyword<br />argument "compress=True". For most items this is probably not worth the small<br />performance penalty, but for Models with larger objects, it can be a real space<br />saver.<br /><br />You can also now specify the pickle protocol per-field, using the protocol<br />keyword argument. The default of 2 should always work, unless you are trying to<br />access the data from outside of the Django ORM.<br /><br />Worked around a rare issue when using the cPickle and performing lookups of<br />complex data types. In short, cPickle would sometimes output different streams<br />for the same object depending on how it was referenced. This of course could<br />cause lookups for complex objects to fail, even when a matching object exists.<br />See the docstrings and tests for more information.<br /><br />You can now use the isnull lookup and have it function as expected. A<br />consequence of this is that by default, PickledObjectField has null=True set<br />(you can of course pass null=False if you want to change that). If null=False<br />is set (the default for fields), then you wouldn't be able to store a Python<br />None value, since None values aren't pickled or encoded (this in turn is what<br />makes the isnull lookup possible).<br /><br />You can now pass in an object as the default argument for the field without it<br />being converted to a unicode string first. If you pass in a callable though,<br />the field will still call it. It will not try to pickle and encode it.<br /><br />You can manually import dbsafe_encode and dbsafe_decode from if you<br />want to encode and decode objects yourself. This is mostly useful for decoding<br />values returned from calling QuerySet.values(), which are still encoded<br />strings.<br /><br />Note: If you are trying to store other django models in the PickledObjectField,<br />please see the comments for a discussion on the problems associated with doing<br />that. The easy solution is to put django models into a list or tuple before<br />assigning them to the PickledObjectField.<br /><br />Update 9/2/09: Fixed the value_to_string method so that serialization should<br />now work as expected. Also added deepcopy back into dbsafe_encode, fixing #4<br />above, since deepcopy had somehow managed to remove itself. This means that<br />lookups should once again work as expected in all situations. Also made the<br />field editable=False by default (which I swear I already did once before!)<br />since it is never a good idea to have a PickledObjectField be user editable.<br /><br />-------<br />Changes<br />-------<br /><br />Changes in version 0.1.5<br />========================<br /><br /> * Added support for South.<br /> * Changed default to null=False, as is common throughout Django.<br /><br />Changes in version 0.1.4<br />========================<br /><br /> * Updated copyright statements.<br /><br />Changes in version 0.1.3<br />========================<br /><br /> * Updated serialization tests (thanks to Michael Fladischer).<br /><br />Changes in version 0.1.2<br />========================<br /><br /> * Added Simplified BSD licence.<br /><br />Changes in version 0.1.1<br />========================<br /><br /> * Added test for serialization.<br /> * Added note about JSON serialization for browser.<br /> * Added support for different pickle protocol versions (thanks to Michael<br /> Fladischer).<br /><br />Changes in version 0.1<br />======================<br /><br /> * First public release.<br /><br /><br />--------<br />Feedback<br />--------<br /><br />There is a `home page `_<br />with instructions on how to access the code repository.

Requirements: No special requirements
Platforms: *nix, Linux
Keyword: Added Browser Default Expected Field Fields Gtgtgt Lookups Object Objects Pickle Pickled Pickledobjectfield Serialization Snippet Version
Users rating: 0/10

License: Freeware Size: 10.24 KB
Networking  -  Wildflowerizer 1.1
Wildflowerizer is a sidebar widget that randomly displays a photo that's been recently added to the Wildflower Field Guide, North America group at Flickr.Installation : 1. Install the plugin through the 'Plugins' menu in WordPress. If installing...
10 KB  
Programming  -  zope.fssync 3.5.2
This package provides filesystem synchronization utilities for Zope 3. It is used by the package. Filesystem Synchronization This package provides an API for the synchronization of Python objects with a serialized...
71.68 KB  
Productivity  -  Temp Contacts
Temp Contacts allows you to save new contacts locally on your phone without syncing them to the cloud. Just open the app, add a new contact and let the application manage it. You can always come back to the application and delete all those...
1024 KB  
Programming  -  WordNetScope
WordNet Browser using SQL database and Hibernate as Object-Relational Mapping
63.67 MB  
Modules  -  Mongodb Peekaboo; Ajax CCK field loader 6.x-1.0
Provides a CCK field that can be used in nodes, node templates, and views to output the contents of another CCK field, from the same node, via Ajax.Click the image on the right to see an animated demonstration.BackgroundThis module was made when I...
10 KB  
Networking  -  Simple Fields 0.4
Simple Fields for WordPress let you add groups of fields (aka "field groups") to you edit post page. It is meant as a replacement for WordPress own custom fields.Simple Fields turns WordPress into an even more powerful Content Management System...
163.84 KB  
Modules  -  CCK Private Fields 6.x-1.1
* The field settings screen provides a new option to enable privacy options for fields. This option is global and affects all content types where the given field is shared. The default privacy status can be specified. * This module supports all...
30.72 KB  
Modules  -  Term Fields 6.x-1.16
Term Fields allows you to define fields for taxonomy terms in the same way that CCK allows you to define fields for nodes.Possible uses for this module * You own a book review site where you use the Taxonomy module to classify book reviews by the...
20.48 KB  
Modules  -  Case Tracker Comment Driven 6.x-1.0-alpha1
casetracker_comment_driven (CTCD for short) allows for CCK fields to be added to Case Tracker and tracked in the comments in a manner identical to how standard cases are tracked. This is achieved by using the Comment Driven module to track changes...
10 KB  
Web Browser Tools  -  Net Notes
Net Notes is a Firefox extension that allows you to easily store notes on websites in your bookmarks. USAGE: Notes for the website in your active browser tab can be added and edited in a simple textbox in your Firefox...
30.72 KB  
Web Authoring  -  django-compass 0.1
django-compass is a Django app that offers simple compilation of Compass projects. #md5=f8c46f23a0329cb77da8e35c14e3c54c
10.24 KB  
Web Authoring  -  APRS World 0.1
APRS World is comprised of an Automatic Packet Reporting System (APRS) parser and a web interface. The parser connects to an APRS feed and inserts packets into a MySQL database. The web interface provides a convenient means of retrieving this...
20.48 KB  
Web Authoring  -  django-debug-toolbar 0.9.1
jango-debug-toolbar is a configurable set of panels that display various debug information about the current request/response and when clicked, display more details about the panel's content. Currently, the following panels have been...
143.36 KB  
Web Authoring  -  El Cid 0.2
El Cid is a cheezy little caller id program for Linux. Running as a background process, El Cid writes output into a comma seperated variable file. This is then parsed by other utilities such as, which generates pages for viewing via the web.
51.2 KB  
Web Authoring  -  supercaptcha 0.1.1
supercaptcha is a Django plugin that adds a captcha field for the new forms. Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design. md5=7b1d933dbeeecc6f36c6c0c9cf3e71b2
10.24 KB  
HTML Utilities  -  make-photo-pages 1.2 is a free python program that generates static web albums (HTML) based on Google Picasa's export to XML feature or from a directory of pictures. It's 100% template based and supports i18n, exif and other features common on software of this...
686.08 KB  
HTML Utilities  -  MoonDragon API 2.0.1
Framework de desarrollo de aplicaciones web en PHP MoonDragon es una colecci?*N*n de herramientas y librer?*A*as que buscar facilitar el desarrollo de aplicaciones en php como sitios web, RIA's, Web Services y algunos otros.
122.88 KB  
HTML Utilities  -  typepad-motion 1.1.2
Motion is a Django application for community microblogging through the TypePad API. #md5=efa59c71ca774856fd25c8d727a7dde9
245.76 KB  
HTML Utilities  -  django-dajaxice 0.1.5
dajaxice is the communication core of dajaxproject. Its main goal is to trivialize the asynchronous communication within the django server side code and your js code. dajaxice is JS-framework agnostic and focuses on decoupling the...
10.24 KB  
HTML Utilities  -  Pyrone 0.2.5
Pyrone is a lightweight and simple personal blog-like CMS application written in Python and Pyramid framework. Features basic blog functions: writing new articles, article discussions; internal files storage;
61.44 KB