/usr/share/pyshared/zope/app/pagetemplate/talesapi.py is in python-zope.app.pagetemplate 3.11.2-0ubuntu4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | ##############################################################################
#
# Copyright (c) 2003 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Implementation of the Zope TALES API
$Id: talesapi.py 116904 2010-09-25 13:20:53Z icemac $
"""
__docformat__ = 'restructuredtext'
from zope.interface import implements
from zope.size.interfaces import ISized
from zope.security.interfaces import Unauthorized
from zope.tales.interfaces import ITALESFunctionNamespace
from zope.dublincore.interfaces import IDCDescriptiveProperties
from zope.dublincore.interfaces import IDCTimes
from zope.dublincore.interfaces import IZopeDublinCore
from zope.traversing.api import getName
class ZopeTalesAPI(object):
implements(IDCTimes, IDCDescriptiveProperties, ITALESFunctionNamespace)
def __init__(self, context):
self.context = context
def setEngine(self, engine):
self._engine = engine
def title(self):
a = IZopeDublinCore(self.context, None)
if a is None:
raise AttributeError('title')
return a.title
title = property(title)
def description(self):
a = IZopeDublinCore(self.context, None)
if a is None:
raise AttributeError('description')
return a.description
description = property(description)
def created(self):
a = IZopeDublinCore(self.context, None)
if a is None:
raise AttributeError('created')
return a.created
created = property(created)
def modified(self):
a = IZopeDublinCore(self.context, None)
if a is None:
raise AttributeError('modified')
return a.modified
modified = property(modified)
def name(self):
return getName(self.context)
def title_or_name(self):
try:
return getattr(self, 'title', '') or getName(self.context)
except Unauthorized:
return getName(self.context)
def size(self):
a = ISized(self.context, None)
if a is None:
raise AttributeError('size')
return a.sizeForDisplay()
|