#!/usr/bin/python
+import re
import glob
from treecutter.page import Page
self._link = link
# find the representations of the link.
self._pages = []
+ self._langregexp = re.compile('.*\.(\w\w)\.xml')
path = link
if self._link[-1] == '/':
path = path+'index'
def _scan_languages(self,path):
lang = []
- for l in glob.glob('.'+path+'*'):
- ls = l.split('.')
- if len(ls) > 3 and ls[3] == 'xml':
- lang.append((ls[2],l))
+ for l in glob.glob('.'+path+'*.xml'):
+ langcode = self._langregexp.search(l).group(1)
+ lang.append((langcode,l))
return lang
def link(self):