hawat.intl module

This module contains very thin database abstraction layer and access functions for Hawat. It is a wrapper around SQLAlchemy library.

hawat.intl.babel_format_bytes(size, unit='B', step_size=1024)[source]

Format given numeric value to human readable string describing size in B/KB/MB/GB/TB.

Parameters
  • size (int) – Number to be formatted.

  • unit (enum) – Starting unit, possible values are [‘B’, ‘KB’, ‘MB’, ‘GB’, ‘TB’, ‘PB’, ‘EB’].

  • step_size (int) – Size of the step between units.

Returns

Formatted and localized string.

Return type

string

hawat.intl.babel_language_in_locale(locale_id='en')[source]

Translate given locale language. By default return language in locale`s language. Optionaly return language in given locale`s language.

hawat.intl.babel_translate_locale(locale_id, with_current=False)[source]

Translate given locale language. By default return language in locale`s language. Optionaly return language in given locale`s language.

hawat.intl.get_locale()[source]

Implementation of locale selector for flask_babel.

hawat.intl.get_timezone()[source]

Implementation of timezone selector for flask_babel.

hawat.intl.validate_lang(ctx, param, value)[source]

Validate login/email command line parameter.