List Info

Thread: Scripting ZOPE/Plone installation




Scripting ZOPE/Plone installation
user name
2006-09-29 12:16:55
On 29 Sep 2006, at 10:07, Nick Davis wrote:


>
>>     db=user.aq_inner.aq_parent
>> AttributeError: aq_inner
> This is a common acquisition error, when you're doing
things that  
> are normally done in the ZMI, in a script. I've found
sometimes by  
> assigning an object to a variable in a script, it
somehow loads it,  
> or "brings into scope". I have been somewhat
in the dark, but  
> sometimes if you try to get at:
>
> app.a.b.c.d
>
> it helps if you first say -  x = app.a.b   y =
app.a.b.c  etc.
>
> This seems to load stuff in that would've been pulled
in  
> automatically if you were going via the ZMI.
>
> Failing this, make sure the methods you are calling are
not "ZMI- 
> only" i.e make assumptions that only hold when
you're accessing  
> through Zope.

OK, that didn't work, but I did find the page http://zopewiki.org/ 
DebuggingWithIPythonAndOtherTips which suggested...

adminuser =
app.acl_users.getUser('adminuser').__of__(app.acl_users)
newSecurityManager(None, adminuser)

This fixed the security problems, but...

2006-09-29 13:02:07 ERROR Zope.SiteErrorLog None
Traceback (most recent call last):
   File
"/home/zope/client0/Products/CMFQuickInstallerTool/ 
QuickInstallerTool.py", line 319, in installProduct
     res=install(portal, reinstall=reinstall)
   File
"/home/zope/zope-2.8/lib/python/Products/ExternalMethod
/ 
ExternalMethod.py", line 225, in __call__
     try: return f(*args, **kw)
   File
"/home/zope/client3/Products/ATContentTypes/Extensions/

Install.py", line 70, in install
     tool.recatalogCMFTypes()
   File
"/home/zope/client0/Products/ATContentTypes/tool/ 
migration.py", line 111, in recatalogCMFTypes
     cres, celapse, cc_elapse = self._catalogCMFtypes()
   File
"/home/zope/client0/Products/ATContentTypes/tool/ 
migration.py", line 501, in _catalogCMFtypes
     return self._catalogTypesByMetatype(mt)
   File
"/home/zope/client0/Products/ATContentTypes/tool/ 
migration.py", line 484, in _catalogTypesByMetatype
     REQUEST=self.REQUEST,
AttributeError: REQUEST
2006-09-29 13:02:07 ERROR Plone
Upgrade aborted
2006-09-29 13:02:07 ERROR Plone
Error type: exceptions.AttributeError
2006-09-29 13:02:07 ERROR Plone
Error value: REQUEST
2006-09-29 13:02:07 ERROR Plone
   File
"/home/zope/client0/Products/CMFPlone/MigrationTool.py&
quot;, line  
274, in upgrade
     newv, msgs = self._upgrade(newv)

2006-09-29 13:02:07 ERROR Plone
   File
"/home/zope/client0/Products/CMFPlone/MigrationTool.py&
quot;, line  
371, in _upgrade
     res = function(self.aq_parent)

2006-09-29 13:02:07 ERROR Plone
   File
"/home/zope/client0/Products/CMFPlone/migrations/v2_1/ 
alphas.py", line 65, in two05_alpha1
     installATContentTypes(portal, out)

2006-09-29 13:02:07 ERROR Plone
   File
"/home/zope/client0/Products/CMFPlone/migrations/v2_1/ 
alphas.py", line 273, in installATContentTypes
     installOrReinstallProduct(portal, product_name, out)

2006-09-29 13:02:07 ERROR Plone
   File
"/home/zope/client0/Products/CMFPlone/migrations/ 
migration_util.py", line 79, in
installOrReinstallProduct
     qi.installProduct(product_name)

2006-09-29 13:02:07 ERROR Plone
   File
"/home/zope/client0/Products/CMFQuickInstallerTool/ 
QuickInstallerTool.py", line 319, in installProduct
     res=install(portal, reinstall=reinstall)

2006-09-29 13:02:07 ERROR Plone
   File
"/home/zope/zope-2.8/lib/python/Products/ExternalMethod
/ 
ExternalMethod.py", line 225, in __call__
     try: return f(*args, **kw)

2006-09-29 13:02:07 ERROR Plone
   File
"/home/zope/client3/Products/ATContentTypes/Extensions/

Install.py", line 70, in install
     tool.recatalogCMFTypes()

2006-09-29 13:02:07 ERROR Plone
   File
