Mercurial > fife-parpg
comparison engine/extensions/serializers/__init__.py @ 375:91e352f81f63
The serializers will now use the LogManager instead of printing directly to console
author | cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Sat, 21 Nov 2009 15:15:55 +0000 |
parents | dfd48d49c044 |
children |
comparison
equal
deleted
inserted
replaced
374:1115f7cae9a3 | 375:91e352f81f63 |
---|---|
22 # #################################################################### | 22 # #################################################################### |
23 | 23 |
24 import fife, sys, os | 24 import fife, sys, os |
25 from traceback import print_exc | 25 from traceback import print_exc |
26 | 26 |
27 __all__ = ('ET', 'SerializerError', 'InvalidFormat', 'WrongFileType', 'NameClash', 'NotFound', 'warn', 'root_subfile', 'reverse_root_subfile') | 27 __all__ = ('ET', 'SerializerError', 'InvalidFormat', 'WrongFileType', 'NameClash', 'NotFound', 'root_subfile', 'reverse_root_subfile', 'logger') |
28 | 28 |
29 try: | 29 try: |
30 import xml.etree.cElementTree as ET | 30 import xml.etree.cElementTree as ET |
31 except: | 31 except: |
32 import xml.etree.ElementTree as ET | 32 import xml.etree.ElementTree as ET |
43 class NameClash(SerializerError): | 43 class NameClash(SerializerError): |
44 pass | 44 pass |
45 | 45 |
46 class NotFound(SerializerError): | 46 class NotFound(SerializerError): |
47 pass | 47 pass |
48 | 48 |
49 def warn(self, msg): | 49 logger = fife.Logger(fife.LM_LOADERS) |
50 print 'Warning (%s): %s' % (self.filename, msg) | |
51 | 50 |
52 def root_subfile(masterfile, subfile): | 51 def root_subfile(masterfile, subfile): |
53 ''' | 52 ''' |
54 Returns new path for given subfile (path), which is rooted against masterfile | 53 Returns new path for given subfile (path), which is rooted against masterfile |
55 E.g. if masterfile is ./../foo/bar.xml and subfile is ./../foo2/subfoo.xml, | 54 E.g. if masterfile is ./../foo/bar.xml and subfile is ./../foo2/subfoo.xml, |