本文整理匯總了Python中evoque.domain.Domain.set_namespace_on_globals方法的典型用法代碼示例。如果您正苦於以下問題:Python Domain.set_namespace_on_globals方法的具體用法?Python Domain.set_namespace_on_globals怎麽用?Python Domain.set_namespace_on_globals使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類evoque.domain.Domain
的用法示例。
在下文中一共展示了Domain.set_namespace_on_globals方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: abspath
# 需要導入模塊: from evoque.domain import Domain [as 別名]
# 或者: from evoque.domain.Domain import set_namespace_on_globals [as 別名]
from my_site import formatting_utils
# default template collection root directory
DEFAULT_DIR = abspath(join(dirname(__file__), 'templates'))
# create template domain instance
# here restating all defaults, for doc convenience
domain = Domain(DEFAULT_DIR,
restricted=False, errors=3, log=logging.getLogger("evoque"),
cache_size=0, auto_reload=60, slurpy_directives=True,
quoting="xml", input_encoding="utf-8", filters=[] )
# adjust global namespace as needed by application
domain.set_on_globals("ObjectPaginator", ObjectPaginator)
domain.set_on_globals("site_name", "mysite.net")
domain.set_namespace_on_globals("formatting_utils", formatting_utils)
# set up any other collection, as needed by application
# here restating all defaults -- when None, domain's value is used
domain.set_collection("custom", "/home/me/custom_collection/",
cache_size=None, auto_reload=None, slurpy_directives=None,
quoting=None, input_encoding=None, filters=None)
# here we would do any other domain setup we might need
# e.g. set a template default for a given collection
# for details see: http://evoque.gizmojo.org/usage/
# or the source of the evoque.domain module.
def evoque_django_response(request, name,