Форум сайта python.su
0
банально <span tal:content=“python: context.meta_type”></span>
тоже вызывает ForbiddenAttribute: ('meta_type', <zope.site.folder.Folder object at 0x0331B470>)
аналогично в примере из книжки:
ForbiddenAttribute: ('meta_type', <tc.collector.ticketcollector.Collector object at 0x032BCB70>)
Отредактировано (Сен. 23, 2010 14:16:55)
Офлайн
3
Уберите наследование ISection от IContainer. BTreeContainer уже реализует контейнер
Офлайн
0
убрал, теперь:
ForbiddenAttribute: ('get', <intershop.content.section.section.Section object at 0x0333E970>)
Офлайн
0
очистил полностью шаблон отображения
оставил только
<html>
<span tal:content="context/name"/>
</html>
File 'c:\\intershop\\eggs\\zope.tales-3.5.1-py2.6.egg\\zope\\tales\\tales.py', line 704 in evaluateText
text = self.evaluate(expr)
Line 3
In expression: <PathExpr standard:u'context/name'>
- Names:
{'args': (),
'context': <intershop.content.section.section.Section object at 0x03BAC230>,
'default': <object object at 0x018C1738>,
'loop': {},
'nothing': None,
'options': {},
'repeat': {},
'request': <zope.publisher.browser.BrowserRequest instance URL=http://127.0.0.1:8080/%D0%BF%D1%80%D0%BE%D0%B4%D1%83%D0%BA%D1%82%D1%8B/test/@@index>,
'template': <zope.browserpage.viewpagetemplatefile.ViewPageTemplateFile object at 0x03206950>,
'view': <zope.browserpage.metaconfigure.SectionView object at 0x05A23C10>,
'views': <zope.browserpage.viewpagetemplatefile.ViewMapper object at 0x05A23DF0>}
File 'c:\\intershop\\eggs\\zope.tales-3.5.1-py2.6.egg\\zope\\tales\\tales.py', line 696 in evaluate
return expression(self)
File 'c:\\intershop\\eggs\\zope.tales-3.5.1-py2.6.egg\\zope\\tales\\expressions.py', line 217 in __call__
return self._eval(econtext)
File 'c:\\intershop\\eggs\\zope.tales-3.5.1-py2.6.egg\\zope\\tales\\expressions.py', line 194 in _eval
ob = self._subexprs[-1](econtext)
File 'c:\\intershop\\eggs\\zope.tales-3.5.1-py2.6.egg\\zope\\tales\\expressions.py', line 124 in _eval
ob = self._traverser(ob, element, econtext)
File 'c:\\intershop\\eggs\\zope.pagetemplate-3.5.2-py2.6.egg\\zope\\pagetemplate\\engine.py', line 66 in __call__
request=request)
(<intershop.content.section.section.Section object at 0x03BAC230>, 'name')
File 'c:\\intershop\\eggs\\zope.traversing-3.13-py2.6.egg\\zope\\traversing\\adapters.py', line 136 in traversePathElement
return traversable.traverse(nm, further_path)
File 'c:\\intershop\\eggs\\zope.container-3.11.1-py2.6-win32.egg\\zope\\container\\traversal.py', line 102 in traverse
v = container.get(name, _marker)
ForbiddenAttribute: ('get', <intershop.content.section.section.Section object at 0x03BAC230>)
Офлайн
0
может, проблема в том, что в реализации наследование от BTreeContainer, а надо к примеру от Folder?
Офлайн
0
Не уверен что поможет но:
1. Когда описываем интерфейс контейнера желательно разделять схему от основного интерфейса:
from zope.app.container.constraints import contains
class ISectionSchema(Interface):
name = TextLine(
title=u"",
default=u"",
required=True)
image = Bytes(
title=u"",
default=None,
required=False)
class ISection(ISectionSchema, IContainer):
"Comment"
<class class=".section.Section">
<require
interface=".interfaces.ISection"
permission="zope.Public"
/>
<require
set_schema=".interfaces.ISectionSchema"
permission="zope.Public"
/>
<require
interface="zope.container.interfaces.IReadContainer"
permission="zope.Public"
/>
</class>
Офлайн
0
SleepwalkerК сожалению, не хочет запускаться.
Не уверен что поможет но:
1. Когда описываем интерфейс контейнера желательно разделять схему от основного интерфейса:2. В zcml пишем следующим образом:from zope.app.container.constraints import contains
class ISectionSchema(Interface):
name = TextLine(
title=u"",
default=u"",
required=True)
image = Bytes(
title=u"",
default=None,
required=False)
class ISection(ISectionSchema, IContainer):
"Comment"Остальное оставляем как есть. Пока идей других нет… пробуйте так.<class class=".section.Section">
<require
interface=".interfaces.ISection"
permission="zope.Public"
/>
<require
set_schema=".interfaces.ISectionSchema"
permission="zope.Public"
/>
<require
interface="zope.container.interfaces.IReadContainer"
permission="zope.Public"
/>
</class>
Офлайн
0
Ну да …
class ISection(ISectionSchema, IContainer)
замени на
class ISection(ISectionSchema)
BtreeContainer уже имплементит интерфейс IContainer
Офлайн
3
LightOfMooNВ таком случае два раза права устанавливаются. Один раз для объекта BTreeContainer, второй раз для Section, поэтому возникает конфликт, так как BB не понимает, какую конфигурацию брать.
ConfigurationConflictError: Conflicting configuration actions
Офлайн
0
оно запустилось =)
но ошибка осталась:
ForbiddenAttribute: ('objectValues', <intershop.content.section.section.Section object at 0x033396F0>)
=(
Офлайн