Release: | 0.5 |
---|---|
Date: | September 19, 2009 |
PyAMF 0.5 is a cleanup of the internals of 0.4 and it provides some performance optimizations. In accomplishing this, a number of features were added:
Contents
A new way to handle attribute en/decoding. New features include excluding attributes, read-only attributes, and proxied attributes. If you use external classes, this one is also for you. Check the Attribute Control document for more details.
The lazy loading module (pyamf.util.imports) that powers the adapter modules has been completely revamped. There were too many edge cases that would cause problems in the import mechanism. We now supply a module finder/loader in sys.meta_path so we can intercept the import calls. This has completely cleared up the problems we were seeing and it has the added benefit of halving the time it took to run the 650+ unit tests in the suite!
The cPyAMF extension has been completely revamped and no longer uses cStringIO to handle the byte packing. The extension has also been extended to cover more of the library. This has given a nice speed-up but we are by no means finished.
Support for non-UTC timezones has been added. If you supply timezone_offset to the pyamf.remoting.gateway.*.*Gateway classes then any datetimes will be offset against that figure (in seconds). This is only useful for legacy systems so you don’t need to change anything if you are already using UTC (in fact using UTC is the recommended practice).
Support has been provided for decoding and encoding ISmallMessage objects. This means better integration with BlazeDS and sets the foundations for better Flex Messaging support.
A new way to bulk register classes has been introduced - register_package You can register a module:
import pyamf
from myproj.myapp import models
pyamf.register_package(models, 'foo.bar')
Besides greater stability for the Windows platform, more types from the Python 2.6 standard library are now supported, including:
Module | Encode | Decode |
---|---|---|
collections.deque | list | list |
collections.defaultdict | untyped object | dict |
collections.namedtuple | list | list |
array.array | list | list |
Python exceptions are now mapped to Actionscript exceptions (where possible), including the name and message attributes. You can now map error classes:
import pyamf
pyamf.register_class(ValueError, 'com.acme.app.errors.ValueError')
1 2 3 4 5 6 7 8 9 10 11 | from django.db import models
class CommonInfo(models.Model):
name = models.CharField(max_length=100)
age = models.PositiveIntegerField()
class Meta:
abstract = True
class Student(CommonInfo):
home_group = models.CharField(max_length=5)
|
1 2 3 4 5 6 7 | from google.appengine.ext.db import polymodel
class Poly(polymodel.PolyModel):
s = db.StringProperty()
class DeepPoly(Poly):
d = db.IntegerProperty()
|