名为“MyApp”的克隆应用程序飞机坠毁

发布于 2024-11-09 19:40:10 字数 417 浏览 4 评论 0原文

我使用我的 Plone 实例文件夹的“bin/”目录中的“paster”命令来创建一个名为“MyApp”的 plone 应用程序(来自模板) - 该命令是:

(from instance's root folder):> ./bin/paster create -t plone_app

当要求提供名称时,我给了它“MyApp” ”。我将其复制到“src/”文件夹并将其注册到“buildout.cfg”文件中并运行 buildout。我有这个过程适用于其他具有不同名称的应用程序,但是似乎这个特定的应用程序总是使 Plone 崩溃。当我访问我的网站时,我得到的只是 Zope(并且无法访问 Plone)。有理由吗? “MyApp”是否是为导致崩溃的其他内容保留的命名空间?

我还应该注意到,名称“myapp”效果很好......

I used the "paster" command that comes in the "bin/" directory of my Plone's instance folder to create a plone app (from template) named "MyApp" - the command was:

(from instance's root folder):> ./bin/paster create -t plone_app

When asked for a name, I gave it "MyApp". I copied this to the "src/" folder and registered it within the "buildout.cfg" file and ran buildout. I have this process working for other apps with different names, however it seems that THIS particular app always crashes Plone. When I visit my site, all I get is Zope (and can't access Plone). Is there a reason why? Is "MyApp" a reserved namespace for something else that's causing a crash?

I should also note that a name "myapp" works just fine...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

撩动你心 2024-11-16 19:40:10

值得注意的是(特别是与 Maurits 的回复相关),如果您使用“zopeskel”脚本而不是粘贴器,如下所示:

bin/zopeskel plone_app MyApp

您将收到一条错误消息,告诉您需要一个带有两个点的名称。这是使用“zopeskel”脚本而不是 Paster 命令的主要原因之一。当你安装 zopeskel 时,你应该在 bin/paster 旁边有一个 bin/zopeskel。使用它,您将获得更好的错误消息和内联帮助。

It's worth noting (especially in relation to Maurits' response) that if you use the 'zopeskel' script instead of paster, like so:

bin/zopeskel plone_app MyApp

You will get an error message telling you that you need a name with two dots. That's one of the primary reasons to use the 'zopeskel' script instead of the paster command. When you install zopeskel, you should have a bin/zopeskel right next to bin/paster. Use it, and you'll get better error messages and inline help.

黯然#的苍凉 2024-11-16 19:40:10

对我有用:

aclark@Alex-Clarks-MacBook-Pro:~/Developer/test-4.1/src/ > paster create -t plone_app MyApp
Selected and implied templates:
  ZopeSkel#nested_namespace  A basic Python project with a nested namespace (2 dots in name)
  ZopeSkel#plone_app         A project for Plone products with a nested namespace (2 dots in name)

Variables:
  egg:      MyApp
  package:  myapp
  project:  MyApp
Expert Mode? (What question mode would you like? (easy/expert/all)?) ['easy']: 
Version (Version number for project) ['1.0']: 
Description (One-line description of the project) ['']: 
Creating template nested_namespace
Creating directory ./MyApp
  Recursing into +namespace_package+
    Creating ./MyApp/MyApp/
    Recursing into +namespace_package2+
      Creating ./MyApp/MyApp/plone/
      Recursing into +package+
        Creating ./MyApp/MyApp/plone/MyApp/
        Copying __init__.py_tmpl to ./MyApp/MyApp/plone/MyApp/__init__.py
      Copying __init__.py_tmpl to ./MyApp/MyApp/plone/__init__.py
    Copying __init__.py_tmpl to ./MyApp/MyApp/__init__.py
  Copying README.txt_tmpl to ./MyApp/README.txt
  Recursing into docs
    Creating ./MyApp/docs/
    Copying HISTORY.txt_tmpl to ./MyApp/docs/HISTORY.txt
  Copying setup.py_tmpl to ./MyApp/setup.py
Creating template plone_app
  Recursing into +namespace_package+
    Recursing into +namespace_package2+
      Recursing into +package+
Replace 0 bytes with 86 bytes (0/0 lines changed; 3 lines added)
        Copying __init__.py_tmpl to ./MyApp/MyApp/plone/MyApp/__init__.py
        Copying configure.zcml_tmpl to ./MyApp/MyApp/plone/MyApp/configure.zcml
        Copying tests.py_tmpl to ./MyApp/MyApp/plone/MyApp/tests.py
        Copying version.txt_tmpl to ./MyApp/MyApp/plone/MyApp/version.txt
  Recursing into docs
    Copying INSTALL.txt_tmpl to ./MyApp/docs/INSTALL.txt
    Copying LICENSE.GPL to ./MyApp/docs/LICENSE.GPL
    Copying LICENSE.txt_tmpl to ./MyApp/docs/LICENSE.txt
Replace 890 bytes with 973 bytes (0/32 lines changed; 4 lines added)
  Copying setup.py_tmpl to ./MyApp/setup.py

使用构建:

aclark@Alex-Clarks-MacBook-Pro:~/Developer/test-4.1/ > cat buildout.cfg 
[buildout]
extends = http://dist.aclark.net/build/plone/4.1.x/develop.cfg
develop = src/MyApp

[plone]
eggs += 
    MyApp

显然这不是您期望的结果,paster 创建了一个名为“MyApp.plone.MyApp”的三重嵌套命名空间包:-)

进一步注意:此应用程序不会出现在 Plone 的附加组件中,除非您在 MyApp/plone/MyApp/configure.zcml 中添加 GenericSetup 配置文件,如下所示:

<configure
    xmlns="http://namespaces.zope.org/zope"
    xmlns:five="http://namespaces.zope.org/five"
    xmlns:genericsetup="http://namespaces.zope.org/genericsetup"
    i18n_domain="MyApp.plone.MyApp">

  <five:registerPackage package="." initialize=".initialize" />

  <genericsetup:registerProfile
      name="default"
      title="MyApp"
      directory="profiles/default"
      description="MyApp"
      provides="Products.GenericSetup.interfaces.EXTENSION"
  />

</configure>

那么您应该看到:

在此处输入图像描述

最后,非命名空间包没有什么“错误”,它们只是约定(相对于平面命名空间包有优缺点,反之亦然)。请参阅:

了解“平面”命名空间的示例克隆包。

Works for me:

aclark@Alex-Clarks-MacBook-Pro:~/Developer/test-4.1/src/ > paster create -t plone_app MyApp
Selected and implied templates:
  ZopeSkel#nested_namespace  A basic Python project with a nested namespace (2 dots in name)
  ZopeSkel#plone_app         A project for Plone products with a nested namespace (2 dots in name)

Variables:
  egg:      MyApp
  package:  myapp
  project:  MyApp
Expert Mode? (What question mode would you like? (easy/expert/all)?) ['easy']: 
Version (Version number for project) ['1.0']: 
Description (One-line description of the project) ['']: 
Creating template nested_namespace
Creating directory ./MyApp
  Recursing into +namespace_package+
    Creating ./MyApp/MyApp/
    Recursing into +namespace_package2+
      Creating ./MyApp/MyApp/plone/
      Recursing into +package+
        Creating ./MyApp/MyApp/plone/MyApp/
        Copying __init__.py_tmpl to ./MyApp/MyApp/plone/MyApp/__init__.py
      Copying __init__.py_tmpl to ./MyApp/MyApp/plone/__init__.py
    Copying __init__.py_tmpl to ./MyApp/MyApp/__init__.py
  Copying README.txt_tmpl to ./MyApp/README.txt
  Recursing into docs
    Creating ./MyApp/docs/
    Copying HISTORY.txt_tmpl to ./MyApp/docs/HISTORY.txt
  Copying setup.py_tmpl to ./MyApp/setup.py
Creating template plone_app
  Recursing into +namespace_package+
    Recursing into +namespace_package2+
      Recursing into +package+
Replace 0 bytes with 86 bytes (0/0 lines changed; 3 lines added)
        Copying __init__.py_tmpl to ./MyApp/MyApp/plone/MyApp/__init__.py
        Copying configure.zcml_tmpl to ./MyApp/MyApp/plone/MyApp/configure.zcml
        Copying tests.py_tmpl to ./MyApp/MyApp/plone/MyApp/tests.py
        Copying version.txt_tmpl to ./MyApp/MyApp/plone/MyApp/version.txt
  Recursing into docs
    Copying INSTALL.txt_tmpl to ./MyApp/docs/INSTALL.txt
    Copying LICENSE.GPL to ./MyApp/docs/LICENSE.GPL
    Copying LICENSE.txt_tmpl to ./MyApp/docs/LICENSE.txt
Replace 890 bytes with 973 bytes (0/32 lines changed; 4 lines added)
  Copying setup.py_tmpl to ./MyApp/setup.py

With buildout:

aclark@Alex-Clarks-MacBook-Pro:~/Developer/test-4.1/ > cat buildout.cfg 
[buildout]
extends = http://dist.aclark.net/build/plone/4.1.x/develop.cfg
develop = src/MyApp

[plone]
eggs += 
    MyApp

Obviously this is not the result you expect though, paster created a triple nested namespace package called "MyApp.plone.MyApp" :-)

