[PgPy] [ python-Bugs-1000299 ] Make type system extensible

noreply at pgfoundry.org noreply at pgfoundry.org
Thu Apr 28 08:16:59 GMT 2005


Bugs item #1000299, was opened at 2005-04-28 01:16
You can respond by visiting: 
http://pgfoundry.org/tracker/?func=detail&atid=442&aid=1000299&group_id=1000094

Category: Backend
Group: To do
Status: Open
Resolution: None
Priority: 5
Submitted By: James Pye (jwp)
Assigned to: James Pye (jwp)
Summary: Make type system extensible

Initial Comment:
Give Postgres.Type a __metaclass__ to allow classes that inherit from it the ability to act as a type interface override.

This would ideally provide things such as:

class bytea(Postgres.Type):
 oid = Postgres.Const["BYTEAOID"]
 def __new__(subtype, str):
  return Postgres.Object(subtype, str)
 ...

The Postgres.Type metaclass creates a new Postgres.Type and puts it in the cache so later lookups for the type will give the new, custom interface rather than the old and moldy defaults.

This is important as currently all type specific features are hard coded into object.c, eewww.

----------------------------------------------------------------------

You can respond by visiting: 
http://pgfoundry.org/tracker/?func=detail&atid=442&aid=1000299&group_id=1000094


More information about the Python-general mailing list