document: fix matching of names with non-latin chars

At a previous fix, the "res_name == name" condition was added, that didn't,
however, consider the case where res_name was unicode and name in utf8.

Conflicts:

	document/nodes.py

bzr revid: p_christ@hol.gr-20110118164950-avtkxy8dc4u03fu4
This commit is contained in:
P. Christeas
2011-01-18 18:49:50 +02:00
parent 091692fefb
commit 29721236fc
+4 -3
View File
@@ -23,6 +23,7 @@
import pooler
from tools.safe_eval import safe_eval
from tools.misc import ustr
import errno
# import os
import time
@@ -808,7 +809,7 @@ class node_res_dir(node_class):
return res[0]
return None
def _child_get(self, cr, name = None, domain=None):
def _child_get(self, cr, name=None, domain=None):
""" return virtual children of resource, based on the
foreign object.
@@ -868,7 +869,7 @@ class node_res_dir(node_class):
# Escape the name for characters not supported in filenames
res_name = res_name.replace('/','_') # any other weird char?
if name and (res_name != name):
if name and (res_name != ustr(name)):
# we have matched _ to any character, but we only meant to match
# the special ones.
# Eg. 'a_c' will find 'abc', 'a/c', 'a_c', may only
@@ -1044,7 +1045,7 @@ class node_res_obj(node_class):
if not res_name:
continue
res_name = res_name.replace('/', '_')
if name and (res_name != name):
if name and (res_name != ustr(name)):
continue
# TODO Revise
klass = directory.get_node_class(directory, dynamic=True, context=ctx)