Changeset 4360 for waeup/branches
- Timestamp:
- 25 Jun 2009, 13:23:30 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
waeup/branches/ulif-rewrite/src/waeup/csvfile/README.txt
r4339 r4360 134 134 >>> toBool('TRUE') 135 135 True 136 137 >>> toBool('no') 138 False 136 139 137 140 If we pass in a boolean then this will be returned unchanged: … … 335 338 ... """) 336 339 340 We create a wrapper that requires 'col1' and 'col2' but does not check 341 in constructor, whether this requirement is met: 342 343 >>> from waeup.csvfile.interfaces import ICSVFile 344 >>> from waeup.csvfile import CSVFile 345 >>> class ICSVFile13(ICSVFile): 346 ... """A CSV file that contains a 'special_col' column. 347 ... """ 348 349 >>> class CSVFile13(CSVFile): 350 ... required_fields = ['col1', 'col2'] 351 ... grok.context(basestring) 352 ... grok.implements(ICSVFile13) 353 ... grok.provides(ICSVFile13) 354 ... def __init__(self, context): 355 ... self.path = context 356 357 >>> grok.testing.grok_component('CSVFile13', CSVFile13) 358 True 359 360 .. warn:: This is bad design as :class:`ICSVFile` instances should 361 always raise an exception in their constructor if a file 362 does not meet the basic requirements. 363 364 The base constructor will check for the correct values. So, 365 if you do not overwrite the base constructor, instances will 366 check on creation time, whether they can handle the desired 367 file. 368 369 337 370 We create a wrapper that requires 'col1' and 'col2': 338 371 … … 352 385 True 353 386 387 Now the rules applied to all wrappers are: 354 388 355 389 * If no instance of a certain wrapper can be created from the given
Note: See TracChangeset for help on using the changeset viewer.