Package pyxmpp :: Module utils

[hide private]

# Module utils

source code

Utility functions for the pyxmpp package.

Functions | [hide private]

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 | source code

from_utf8(s) Convert `s` to Unicode or leave unchanged if it is None. | source code

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. | source code

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. | source code

Variables | [hide private]

| __revision__ = ``'``$Id: utils.py 647 2006-08-26 18:27:39Z jajcus $``'``
| minute = `datetime.timedelta(0, 60)`
| nulldelta = `datetime.timedelta(0)`
| __package__ = ``'``pyxmpp``'``

Imports: sys, time, datetime

Function Details | [hide private]

### from_utf8(s)

source code

Convert `s` to Unicode or leave unchanged if it is None.

Regular strings are assumed to be UTF-8 encoded

### datetime_utc_to_local(utc)

source code

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.