import treecutter.constants as const
from treecutter.docbook import Docbook
import re
+from itertools import chain
class Directory():
"""Class containing the state of the directory with articles"""
def __init__(self):
self._cwd = u'.'
+ self._translations = []
self._tree = []
self._basepath = re.compile('[/\w\._-]*/[\w-]+',re.UNICODE)
- def scan(self):
+ def translations(self, directory):
+ paths = (self._cwd, directory)
+ for dirname, dirnames, filenames in chain.from_iterable(os.walk(path) for path in paths):
+ for filename in filenames:
+ if fnmatch.fnmatch(filename, '*.xlf'):
+ file_ = os.path.join(dirname,filename)
+ self._translations.append(file_)
+ return self._translations
+
+
+ def scan(self, draftflag, levelflag):
for dirname, dirnames, filenames in os.walk(self._cwd):
for filename in filenames:
if fnmatch.fnmatch(filename, '*.xml'):