~psycopg/psycopg/2.0.x

« back to all changes in this revision

Viewing changes to lib/extras.py

  • Committer: Federico Di Gregorio
  • Date: 2008-09-23 07:11:11 UTC
  • Revision ID: fog@initd.org-20080923071111-pcs5dlrk7fdnjz5g
Support for NULLs in UUID

Show diffs side-by-side

added added

removed removed

Lines of Context:
306
306
        """Create the UUID type and an uuid.UUID adapter."""
307
307
        if not oid: oid = 2950
308
308
        _ext.UUID = _ext.new_type((oid, ), "UUID",
309
 
                                   lambda data, cursor: uuid.UUID(data))
 
309
                                   lambda data, cursor: data and uuid.UUID(data) or None)
310
310
        _ext.register_type(_ext.UUID)
311
311
        _ext.register_adapter(uuid.UUID, UUID_adapter)
312
312
        return _ext.UUID
321
321
        raise e
322
322
 
323
323
 
324
 
__all__ = [ k for k in locals().keys() if not k.startswith('_') ]
 
 
b'\\ No newline at end of file'
 
324
__all__ = [ k for k in locals().keys() if not k.startswith('_') ]