From e32bbfbca5233d4ad7a5bee74698d614ff0b1f24 Mon Sep 17 00:00:00 2001 From: Narayan Desai Date: Mon, 30 Jun 2008 15:59:01 +0000 Subject: Unicode support (from stousignant) (Resolves Ticket #549) git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@4731 ce84e21b-d406-0410-9b95-82705330c041 --- src/lib/Server/Plugin.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/lib/Server/Plugin.py') diff --git a/src/lib/Server/Plugin.py b/src/lib/Server/Plugin.py index 6b308d1f7..61e7021c6 100644 --- a/src/lib/Server/Plugin.py +++ b/src/lib/Server/Plugin.py @@ -444,7 +444,7 @@ class Specificity: return False class SpecificData(object): - def __init__(self, name, _, specific): + def __init__(self, name, _, specific, encoding): self.name = name self.specific = specific @@ -459,13 +459,14 @@ class SpecificData(object): class EntrySet: '''Entry sets deal with the host- and group-specific entries''' ignore = re.compile("^(.*~|\\..*\\.(tmp|sw[px]))$") - def __init__(self, basename, path, props, entry_type): + def __init__(self, basename, path, props, entry_type, encoding): self.path = path self.entry_type = entry_type self.entries = {} self.properties = props self.metadata = default_file_metadata.copy() self.infoxml = None + self.encoding = encoding pattern = '(.*/)?%s(\.((H_(?P\S+))|' % basename pattern += '(G(?P\d+)_(?P\S+))))?$' self.specific = re.compile(pattern) @@ -509,7 +510,7 @@ class EntrySet: return self.entries[event.filename] = self.entry_type(fpath, self.properties, - spec) + spec, self.encoding) self.entries[event.filename].handle_event(event) def specificity_from_filename(self, fname): @@ -631,6 +632,7 @@ class GroupSpool(GeneratorPlugin): self.entries = {} self.handles = {} self.AddDirectoryMonitor('') + self.encoding = core.encoding if self.use_props: try: self.properties = TemplateProperties( \ @@ -661,7 +663,8 @@ class GroupSpool(GeneratorPlugin): self.entries[ident] = self.es_cls(self.filename_pattern, dirpath, self.properties, - self.es_child_cls) + self.es_child_cls, + self.encoding) self.Entries['ConfigFile'][ident] = self.entries[ident].bind_entry if not posixpath.isdir(epath): # do not pass through directory events -- cgit v1.2.3-1-g7c22