[Twisted-Python] Components

Christopher Armstrong radix at twistedmatrix.com
Thu Feb 26 19:50:25 EST 2004


Bob Ippolito wrote:
> def _hook_datetime(datetime):
>     declareAdapter(
>         NO_ADAPTER_NEEDED,
>         provides=[IBasicDate],
>         forTypes=[datetime.date],
>     )
>     declareAdapter(
>         NO_ADAPTER_NEEDED,
>         provides=[IBasicDateTime],
>         forTypes=[datetime.datetime],
>     )
> imports.whenImported('datetime', _hook_datetime)
> 
> This could of course be automated a bit more, and there is probably even 
> a better way.. but this was the first thing I stumbled across without 
> thoroughly reading documentation or asking anyone :)

Hmm, yeah, we want something more along the lines of:

   registerAdapter(convertToDateTime,
                   forStringTypes=['mxDateTime.DateTimeType'],
                   provides=[IBasicDateTime])

But your example does show off the crazy crap you can do, which makes me 
believe that something like this would be quite easy to implement.

> On Feb 26, 2004, at 6:51 PM, Christopher Armstrong wrote:
>> Hmm, yeah, I assumed we would include our own (hopefully unhacked) 
>> copy of PyProtocols in releases.
> 
> 
> I would suggest including it beside, not inside, Twisted.  The setup.py 
> could check to see if a newer version is already installed, too.

I didn't mean "inside the 'twisted' Python package", I meant "in the 
Twisted package" ;-). So, yeah, beside Twisted, I guess.

> - .. hoping Twisted starts assimilating PEAK stuff, because it's better :)

:-D



-- 
  Twisted | Christopher Armstrong: International Man of Twistery
   Radix  |          Release Manager,  Twisted Project
---------+           http://radix.twistedmatrix.com/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 256 bytes
Desc: OpenPGP digital signature
Url : http://twistedmatrix.com/pipermail/twisted-python/attachments/20040226/87a6b2df/attachment.pgp 


More information about the Twisted-Python mailing list