manage_options in 2.3
Thanks for the new management interface guys I happily wrote a product last night and did a quick interface using the standard Folder interface and fiddled with filtered_meta_types list and dontAllowCutandPaste and so on. A quick How-To will be on its way. I got a wierd error trying to fiddle with manage_options though, in the olden days something like this worked: manage_options = ( ( Folder.manage_options[0], ) + ( {'label':'View', 'action':'my_index_html', ) + ( Folder.manage_options[2:], ) ) But I kept getting this error in 2.3: (Object: manage_tabs) File E:\Zope23\lib\python\App\special_dtml.py, line 236, in _exec (Object: manage_tabs) File E:\Zope23\lib\python\DocumentTemplate\DT_With.py, line 133, in render (Object: _(manage_options=filtered_manage_options())) File E:\Zope23\lib\python\DocumentTemplate\DT_Util.py, line 334, in eval (Object: _(manage_options=filtered_manage_options())) (Info: filtered_manage_options) File <string>, line 0, in ? File E:\Zope23\lib\python\App\Management.py, line 119, in filtered_manage_options (Object: Traversable) AttributeError: (see above) Error Type: AttributeError Error Value: 'tuple' object has no attribute 'get' It seems its looking for a tuple of dicts? But looking at Folder on other classes their manage_options hasn't changed. I then found this hack worked (looking at this morning it could be improved): _m = list(Folder.manage_options) _m[1] = {'label':'View','action':'my_index_html'} manage_options = (_m) Whats going on? -- Andy McKay.
Thanks for the new management interface guys I happily wrote a product last night and did a quick interface using the standard Folder interface and fiddled with filtered_meta_types list and dontAllowCutandPaste and so on. A quick How-To will be on its way. I got a wierd error trying to fiddle with manage_options though, in the olden days something like this worked:
manage_options = ( ( Folder.manage_options[0], ) + ( {'label':'View', 'action':'my_index_html', ) + ( Folder.manage_options[2:], ) )
Dunno if this is the actual problem or just a typo in the email:
manage_options = ( ( Folder.manage_options[0], ) + ( {'label':'View', 'action':'my_index_html', ) +
^ need to close dict w/ } I suspect its an email typo, though (I would have expected a SyntaxError, unless it was being consumed somehow). Brian Lloyd brian@digicool.com Software Engineer 540.371.6909 Digital Creations http://www.digicool.com
Doh, I that was an email typo I would have received a syntax error (I always run a syntax check prior to trying code, just not putting it in emails). Anyway I checked it again and it occurs on Zope 2.2.5, so the its a not a 2.3. The problem is the [2:] which for some reason doesnt want to work, when I thought I was accesing a simple tuple. Sorry to bother you. -- Andy McKay. ----- Original Message ----- From: "Brian Lloyd" <brian@digicool.com> To: "Andy McKay" <andym@ActiveState.com>; <zope-dev@zope.org> Sent: Thursday, February 08, 2001 7:17 AM Subject: RE: [Zope-dev] manage_options in 2.3
Thanks for the new management interface guys I happily wrote a product last night and did a quick interface using the standard Folder interface and fiddled with filtered_meta_types list and dontAllowCutandPaste and so on. A quick How-To will be on its way. I got a wierd error trying to fiddle with manage_options though, in the olden days something like this worked:
manage_options = ( ( Folder.manage_options[0], ) + ( {'label':'View', 'action':'my_index_html', ) + ( Folder.manage_options[2:], ) )
Dunno if this is the actual problem or just a typo in the email:
manage_options = ( ( Folder.manage_options[0], ) + ( {'label':'View', 'action':'my_index_html', ) +
^ need to close dict w/ }
I suspect its an email typo, though (I would have expected a SyntaxError, unless it was being consumed somehow).
Brian Lloyd brian@digicool.com Software Engineer 540.371.6909 Digital Creations http://www.digicool.com
Yes you can: ActivePython 2.0, build 202 (ActiveState Tool Corp.) based on Python 2.0 (#8, Oct 19 2000, 11:30:05) [MSC Type "copyright", "credits" or "license" for more in
a = ('a','b','c','d') print type(a) <type 'tuple'> b = a[1:] print b ('b', 'c', 'd') print type(b) <type 'tuple'>
-- Andy McKay. ----- Original Message ----- From: "Chris Withers" <chrisw@nipltd.com> To: "Andy McKay" <andym@activestate.com>; "Brian Lloyd" <brian@digicool.com> Cc: <zope-dev@zope.org> Sent: Thursday, February 08, 2001 10:18 AM Subject: Re: [Zope-dev] manage_options in 2.3
2.3. The problem is the [2:] which for some reason doesnt want to work, when I thought I was accesing a simple tuple.
You can't slice tuples, IIRC, which would explain why that bit fails.
cheers,
Chris
ActivePython 2.0, build 202 (ActiveState Tool Corp.) based on Python 2.0 (#8, Oct 19 2000, 11:30:05) [MSC Type "copyright", "credits" or "license" for more in
a = ('a','b','c','d') print type(a) <type 'tuple'> b = a[1:] print b ('b', 'c', 'd')
Hmmm... does 'normal' python work like that too? Probably... Ah well, you learn something new every day :-) thanks, Chris
If ActivePython is "un-normal" python, then yes "normal" python behaves like that too. :) -- Andy McKay. ----- Original Message ----- From: "Chris Withers" <chrisw@nipltd.com> To: "Andy McKay" <andym@activestate.com>; "Brian Lloyd" <brian@digicool.com> Cc: <zope-dev@zope.org> Sent: Thursday, February 08, 2001 11:10 AM Subject: Re: [Zope-dev] manage_options in 2.3
ActivePython 2.0, build 202 (ActiveState Tool Corp.) based on Python 2.0 (#8, Oct 19 2000, 11:30:05) [MSC Type "copyright", "credits" or "license" for more in
a = ('a','b','c','d') print type(a) <type 'tuple'> b = a[1:] print b ('b', 'c', 'd')
Hmmm... does 'normal' python work like that too? Probably...
Ah well, you learn something new every day :-)
thanks,
Chris
Hi, I want to create a sub modul in one of my Python Products, because it gets more manageble. Accualy I have a bunch of Plugins I which files I want to manage in sub directories of the original Python Product. e.g. ./Products/MyProduct/PluginKind1 etc... How do I setup the Zope registration procedure. I just had a look at ZPattern and the only thing it seem I have to do is import the module form MyProducts __ini__.py Is this assuption correct? Regards, Johan Carlsson By the way. Are there any reasons I shouldn't use necesting Plugins (Plugins that can have Plugins)?
At 07:32 PM 2/8/01 +0100, Johan Carlsson wrote:
Hi,
I want to create a sub modul in one of my Python Products, because it gets more manageble. Accualy I have a bunch of Plugins I which files I want to manage in sub directories of the original Python Product.
e.g. ./Products/MyProduct/PluginKind1 etc...
How do I setup the Zope registration procedure. I just had a look at ZPattern and the only thing it seem I have to do is import the module form MyProducts __ini__.py
Is this assuption correct?
Not quite. Zope only calls the registration ("initialize()") function in your main __init__.py module, so if you want sub-packages to have registration occur, you must have the main registration function call the registration functions from your sub-packages. See ZPatterns' main __init__.py for an example of this. I personally dislike having a monolithic initialize() function, so I always have the __init__.py initialize() call an initialize function in the individual modules or subpackages.
Are there any reasons I shouldn't use necesting Plugins (Plugins that can have Plugins)?
No reason at all. However, technically you'd be using PlugInContainers, since only PlugInContainers can contain PlugIns. ZPatterns does this all the time - note that a Specialist is a PlugInContainer, which can contain Racks as PlugIns. Racks are also PlugInContainers, and support Data PlugIns being plugged into them. LoginManager does the same thing, with data PlugIns inside of UserSources inside of LoginManagers.
participants (5)
-
Andy McKay -
Brian Lloyd -
Chris Withers -
Johan Carlsson -
Phillip J. Eby