Project

General

Profile

« Previous | Next » 

Revision 892

Replaced all type(...) == str with util.is_str(...) to properly treat Unicode objects as strings

View differences:

lib/xpath.py
3 3
import copy
4 4

  
5 5
from Parser import Parser
6
import util
6 7
import xml_dom
7 8

  
8 9
class XpathElem:
......
149 150
    into separate nodes'''
150 151
    if last_only == None: last_only = create
151 152
    if limit == None or limit > 1: last_only = False
152
    if type(xpath) == str: xpath = parse(xpath)
153
    if util.is_str(xpath): xpath = parse(xpath)
153 154
    
154 155
    if xpath == []: return [parent]
155 156
    if create and not is_positive(xpath): return []
......
234 235
    return next
235 236

  
236 237
def put_obj(root, xpath, id_, has_types, value=None):
237
    if type(xpath) == str: xpath = parse(xpath)
238
    if util.is_str(xpath): xpath = parse(xpath)
238 239
    
239 240
    xpath = copy.deepcopy(xpath) # don't modify input!
240 241
    set_id(xpath, id_, has_types)
bin/map
20 20
import xml_func
21 21

  
22 22
def metadata_value(name):
23
    if type(name) == str and name.startswith(':'): return name[1:]
23
    if util.is_str(name) and name.startswith(':'): return name[1:]
24 24
    else: return None
25 25

  
26 26
def main_():

Also available in: Unified diff