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. | - Allow seconds in vUTCOffset properties. Fixes #55. | ||||||
|   [thet] |   [thet] | ||||||
| 
 | 
 | ||||||
| - Let ``Component.decode`` correctly decode vRecur properties. Fixes #70. | - Let ``Component.decode`` better handle vRecur and vDDDLists properties. | ||||||
|  |   Fixes #70. | ||||||
|   [thet] |   [thet] | ||||||
| 
 | 
 | ||||||
| - Don't let ``Component.add`` re-encode already encoded values. This simplifies | - Don't let ``Component.add`` re-encode already encoded values. This simplifies | ||||||
|  |  | ||||||
|  | @ -18,7 +18,7 @@ from .parser import ( | ||||||
|     q_join, |     q_join, | ||||||
| ) | ) | ||||||
| from .prop import TypesFactory | from .prop import TypesFactory | ||||||
| from .prop import vText | from .prop import vText, vDDDLists | ||||||
| from .parser_tools import DEFAULT_ENCODING | from .parser_tools import DEFAULT_ENCODING | ||||||
| 
 | 
 | ||||||
| ###################################### | ###################################### | ||||||
|  | @ -153,6 +153,9 @@ class Component(CaselessDict): | ||||||
|         # from_ical. We probably want to decode properties into Python native |         # from_ical. We probably want to decode properties into Python native | ||||||
|         # types here. But when parsing from an ical string with from_ical, we |         # types here. But when parsing from an ical string with from_ical, we | ||||||
|         # want to encode the string into a real icalendar.prop property. |         # 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) |         decoded = types_factory.from_ical(name, value) | ||||||
|         # TODO: remove when proper decoded is implemented in every prop.* class |         # TODO: remove when proper decoded is implemented in every prop.* class | ||||||
|         # Workaround to decode vText properly |         # Workaround to decode vText properly | ||||||
|  |  | ||||||
|  | @ -46,6 +46,9 @@ class TestCalComponent(unittest.TestCase): | ||||||
|         # With default values for non existing properties |         # With default values for non existing properties | ||||||
|         self.assertEqual(c.decoded('version', 'No Version'), 'No Version') |         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. |         # The component can render itself in the RFC 2445 format. | ||||||
|         c = Component() |         c = Component() | ||||||
|         c.name = 'VCALENDAR' |         c.name = 'VCALENDAR' | ||||||
|  |  | ||||||
		Ładowanie…
	
		Reference in New Issue
	
	 Johannes Raggam
						Johannes Raggam