pyxmpp.utils

Package pyxmpp :: Module utils |
[show private | hide private]
[frames | no frames]

## Module pyxmpp.utils

Utility functions for the pyxmpp package.

Function Summary
| ``datetime_local_to_utc`(local)` Simple function to convert naive `datetime.datetime` object containing local time to a naive `datetime.datetime` object with UTC time.
| ``datetime_utc_to_local`(utc)` An ugly hack to convert naive `datetime.datetime` object containing UTC time to a naive `datetime.datetime` object with local time.
| ``from_utf8`(s)` Convert `s` to Unicode or leave unchanged if it is None.
| ``to_utf8`(s)` Convevert `s` to UTF-8 if it is Unicode, leave unchanged if it is string or None and convert to string overwise

Variable Summary
`str` | `__revision__` = `'$Id: utils.py 612 2005-12-26 11:11:32Z j...`
`timedelta` | `minute` = `datetime.timedelta(0, 60)`
`timedelta` | `nulldelta` = `datetime.timedelta(0)`

Imported modules:
  `datetime`, `sys`, `time`

Function Details

### datetime_local_to_utc(local) Simple function to convert naive `datetime.datetime` object containing local time to a naive `datetime.datetime` object with UTC time.

### datetime_utc_to_local(utc) An ugly hack to convert naive `datetime.datetime` object containing UTC time to a naive `datetime.datetime` object with local time. It seems standard Python 2.3 library doesn't provide any better way to do that.

### from_utf8(s) Convert `s` to Unicode or leave unchanged if it is None. Regular strings are assumed to be UTF-8 encoded

### to_utf8(s) Convevert `s` to UTF-8 if it is Unicode, leave unchanged if it is string or None and convert to string overwise

Variable Details

    ### __revision__ Type: `str` Value:
        '$Id: utils.py 612 2005-12-26 11:11:32Z jajcus $'

    ### minute Type: `timedelta` Value:
        datetime.timedelta(0, 60)

    ### nulldelta Type: `timedelta` Value:
        datetime.timedelta(0)