Changes between Version 45 and Version 46 of PyYAMLDocumentation


Ignore:
Timestamp:
11/22/09 16:58:56 (4 years ago)
Author:
Jotaf
Comment:

Added (important IMO) note about explicitly allowing objects to load with safe_load().

Legend:

Unmodified
Added
Removed
Modified
  • PyYAMLDocumentation

    v45 v46  
    244244The function '''`yaml.safe_load`''' limits this ability to simple Python objects 
    245245like integers or lists. 
     246 
     247A python object can be marked as safe and thus be recognized by '''`yaml.safe_load`'''. 
     248To do this, derive it from `yaml.YAMLObject` (as explained in section 
     249'''Constructors, representers, resolvers''') and explicitly set its class property 
     250`yaml_loader` to `yaml.SafeLoader`. 
    246251 
    247252 
     
    10261031`safe_load` recognizes only standard YAML tags and cannot construct an arbitrary Python object. 
    10271032 
     1033A python object can be marked as safe and thus be recognized by '''`yaml.safe_load`'''. 
     1034To do this, derive it from `yaml.YAMLObject` (as explained in section 
     1035'''Constructors, representers, resolvers''') and explicitly set its class property 
     1036`yaml_loader` to `yaml.SafeLoader`. 
     1037 
    10281038'''`safe_load_all(stream)`''' parses the given `stream` and returns a sequence of Python objects 
    10291039corresponding to the documents in the stream. `safe_load_all` recognizes only standard YAML tags