예제 #1
0
파일: strings.py 프로젝트: neithere/tool
def slugify_i18n(value):
    """
    Transliterates given string with `Unidecode`_ and returns its "slugified"
    version. Usage::

        >>> slugify(u'Foo? Привет! 123')
        u'foo-privet-123'

    """
    dist.check_dependencies(__name__, 'slugify_i18n')
    if unidecode is None:  # pragma: nocover
        raise ImportError('Could not load library "unidecode".')
    return _slugify_simple(unidecode(value))
예제 #2
0
파일: documents.py 프로젝트: neithere/tool
.. _Doqu documentation: http://packages.python.org/doqu
.. _Shelve: http://packages.python.org/doqu/ext_shelve.html

API reference
-------------
"""
import logging
logger = logging.getLogger(__name__)

import werkzeug.exceptions

from tool import app
from tool import dist
import tool.plugins

dist.check_dependencies(__name__)

from doqu import get_db


__all__ = ['get_object_or_404', 'Documents', 'storages', 'default_storage']


FEATURE = 'document_storage'
DEFAULT_DB_NAME = 'default'
DEFAULTS = {
    'backend': 'doqu.ext.shelve_db',
    'path': 'doqu_shelve.db',
}

예제 #3
0
Commands
--------

This extension provides following commands within namespace "mobile":

* import-sms
* import-contacts
* import-plans

API reference
-------------
"""
from tool.dist import check_dependencies
from tool.plugins import features, requires  # , BasePlugin

check_dependencies(__name__)

from commands import import_contacts, import_sms, import_plans


@features("mobile")
@requires("{document_storage}")
def setup(app, conf):
    "Tool extension for importing data from mobile phones."
    assert isinstance(conf.get("my_numbers"), dict)
    commands = (import_contacts, import_sms, import_plans)
    app.cli_parser.add_commands(commands, namespace="mobile")
    return conf


"""