Пример #1
0
    def translation(self, _context, language, file=None, image=None):

        if file is not None and image is not None:
            raise ConfigurationError(
                "Can't use more than one of file, and image "
                "attributes for resource directives")
        elif file is None and image is None:
            raise ConfigurationError(
                "At least one of the file, and image "
                "attributes for resource directives must be specified")

        if image is not None:
            import warnings
            warnings.warn_explicit(
                'The "image" attribute of i18n-resource directive is '
                'deprecated in favor of simple files. Use the "file" '
                'attribute instead.', DeprecationWarning, _context.info.file,
                _context.info.line)
            file = image

        self.__data[language] = File(_context.path(file), self.name)
Пример #2
0
 def _createDict(self, filename1='test.pt', filename2='test2.pt'):
     path1 = os.path.join(test_directory, 'testfiles', filename1)
     path2 = os.path.join(test_directory, 'testfiles', filename2)
     return {'en': File(path1, filename1), 'fr': File(path2, filename2)}