0

我使用https://github.com/plone/plonedev.vagrant在 Windows 上设置了 Plone 4.3 开发环境。我一直在尝试为我的安装添加 Dexterity 支持,但遇到了问题。

我采取的步骤如下:

  1. 将 zopeskel.dexterity 和 plone.app.dexterity [relations, grok] 添加到我的 buildout.cfg 的 [eggs] 部分

  2. 将 ZopeSkel <= 2.99 添加到 buildout.cfg 的 [versions] 部分

我重新运行 buildout 并尝试在前台模式下启动服务器,但得到这个回溯:

vagrant@precise32:~$ ./runbin.sh plonectl fg                                                                                                                                                                                       
instance: Traceback (most recent call last):                                                                                                                                                                                       
  File "/home/vagrant/Plone/zinstance/bin/instance", line 290, in <module>                                                                                                                                                         
    import plone.recipe.zope2instance.ctl                                                                                                                                                                                          
  File "/home/vagrant/Plone/buildout-cache/eggs/plone.recipe.zope2instance-4.2.9-py2.7.egg/plone/recipe/__init__.py", line 1, in <module>                                                                                          
    __import__('pkg_resources').declare_namespace(__name__)                                                                                                                                                                        
  File "/home/vagrant/Plone/buildout-cache/eggs/distribute-0.6.28-py2.7.egg/pkg_resources.py", line 2835, in <module>                                                                                                              
    add_activation_listener(lambda dist: dist.activate())                                                                                                                                                                          
  File "/home/vagrant/Plone/buildout-cache/eggs/distribute-0.6.28-py2.7.egg/pkg_resources.py", line 704, in subscribe                                                                                                              
    callback(dist)                                                                                                                                                                                                                 
  File "/home/vagrant/Plone/buildout-cache/eggs/distribute-0.6.28-py2.7.egg/pkg_resources.py", line 2835, in <lambda>                                                                                                              
    add_activation_listener(lambda dist: dist.activate())                                                                                                                                                                          
  File "/home/vagrant/Plone/buildout-cache/eggs/distribute-0.6.28-py2.7.egg/pkg_resources.py", line 2262, in activate                                                                                                              
    map(declare_namespace, self._get_metadata('namespace_packages.txt'))                                                                                                                                                           
  File "/home/vagrant/Plone/buildout-cache/eggs/distribute-0.6.28-py2.7.egg/pkg_resources.py", line 1847, in declare_namespace                                                                                                     
    _handle_ns(packageName, path_item)                                                                                                                                                                                             
  File "/home/vagrant/Plone/buildout-cache/eggs/distribute-0.6.28-py2.7.egg/pkg_resources.py", line 1817, in _handle_ns                                                                                                            
    loader.load_module(packageName); module.__path__ = path                                                                                                                                                                        
  File "/usr/lib/python2.7/pkgutil.py", line 246, in load_module                                                                                                                                                                   
    mod = imp.load_module(fullname, self.file, self.filename, self.etc)                                                                                                                                                            
  File "/home/vagrant/Plone/buildout-cache/eggs/ZopeSkel-2.21.2-py2.7.egg/zopeskel/__init__.py", line 2, in <module>                                                                                                               
    from zopeskel.basic_namespace import BasicNamespace                                                                                                                                                                            
  File "/home/vagrant/Plone/buildout-cache/eggs/ZopeSkel-2.21.2-py2.7.egg/zopeskel/basic_namespace.py", line 2, in <module>                                                                                                        
    from zopeskel.vars import var, DottedVar, StringVar, BooleanVar, TextVar                                                                                                                                                       
  File "/home/vagrant/Plone/buildout-cache/eggs/ZopeSkel-2.21.2-py2.7.egg/zopeskel/vars.py", line 2, in <module>                                                                                                                   
    from paste.script.templates import var as base_var                                                                                                                                                                             
ImportError: No module named script.templates

编辑:我忘了提到 buildout.cfg 扩展了 base.cfg,其中包含以下内容:

[zopeskel]
# installs paster and Zopeskel
recipe = zc.recipe.egg
eggs =
    ZopeSkel
    Paste
    PasteDeploy
    PasteScript
    ${buildout:eggs}

我刚刚尝试明确添加PasteScript到 buildout.cfg 中的 [eggs] 部分。运行 buildout 并尝试启动服务器后,我得到了不同的回溯:

vagrant@precise32:~$ ./runbin.sh plonectl fg                                                                                                                                                                                       
instance: Traceback (most recent call last):                                                                                                                                                                                       
  File "/home/vagrant/Plone/zinstance/bin/instance", line 291, in <module>                                                                                                                                                         
    import plone.recipe.zope2instance.ctl                                                                                                                                                                                          
  File "/home/vagrant/Plone/buildout-cache/eggs/plone.recipe.zope2instance-4.2.9-py2.7.egg/plone/recipe/__init__.py", line 1, in <module>                                                                                          
    __import__('pkg_resources').declare_namespace(__name__)                                                                                                                                                                        
  File "/home/vagrant/Plone/buildout-cache/eggs/distribute-0.6.28-py2.7.egg/pkg_resources.py", line 2835, in <module>                                                                                                              
    add_activation_listener(lambda dist: dist.activate())                                                                                                                                                                          
  File "/home/vagrant/Plone/buildout-cache/eggs/distribute-0.6.28-py2.7.egg/pkg_resources.py", line 704, in subscribe                                                                                                              
    callback(dist)                                                                                                                                                                                                                 
  File "/home/vagrant/Plone/buildout-cache/eggs/distribute-0.6.28-py2.7.egg/pkg_resources.py", line 2835, in <lambda>                                                                                                              
    add_activation_listener(lambda dist: dist.activate())                                                                                                                                                                          
  File "/home/vagrant/Plone/buildout-cache/eggs/distribute-0.6.28-py2.7.egg/pkg_resources.py", line 2262, in activate                                                                                                              
    map(declare_namespace, self._get_metadata('namespace_packages.txt'))                                                                                                                                                           
  File "/home/vagrant/Plone/buildout-cache/eggs/distribute-0.6.28-py2.7.egg/pkg_resources.py", line 1847, in declare_namespace                                                                                                     
    _handle_ns(packageName, path_item)                                                                                                                                                                                             
  File "/home/vagrant/Plone/buildout-cache/eggs/distribute-0.6.28-py2.7.egg/pkg_resources.py", line 1817, in _handle_ns                                                                                                            
    loader.load_module(packageName); module.__path__ = path                                                                                                                                                                        
  File "/usr/lib/python2.7/pkgutil.py", line 246, in load_module                                                                                                                                                                   
    mod = imp.load_module(fullname, self.file, self.filename, self.etc)                                                                                                                                                            
  File "/home/vagrant/Plone/buildout-cache/eggs/ZopeSkel-2.21.2-py2.7.egg/zopeskel/__init__.py", line 2, in <module>                                                                                                               
    from zopeskel.basic_namespace import BasicNamespace                                                                                                                                                                            
  File "/home/vagrant/Plone/buildout-cache/eggs/ZopeSkel-2.21.2-py2.7.egg/zopeskel/basic_namespace.py", line 2, in <module>                                                                                                        
    from zopeskel.vars import var, DottedVar, StringVar, BooleanVar, TextVar                                                                                                                                                       
  File "/home/vagrant/Plone/buildout-cache/eggs/ZopeSkel-2.21.2-py2.7.egg/zopeskel/vars.py", line 2, in <module>                                                                                                                   
    from paste.script.templates import var as base_var                                                                                                                                                                             
  File "/vagrant/plone/src/hello.world/PasteScript-1.7.5-py2.7.egg/paste/script/templates.py", line 9, in <module>                                                                                                                 
    from paste.util.template import paste_script_template_renderer                                                                                                                                                                 
ImportError: No module named util.template

这是我的 Python 路径的问题吗?bin/zopepy然后我跑了import paste;print paste.__file__,输出是:

/vagrant/plone/src/hello.world/PasteScript-1.7.5-py2.7.egg/paste/__init__.pyc

Paste-1.7.5.1 egg 目录确实包含一个 paste/util/template.py 文件,但看起来解释器找不到它。

4

3 回答 3

3

您不需要将 Dexterity 添加到 Plone 4.3,它已经包含:

于 2013-07-15T11:53:32.990 回答
1

正如zopeskel.dexterityPyPI 页面上所记录的,您也需要包含PasteScript鸡蛋;回溯显示它丢失了:

[zopeskel]
recipe = zc.recipe.egg
eggs =
   ZopeSkel < 3.0dev
   Paste
   PasteDeploy
   PasteScript
   zopeskel.dexterity
   ${buildout:eggs}
于 2013-07-15T11:46:42.783 回答
0

你可能做的工作比你需要做的要多得多。plonedev.vagrant 套件预装了 zopeskel 和 zopeskel.dexterity。看看这个成绩单:

steve@lumpy:~/plonedev_vagrant$ vagrant up
[default] Importing base box 'precise32'...
...
steve@lumpy:~/plonedev_vagrant$ vagrant ssh
Welcome to Ubuntu 12.04.2 LTS (GNU/Linux 3.2.0-48-generic i686)
...
vagrant@vagrant-ubuntu-precise-32:~/Plone/zinstance$ ll bin
...
-rwxr-xr-x 1 vagrant vagrant 20023 Jul 16 01:41 zopeskel*
...
vagrant@vagrant-ubuntu-precise-32:~/Plone/zinstance$ cd src
...
vagrant@vagrant-ubuntu-precise-32:~/Plone/zinstance/src$ ~/Plone/zinstance/bin/zopeskel dexterity

dexterity: A Dexterity-based product
...

这有一点神奇:由于 plonedev.vagrant 工具包符号链接 src 目录的方式,您不能 cd 到它并使用“../bin/zopeskel”。这就是使用“~/Plone/zinstance/bin/zopeskel dexterity”命令的原因。

我们应该记录这种奇怪的情况,或者找到一种方法来避免它。

于 2013-07-16T01:55:26.147 回答