Further note: this app will not appear in Add-ons in Plone, unless you add a GenericSetup profile in MyApp/plone/MyApp/configure.zcml like so:

<configure
    xmlns="http://namespaces.zope.org/zope"
    xmlns:five="http://namespaces.zope.org/five"
    xmlns:genericsetup="http://namespaces.zope.org/genericsetup"
    i18n_domain="MyApp.plone.MyApp">

  <five:registerPackage package="." initialize=".initialize" />

  <genericsetup:registerProfile
      name="default"
      title="MyApp"
      directory="profiles/default"
      description="MyApp"
      provides="Products.GenericSetup.interfaces.EXTENSION"
  />

</configure>

Then you should see:

enter image description here

Finally, there is nothing "wrong" with non-namespace packages, they are just convention (with pros/cons over flat namespace packages, and vice versa). See:

for an example of a "flat" namespace Plone package.

陪你到最终 2024-11-16 19:40:10

当我尝试该命令时,它会像这样启动:

$ paster create -t plone_app
Selected and implied templates:
  ZopeSkel#nested_namespace  A basic Python project with a nested namespace (2 dots in name)
  ZopeSkel#plone_app         A project for Plone products with a nested namespace (2 dots in name)

这意味着您应该选择一个带有两个点的名称,而不是 MyApp,例如 plone.app.mine。当您仅将 MyApp 作为项目名称时,它显然会创建一个包 MyApp.plone.MyApp。

