Mercurial > fife-parpg
diff engine/python/fife/extensions/serializers/__init__.py @ 569:466d76db9701
Some small code cleanups in the extensions.
The SimpleXMLSerializer now makes use of exceptions.
author | prock@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Mon, 28 Jun 2010 19:28:53 +0000 |
parents | 64738befdf3b |
children | e3140f01749d |
line wrap: on
line diff
--- a/engine/python/fife/extensions/serializers/__init__.py Mon Jun 28 18:43:03 2010 +0000 +++ b/engine/python/fife/extensions/serializers/__init__.py Mon Jun 28 19:28:53 2010 +0000 @@ -50,12 +50,12 @@ print 'Warning (%s): %s' % (self.filename, msg) def root_subfile(masterfile, subfile): - ''' + """ Returns new path for given subfile (path), which is rooted against masterfile E.g. if masterfile is ./../foo/bar.xml and subfile is ./../foo2/subfoo.xml, returned path is ../foo2/subfoo.xml NOTE: masterfile is expected to be *file*, not directory. subfile can be either - ''' + """ s = '/' masterfile = norm_path(os.path.abspath(masterfile)) @@ -82,13 +82,13 @@ return pathstr def reverse_root_subfile(masterfile, subfile): - ''' + """ does inverse operation to root_subfile. E.g. E.g. if masterfile is ./../foo/bar.xml and subfile is ../foo2/subfoo.xml, returned path ./../foo2/subfoo.xml Usually this function is used to convert saved paths into engine relative paths NOTE: masterfile is expected to be *file*, not directory. subfile can be either - ''' + """ s = '/' masterfile = norm_path(os.path.abspath(masterfile)).split(s)[:-1] @@ -97,10 +97,10 @@ return root_subfile(masterfile, subfile) def norm_path(path): - ''' + """ Makes the path use '/' delimited separators. FIFE always uses these delimiters, but some os-related routines will default to os.path.sep. - ''' + """ if os.path.sep == '/': return path