kopia lustrzana https://github.com/collective/icalendar
handle decoding of vDDDLists
rodzic
94e2aa7535
commit
186a1d9979
|
@ -15,7 +15,8 @@ Changelog
|
|||
- Allow seconds in vUTCOffset properties. Fixes #55.
|
||||
[thet]
|
||||
|
||||
- Let ``Component.decode`` correctly decode vRecur properties. Fixes #70.
|
||||
- Let ``Component.decode`` better handle vRecur and vDDDLists properties.
|
||||
Fixes #70.
|
||||
[thet]
|
||||
|
||||
- Don't let ``Component.add`` re-encode already encoded values. This simplifies
|
||||
|
|
|
@ -18,7 +18,7 @@ from .parser import (
|
|||
q_join,
|
||||
)
|
||||
from .prop import TypesFactory
|
||||
from .prop import vText
|
||||
from .prop import vText, vDDDLists
|
||||
from .parser_tools import DEFAULT_ENCODING
|
||||
|
||||
######################################
|
||||
|
@ -153,6 +153,9 @@ class Component(CaselessDict):
|
|||
# from_ical. We probably want to decode properties into Python native
|
||||
# types here. But when parsing from an ical string with from_ical, we
|
||||
# want to encode the string into a real icalendar.prop property.
|
||||
if type(value) in [vDDDLists,]:
|
||||
# TODO: Workaround unfinished decoding
|
||||
return value
|
||||
decoded = types_factory.from_ical(name, value)
|
||||
# TODO: remove when proper decoded is implemented in every prop.* class
|
||||
# Workaround to decode vText properly
|
||||
|
|
|
@ -46,6 +46,9 @@ class TestCalComponent(unittest.TestCase):
|
|||
# With default values for non existing properties
|
||||
self.assertEqual(c.decoded('version', 'No Version'), 'No Version')
|
||||
|
||||
c.add('rdate', [datetime(2013,3,28), datetime(2013,3,27)])
|
||||
self.assertEqual(type(c.decoded('rdate')), prop.vDDDLists)
|
||||
|
||||
# The component can render itself in the RFC 2445 format.
|
||||
c = Component()
|
||||
c.name = 'VCALENDAR'
|
||||
|
|
Ładowanie…
Reference in New Issue