本文整理汇总了Python中zope.app.i18n._函数的典型用法代码示例。如果您正苦于以下问题:Python _函数的具体用法?Python _怎么用?Python _使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: getViewTypeTitles
def getViewTypeTitles(self):
return {
"browser": _("Browser"),
"xmlrpc": _("XML-RPC"),
"http": _("HTTP"),
"ftp": _("FTP"),
"other": _("Other"),
}
开发者ID:wpjunior,项目名称:proled,代码行数:8,代码来源:browser.py
示例2: pack
def pack(self):
"""Do the packing!"""
days = int(self.request.form.get('days', 0))
status = ''
if 'PACK' in self.request:
try:
self.request.publication.db.pack(days=days)
status = _('ZODB successfully packed.')
except FileStorageError, err:
status = _(err)
开发者ID:wpjunior,项目名称:proled,代码行数:10,代码来源:zodbcontrol.py
示例3: invalidate
def invalidate(self):
"Invalidate the current cached value."
cache = getCacheForObject(self.context)
location = getLocationForCache(self.context)
if cache and location:
cache.invalidate(location)
return self.form(message=_("cache-invalidated", u"Invalidated."))
else:
return self.form(message=_("no-cache-associated",
u"No cache associated with object."))
开发者ID:wpjunior,项目名称:proled,代码行数:11,代码来源:cacheable.py
示例4: action
def action(self):
"""Do the shutdown/restart!"""
control = self.serverControl()
time = self.request.get('time', 0)
if 'restart' in self.request:
control.restart(time)
return _("The server will be restarted in ${number} seconds.",
mapping={"number": time})
elif 'shutdown' in self.request:
control.shutdown(time)
return _("The server will be shutdown in ${number} seconds.",
mapping={"number": time})
开发者ID:wpjunior,项目名称:proled,代码行数:13,代码来源:servercontrol.py
示例5: __call__
def __call__(self):
if IUnauthenticatedPrincipal.providedBy(self.request.principal):
return u'<a href="@@login.html?nextURL=%s">%s</a>' % (
urllib.quote(self.request.getURL()),
translate(_("[Login]"), context=self.request, default="[Login]"),
)
elif ILogoutSupported(self.request, None) is not None:
return u'<a href="@@logout.html?nextURL=%s">%s</a>' % (
urllib.quote(self.request.getURL()),
translate(_("[Logout]"), context=self.request, default="[Logout]"),
)
else:
return None
开发者ID:wpjunior,项目名称:proled,代码行数:13,代码来源:auth.py
示例6: handle_edit_action
def handle_edit_action(self, action, data):
if form.applyChanges(
self.context, self.form_fields, data, self.adapters):
zope.event.notify(
zope.app.event.objectevent.ObjectModifiedEvent(self.context)
)
# TODO: Needs locale support. See also Five.form.EditView.
self.status = _(
"Updated on ${date_time}",
mapping={'date_time': str(datetime.utcnow())}
)
else:
self.status = _('No changes')
开发者ID:goschtl,项目名称:zope,代码行数:14,代码来源:formbase.py
示例7: sizeForDisplay
def sizeForDisplay(self):
"""See `ISized`"""
bytes = self._container.getSize()
byte_size = byteDisplay(bytes)
num_items = len(self._container)
mapping = byte_size.mapping
if mapping is None:
mapping = {}
mapping.update({'items': str(num_items)})
if num_items == 1:
return _("${items} item / " + byte_size , mapping=mapping)
else:
return _("${items} items / " + byte_size , mapping=mapping)
开发者ID:return1,项目名称:masterthesis,代码行数:16,代码来源:entry.py
示例8: getZopeVersion
def getZopeVersion(self):
"""See zope.app.applicationcontrol.interfaces.IRuntimeInfo"""
try:
version_utility = getUtility(IZopeVersion)
except ComponentLookupError:
return _("Unavailable")
return version_utility.getZopeVersion()
开发者ID:wpjunior,项目名称:proled,代码行数:7,代码来源:runtimeinfo.py
示例9: handle_edit_action
def handle_edit_action(self, action, data):
changed = applyChanges(
self.context, self.form_fields, data, self.adapters)
if changed:
attrs = lifecycleevent.Attributes(interfaces.IVideo, *changed)
event.notify(
lifecycleevent.ObjectModifiedEvent(self.context, attrs)
)
# TODO: Needs locale support. See also Five.form.EditView.
self.status = _("Successfully updated")
else:
self.status = _('No changes')
statusmessages_ifaces.IStatusMessage(
self.request).addStatusMessage(self.status, 'info')
redirect = self.request.response.redirect
return redirect(self.context.absolute_url()+'/view')
开发者ID:collective,项目名称:p4a.video,代码行数:16,代码来源:video.py
示例10: checkObject
def checkObject(container, name, object):
"""Check containement constraints for an object and container
"""
# check __setitem__ precondition
containerProvided = providedBy(container)
__setitem__ = containerProvided.get("__setitem__")
if __setitem__ is not None:
precondition = __setitem__.queryTaggedValue("precondition")
if precondition is not None:
precondition(container, name, object)
# check the constraint on __parent__
__parent__ = providedBy(object).get("__parent__")
if __parent__ is not None:
try:
validate = __parent__.validate
except AttributeError:
pass
else:
validate(container)
if not containerProvided.extends(IContainer):
# If it doesn't implement IContainer, it can't contain stuff.
raise TypeError(_("Container is not a valid Zope container."))
开发者ID:wpjunior,项目名称:proled,代码行数:25,代码来源:constraints.py
示例11: getUtilityInfoDictionary
def getUtilityInfoDictionary(reg):
"""Return a PT-friendly info dictionary for a factory."""
component = reg.component
# Check whether we have an instance of some custom type or not
# Unfortunately, a lot of utilities have a `__name__` attribute, so we
# cannot simply check for its absence
# TODO: Once we support passive display of instances, this insanity can go
# away.
if not isinstance(component, (types.MethodType, types.FunctionType,
types.ClassType, types.TypeType,
InterfaceClass)):
component = getattr(component, '__class__', component)
path = getPythonPath(component)
# provided interface id
iface_id = '%s.%s' % (reg.provided.__module__, reg.provided.getName())
# Determine the URL
if isinstance(component, InterfaceClass):
url = 'Interface/%s' %path
else:
url = None
if isReferencable(path):
url = 'Code/%s' % path.replace('.', '/')
return {'name': reg.name or _('<i>no name</i>'),
'url_name': utilitymodule.encodeName(reg.name or '__noname__'),
'iface_id': iface_id,
'path': path,
'url': url}
开发者ID:wpjunior,项目名称:proled,代码行数:31,代码来源:component.py
示例12: getAdapterInfoDictionary
def getAdapterInfoDictionary(reg):
"""Return a PT-friendly info dictionary for an adapter registration."""
factory = getRealFactory(reg.value)
path = getPythonPath(factory)
url = None
if isReferencable(path):
url = path.replace('.', '/')
if isinstance(reg.doc, (str, unicode)):
doc = reg.doc
zcml = None
else:
doc = None
zcml = getParserInfoInfoDictionary(reg.doc)
return {
'provided': getInterfaceInfoDictionary(reg.provided),
'required': [getInterfaceInfoDictionary(iface)
for iface in reg.required
if iface is not None],
'name': getattr(reg, 'name', _('<subscription>')),
'factory': path,
'factory_url': url,
'doc': doc,
'zcml': zcml}
开发者ID:wpjunior,项目名称:proled,代码行数:26,代码来源:component.py
示例13: getPermissionIds
def getPermissionIds(name, checker=_marker, klass=_marker):
"""Get the permissions of an attribute."""
assert (klass is _marker) != (checker is _marker)
entry = {}
if klass is not _marker:
checker = getCheckerForInstancesOf(klass)
if checker is not None and INameBasedChecker.providedBy(checker):
entry['read_perm'] = _evalId(checker.permission_id(name)) \
or _('n/a')
entry['write_perm'] = _evalId(checker.setattr_permission_id(name)) \
or _('n/a')
else:
entry['read_perm'] = entry['write_perm'] = None
return entry
开发者ID:wpjunior,项目名称:proled,代码行数:17,代码来源:utilities.py
示例14: applyUpdates
def applyUpdates(self):
message = ''
if 'submit_update' in self.request.form:
id = self.request.form.get(self.name)
if id == "disable":
active = self.context.active()
if active is not None:
self.context.activate(None)
message = _("Disabled")
else:
for info in self.context.info():
infoid = zapi.getPath(info['registration'])
if infoid == id and not info['active']:
self.context.activate(info['registration'])
message = _("Updated")
break
return message
开发者ID:BackupTheBerlios,项目名称:cctools-svn,代码行数:18,代码来源:registration.py
注:本文中的zope.app.i18n._函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论