|
def | b64decodepad (s) |
| Helper function to ensure that a b64 string is correctly padded to four spaces. More...
|
|
def | BestTranslation (translations, languages, defaultlang='en') |
| Returns the best translation found in a dict of different translations. More...
|
|
def | Bound (val, min, max) |
| Returns a value that is no smaller than min or larger than max. More...
|
|
def | CodeDir (code) |
| Separates a filename into three character segments with the directory separator '/' in between. More...
|
|
def | EscapeSQL (s) |
| Escapes special characters to be used in a SQL query string. More...
|
|
def | FromShortCode (code, chars='0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_') |
| Turns a six character alphanumeric code into a 32-bit value. More...
|
|
def | GetModel (model) |
| Returns the model object from the correct module. More...
|
|
def | KeyFromValue (ls, value) |
| Does a reverse lookup to find the key of a value in a dict. More...
|
|
def | LoadTranslation (g, app, translation, languages) |
| Load the translation into the global language dict in g.T. More...
|
|
def | MakeRBID () |
| Returns a random 64-bit int ID. More...
|
|
def | MakeRID () |
| Returns a random 32-bit int ID. More...
|
|
def | ToShortCode (val, chars='0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_') |
| Turns a 32-bit value into a six character alphanumeric code. More...
|
|
def pafera.utils.BestTranslation |
( |
|
translations, |
|
|
|
languages, |
|
|
|
defaultlang = 'en' |
|
) |
| |
Returns the best translation found in a dict of different translations.
languages should be a list of of ISO 639-1 language codes.
defaultlang is set to 'en', so be sure to set it to your native language if used on other systems.
Definition at line 104 of file utils.py.