Package svnmailer :: Module util :: Class _LocaleFile

[hide private]

# Class _LocaleFile

source code

    object --+
             |
            _LocaleFile

Transform filenames according to locale

Instance Methods | [hide private]

__init__(self, _locale=<module 'locale' from '/usr/lib64/python2.7/locale.pyc'>, _os=<module 'os' from '/usr/lib64/python2.7/os.pyc'>, _sys=<module 'sys' (built-in)>) Initialization | source code

`str`/`unicode`

toLocale(self, name, name_enc=None, locale_enc=None) Transforms a file name to the locale representation | source code

`unicode`/`str`

fromLocale(self, name, locale_enc=None) Transform a file name from locale repr to unicode (hopefully) | source code

Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__sizeof__`, `__str__`, `__subclasshook__`

Properties | [hide private]

Inherited from `object`: `__class__`

Method Details | [hide private]

### __init__(self, _locale=<module 'locale' from '/usr/lib64/python2.7/locale.pyc'>, _os=<module 'os' from '/usr/lib64/python2.7/os.pyc'>, _sys=<module 'sys' (built-in)>)
(Constructor)

source code

Initialization

Overrides: object.__init__

### toLocale(self, name, name_enc=None, locale_enc=None)

source code

Transforms a file name to the locale representation

Parameters:
  - `name` (`str` / `unicode`) - The name to consider
  - `name_enc` (`str`) - The source encoding of `name`, if it's not unicode already
  - `locale_enc` (`str`) - The file system encoding (used only if it's not a unicode supporting OS)
Returns: `str`/`unicode`
  The name in locale representation
Raises:
  - `UnicodeError` - An error happened while recoding

### fromLocale(self, name, locale_enc=None)

source code

Transform a file name from locale repr to unicode (hopefully)

Parameters:
  - `name` (`str`/`unicode`) - The name to decode
  - `locale_enc` (`str`) - The locale encoding
Returns: `unicode`/`str`
  The decoded name
Raises:
  - `UnicodeError` - An error happend while recoding