"/home/zope/client0/Products/ATContentTypes/tool/ 
migration.py", line 111, in recatalogCMFTypes
     cres, celapse, cc_elapse = self._catalogCMFtypes()

2006-09-29 13:02:07 ERROR Plone
   File
"/home/zope/client0/Products/ATContentTypes/tool/ 
migration.py", line 501, in _catalogCMFtypes
     return self._catalogTypesByMetatype(mt)

2006-09-29 13:02:07 ERROR Plone
   File
"/home/zope/client0/Products/ATContentTypes/tool/ 
migration.py", line 484, in _catalogTypesByMetatype
     REQUEST=self.REQUEST,

Traceback (most recent call last):
   File "<stdin>", line 1, in ?
   File
"/home/zope/client0/Products/CMFPlone/Portal.py",
line 465,  
in manage_addSite
     p = gen.create(self, id.strip(), create_userfolder)
   File
"/home/zope/client0/Products/CMFPlone/Portal.py",
line 437,  
in create
     self.setupPlone(p)
   File
"/home/zope/client0/Products/CMFPlone/Portal.py",
line 394,  
in setupPlone
     m.upgrade(swallow_errors=0)
   File
"/home/zope/client0/Products/CMFPlone/MigrationTool.py&
quot;, line  
274, in upgrade
     newv, msgs = self._upgrade(newv)
   File
"/home/zope/client0/Products/CMFPlone/MigrationTool.py&
quot;, line  
371, in _upgrade
     res = function(self.aq_parent)
   File
"/home/zope/client0/Products/CMFPlone/migrations/v2_1/ 
alphas.py", line 65, in two05_alpha1
     installATContentTypes(portal, out)
   File
"/home/zope/client0/Products/CMFPlone/migrations/v2_1/ 
alphas.py", line 273, in installATContentTypes
     installOrReinstallProduct(portal, product_name, out)
   File
"/home/zope/client0/Products/CMFPlone/migrations/ 
migration_util.py", line 79, in
installOrReinstallProduct
     qi.installProduct(product_name)
   File
"/home/zope/client0/Products/CMFQuickInstallerTool/ 
QuickInstallerTool.py", line 319, in installProduct
     res=install(portal, reinstall=reinstall)
   File
"/home/zope/zope-2.8/lib/python/Products/ExternalMethod
/ 
ExternalMethod.py", line 225, in __call__
     try: return f(*args, **kw)
   File
"/home/zope/client3/Products/ATContentTypes/Extensions/

Install.py", line 70, in install
     tool.recatalogCMFTypes()
   File
"/home/zope/client0/Products/ATContentTypes/tool/ 
migration.py", line 111, in recatalogCMFTypes
     cres, celapse, cc_elapse = self._catalogCMFtypes()
   File
"/home/zope/client0/Products/ATContentTypes/tool/ 
migration.py", line 501, in _catalogCMFtypes
     return self._catalogTypesByMetatype(mt)
   File
"/home/zope/client0/Products/ATContentTypes/tool/ 
migration.py", line 484, in _catalogTypesByMetatype
     REQUEST=self.REQUEST,
AttributeError: REQUEST

I'm starting to think that just using the ZMI is an easier
option :-(

Duncan Mortimer
duncanfmrib.ox.ac.uk




_______________________________________________
Setup mailing list
Setuplists.plone.org
http://
lists.plone.org/mailman/listinfo/setup
Scripting ZOPE/Plone installation
user name
2006-09-29 13:27:40
Duncan Mortimer wrote:
>
>     REQUEST=self.REQUEST,
> AttributeError: REQUEST

You have to simulate sending yourself a request, something
along these 
lines :

from Testing.makerequest import makerequest
app=makerequest(app)
app.uol=makerequest(app.uol)

uol is our plone root - replace with what you have.


> I'm starting to think that just using the ZMI is an
easier option :-(
Thats the conclusion a number of people probably come to.
Its a pity 
though because its a good idea to write code that constructs
the site in 
pieces. Its a very modular approach that makes it easy to
trace back 
what happened. Creating stuff through the ZMI, one has no
record of what 
one did or a way to recreate it, or way to create partial
stuff for 
testing, etc

Apparently this is better in Zope 3.........................
-- 
Nick Davis
Web Application Developer
University of Leicester
http://www2.le.ac.uk
http://ebulletin.le.ac.uk


_______________________________________________
Setup mailing list
Setuplists.plone.org
http://
lists.plone.org/mailman/listinfo/setup
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )