将plone.app.dexterity添加到Plone 4.3 buildout后出错

时间:2013-07-15 11:04:41

标签: plone buildout dexterity

我使用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]部分

  3. 我重新运行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文件,但看起来解释器找不到它。

3 个答案:

答案 0 :(得分:3)

你不需要将灵巧添加到Plone 4.3,它已经包含在内:

答案 1 :(得分:1)

zopeskel.dexterity PyPI page所述,您还需要包含PasteScript蛋;回溯显示它丢失了:

[zopeskel]
recipe = zc.recipe.egg
eggs =
   ZopeSkel < 3.0dev
   Paste
   PasteDeploy
   PasteScript
   zopeskel.dexterity
   ${buildout:eggs}

答案 2 :(得分: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”命令的原因。

我们应该记录这种奇怪或找到避免它的方法。