是的,如果粘贴器(zopeskel)在这里给出错误就更好了。

实际上,当我在这里填写 MyApp 并在 Plone 4 站点中使用它时,它确实启动了。因此,粘贴您获得的确切回溯可能会有所帮助。但最好的可能是选择一个更好的名字。

Plone 本身对某些包使用嵌套命名空间(如 plone.app.locales)。对于你自己的项目,我会说这是矫枉过正。相反,请尝试使用“paster create -t​​ plone”,它需要像 my.app 或 clientname.theme 这样的名称。

When I try that command it starts up like this:

$ paster create -t plone_app
Selected and implied templates:
  ZopeSkel#nested_namespace  A basic Python project with a nested namespace (2 dots in name)
  ZopeSkel#plone_app         A project for Plone products with a nested namespace (2 dots in name)

This means that instead of MyApp you should choose a name with two dots, like plone.app.mine. When you just give MyApp as project name it apparently creates a package MyApp.plone.MyApp.

Yes, it would be nicer if paster (zopeskel) would give an error here.

Actually, when I fill in MyApp here and use that in a Plone 4 site it does actually start up. So it may help to paste the exact traceback you get. But best is probably to pick a better name.

Plone itself uses nested namespaces for some packages (like plone.app.locales). For your own projects I would say it is overkill. Instead try it with 'paster create -t plone' which expects a name like my.app or clientname.theme.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文