* Allow vGeo to be instantiated with list and not only tuples of geo

coordinates. Fixes #83.
pull/86/head
Johannes Raggam 2013-01-30 00:07:11 +01:00
rodzic 2bac28729f
commit 87feaeaba1
2 zmienionych plików z 11 dodań i 1 usunięć

Wyświetl plik

@ -4,6 +4,10 @@ Changelog
3.3dev (unreleased) 3.3dev (unreleased)
------------------- -------------------
* Allow vGeo to be instantiated with list and not only tuples of geo
coordinates. Fixes #83.
[thet]
* Don't force to pass a list to vDDDLists and allow setting individual RDATE * Don't force to pass a list to vDDDLists and allow setting individual RDATE
and EXDATE values without having to wrap them in a list. and EXDATE values without having to wrap them in a list.
[thet] [thet]

Wyświetl plik

@ -1215,6 +1215,12 @@ class vUri(str):
class vGeo: class vGeo:
"""A special type that is only indirectly defined in the rfc. """A special type that is only indirectly defined in the rfc.
Pass a list
>>> g = vGeo([1.2, 3.0])
>>> g.to_ical()
'1.2;3.0'
Pass a tuple
>>> g = vGeo((1.2, 3.0)) >>> g = vGeo((1.2, 3.0))
>>> g.to_ical() >>> g.to_ical()
'1.2;3.0' '1.2;3.0'
@ -1234,7 +1240,7 @@ class vGeo:
def __init__(self, geo): def __init__(self, geo):
try: try:
latitude, longitude = geo latitude, longitude = (geo[0], geo[1])
latitude = float(latitude) latitude = float(latitude)
longitude = float(longitude) longitude = float(longitude)
except: except: