Zope外部文件或静态资源目录

时间:2018-11-06 13:51:19

标签: firebase webpack plone zope

我将使用webpack构建的JavaScript应用程序集成到Zope 2.13.26实例中。我手动添加了文件,但现在我想将Zope中应用程序的文件夹与文件系统上webpack使用的/ public文件夹链接。

这样做的原因是,每当我使用webpack重新部署应用程序时,都会重新创建所有89个JS和CSS文件,因此在Zope中更新该应用程序是不切实际的。

在我仍然有的一些较旧的Zopes中,例如2.10,可以使用旧的ExternalFile产品访问文件系统上的目录,但是较新的Zope版本缺少Zope 2样式的界面,因此我尝试适应通过从以下位置更改IExternalFile.py来创建ExternalFile产品:

from Interface import Base

收件人:

from zope.interface import Interface

这允许Zope启动,但是我仍然无法添加ExternalFile。我收到此错误:

Traceback (innermost last):
  Module ZPublisher.Publish, line 138, in publish
  Module ZPublisher.mapply, line 77, in mapply
  Module ZPublisher.Publish, line 48, in call_object
  Module Shared.DC.Scripts.Bindings, line 322, in __call__
  Module Shared.DC.Scripts.Bindings, line 359, in _bindAndExec
  Module Products.PageTemplates.PageTemplateFile, line 130, in _exec
  Module Products.PageTemplates.PageTemplate, line 87, in pt_render
  Module zope.pagetemplate.pagetemplate, line 132, in pt_render
  Module five.pt.engine, line 98, in __call__
  Module z3c.pt.pagetemplate, line 163, in render
  Module chameleon.zpt.template, line 261, in render
  Module chameleon.template, line 191, in render
  Module chameleon.template, line 171, in render
  Module a92620f1f1dd7213a9d78f8af1772eb6.py, line 383, in render
  Module five.pt.expressions, line 135, in __call__
  Module five.pt.expressions, line 126, in traverse
  Module zope.traversing.adapters, line 136, in traversePathElement
   - __traceback_info__: (<App.ProductContext.__FactoryDispatcher__ object at 0x7f3b5e4b8290>, 'gethostname')
  Module zope.traversing.adapters, line 50, in traverse
   - __traceback_info__: (<App.ProductContext.__FactoryDispatcher__ object at 0x7f3b5e4b8290>, 'gethostname', ())
LocationError: (<App.ProductContext.__FactoryDispatcher__ object at 0x7f3b5e4b8290>, 'gethostname')

 - Expression: "container/gethostname"
 - Filename:   create
 - Location:   (line 37: col 20)
 - Arguments:  repeat: {...} (0)
               template: <ImplicitAcquisitionWrapper create at 0x7f3b605a9be0>
               modules: <instance - at 0x7f3b677e3098>
               here: <ImplicitAcquisitionWrapper - at 0x7f3b605a9140>
               user: <ImplicitAcquisitionWrapper - at 0x7f3b605a93c0>
               nothing: <NoneType - at 0x8f5320>
               container: <ImplicitAcquisitionWrapper - at 0x7f3b605a9140>
               basedir: 
               default: <object - at 0x7f3b6f875540>
               request: <instance - at 0x7f3b5fa20b48>
               wrapped_repeat: <SafeMapping - at 0x7f3b5fb1f2b8>
               loop: {...} (0)
               context: <ImplicitAcquisitionWrapper - at 0x7f3b605a9140>
               translate: <function translate at 0x7f3b5d81bcf8>
               root: <ImplicitAcquisitionWrapper Zope at 0x7f3b605a9640>
               options: {...} (1)
               target_language: <NoneType - at 0x8f5320>

我不理解该错误,也不知道这种方法是否可以完全起作用。

我也研究了Plone“静态资源目录”的实现方式,但是看不到在哪里注册目录。我的index_html是一个普通的HTML文件(不是页面模板),并且++ resource ++格式可能是个问题,因为主JS文件调用了其他需要位于标准位置的文件。

否则,该应用程序可以正常运行,我很乐意为该旧站点添加一些现代功能。任何解决方案表示赞赏!

0 个答案:

没有答案
相关问题