Example #1
0
 def _loadTemplates(self):
     templateDirs = getDirectoryListing(self.templateDir, templateDirectoryFilter)
     templates = []
     for template in map(self._loadTemplate, templateDirs):
         if template is not None:
             templates.append(template)
     return templates
Example #2
0
 def _loadTemplates(self):
     templateDirs = getDirectoryListing(self.templateDir,
                                        templateDirectoryFilter)
     templates = []
     for template in map(self._loadTemplate, templateDirs):
         if template is not None:
             templates.append(template)
     return templates
Example #3
0
def getAllFlagBitmaps():
    u"returns a list of (countryCode, bitmap) tuples" #$NON-NLS-1$
    rval = []
    flagPath = getResourceRegistry().getResourcePath(u"images/common/flags", True) #$NON-NLS-1$
    for filePath in getDirectoryListing(flagPath):
        baseFileName = os.path.basename(filePath)
        countryCode = os.path.splitext(baseFileName)[0]
        bitmap = getResourceRegistry().getBitmap(u"images/common/flags/%s" % baseFileName) #$NON-NLS-1$
        if countryCode and bitmap is not None and len(countryCode) == 2:
            rval.append( (countryCode, bitmap) )
    return rval
    def _loadTasks(self):
        tasks = []

        taskFiles = getDirectoryListing(self.tasksDirectory, TASK_FILE_FILTER)
        for taskFile in taskFiles:
            try:
                task = self._loadTask(taskFile)
                # Restart any resumable (but not cancelled) tasks.
                if task.isResumable() and not task.isCancelled() and not task.isComplete() and not task.hasError():
                    self._resumeTask(task)
                tasks.append(task)
            except Exception, e:
                self.logger.exception(e)
Example #5
0
    def _loadTasks(self):
        tasks = []

        taskFiles = getDirectoryListing(self.tasksDirectory, TASK_FILE_FILTER)
        for taskFile in taskFiles:
            try:
                task = self._loadTask(taskFile)
                # Restart any resumable (but not cancelled) tasks.
                if task.isResumable() and not task.isCancelled(
                ) and not task.isComplete() and not task.hasError():
                    self._resumeTask(task)
                tasks.append(task)
            except Exception, e:
                self.logger.exception(e)
Example #6
0
    def _loadTranslations(self, bundleDirectory):

        def filterFunc(fileName):
            fileName = os.path.basename(fileName)
            return fileName.startswith(u"zoundry.base_") #$NON-NLS-1$
        # end filterFunc()

        rval = ZSortedList(self)
        for bundleFileName in getDirectoryListing(bundleDirectory, filterFunc, False):
            localeString = self._extractLocale(bundleFileName)
            locale = ZLocale(localeString)
            translation = ZTranslation(locale, bundleDirectory)
            translation.load()
            rval.append(translation)
        return rval
    def _loadSnapshots(self):
        self.logger.debug(u"Loading recovery snapshots.") #$NON-NLS-1$
        snapshotFiles = getDirectoryListing(self.recoveryDir)
        snapshots = []

        for snapshotFile in snapshotFiles:
            documentDom = ZDom()
            documentDom.load(snapshotFile)
            namespace = documentDom.documentElement.getNamespaceUri()
            docDeserializer = ZDocumentDeserializerFactory().getDeserializer(namespace)
            context = ZBlogDocumentSerializationContext(self.recoveryDir)
            document = docDeserializer.deserialize(documentDom, context)
            snapshots.append(document)
            self.logger.debug(u"Recovery snapshot loaded.") #$NON-NLS-1$

        return snapshots
Example #8
0
    def _loadMediaStorages(self):
        storages = []

        storageFiles = getDirectoryListing(self.mediaStoresDirectory, STORE_FILE_FILTER)
        for storageFile in storageFiles:
            registryFile = storageFile + u".registry" #$NON-NLS-1$
            storage = self._loadMediaStorage(storageFile)
            mediaSiteId = storage.getMediaSiteId()
            site = self.getMediaSite(mediaSiteId)
            if site is None:
                raise ZBlogAppException(_extstr(u"mediastoragesrvc.NoMediaSiteFound") % mediaSiteId) #$NON-NLS-1$
            storageTypeId = site.getMediaStorageTypeId()
            storageType = self._getMediaStorageType(storageTypeId)
            storage.init(site, storageType, registryFile)
            storages.append(storage)

        return storages
Example #9
0
 def getInstalledLanguagePacks(self):
     sysProfile = self.applicationModel.getSystemProfile()
     bundleDir = sysProfile.getBundleDirectory()
     
     def _filterLangPacks(filePath):
         return re.match(BUNDLE_FILE_PATTERN, os.path.basename(filePath)) is not None
     # end _filterLangPacks()
     
     locales = [ u"en_US" ] #$NON-NLS-1$
     
     files = getDirectoryListing(bundleDir, _filterLangPacks)
     for file in files:
         file = os.path.basename(file)
         match = re.match(BUNDLE_FILE_PATTERN, file)
         localeStr = match.group(1)
         locales.append(localeStr)
     
     return locales
Example #10
0
 def _loadAccounts(self):
     userProfile = self.applicationModel.getUserProfile()
     accountsDirName = userProfile.getDirectory(u"accounts")  #$NON-NLS-1$
     accountDirs = getDirectoryListing(accountsDirName,
                                       accountDirectoryFilter)
     return map(loadAccount, accountDirs)
Example #11
0
 def _loadAccounts(self):
     userProfile = self.applicationModel.getUserProfile()
     accountsDirName = userProfile.getDirectory(u"accounts")  # $NON-NLS-1$
     accountDirs = getDirectoryListing(accountsDirName, accountDirectoryFilter)
     return map(loadAccount, accountDirs)
Example #12
0
 def getNumDocuments(self):
     return len(getDirectoryListing(self.dataStoreDirectory, documentXmlFilter))
Example #13
0
 def getDocumentIDs(self):
     docXmlFilePaths = getDirectoryListing(self.dataStoreDirectory, documentXmlFilter)
     return map(self._getDocumentIDFromPath, docXmlFilePaths)
Example #14
0
 def _getPluginDirectories(self):
     pluginsDir = self.systemProfile.getPluginDirectory()
     return getDirectoryListing(pluginsDir, PLUGIN_DIRECTORY_FILTER)
Example #15
0
 def _getPluginDirectories(self):
     pluginsDir = self.systemProfile.getPluginDirectory()
     return getDirectoryListing(pluginsDir, PLUGIN_DIRECTORY_FILTER)