* 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)
-------------------
* 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
and EXDATE values without having to wrap them in a list.
[thet]

Wyświetl plik

@ -1215,6 +1215,12 @@ class vUri(str):
class vGeo:
"""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.to_ical()
'1.2;3.0'
@ -1234,7 +1240,7 @@ class vGeo:
def __init__(self, geo):
try:
latitude, longitude = geo
latitude, longitude = (geo[0], geo[1])
latitude = float(latitude)
longitude = float(longitude)
except: