Ignore:
Timestamp:
02/12/13 12:39:13 (14 months ago)
Author:
Ales Erjavec <ales.erjavec@…>
Branch:
default
Message:

Prevent a overwrite of the old version 1.0 ows scheme format.

Old schemes should not be allowed to be overwritten in a way that would
prevent the old interface from reading them.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Orange/OrangeCanvas/scheme/readwrite.py

    r11303 r11305  
    2828class UnknownWidgetDefinition(Exception): 
    2929    pass 
     30 
     31 
     32def sniff_version(stream): 
     33    """ 
     34    Parse a scheme stream and return the scheme's version string. 
     35    """ 
     36    doc = parse(stream) 
     37    scheme_el = doc.getroot() 
     38    version = scheme_el.attrib.get("version", None) 
     39    # Fallback: check for "widgets" tag. 
     40    if scheme_el.find("widgets") is not None: 
     41        version = "1.0" 
     42    else: 
     43        version = "2.0" 
     44 
     45    return version 
    3046 
    3147 
Note: See TracChangeset for help on using the changeset viewer.