[Product-Developers] Re: Need Help with External Method

Mark Phillips mark at phillipsmarketing.biz
Wed Sep 2 00:25:48 UTC 2009


Maurits,

Thanks for the pointer...I forgot about how the error log filters out
certain errors.

The error said that it could not find the method in my python file. Well, it
is there. Then I realized I was cutting and pasting the ID, method name,
etc. from the ahs site to the ahs_dev site. I inadvertently added a trailing
space, so the method could not be found. I would call this a bug, since I
believe a method name in python cannot have a trailing (or leading) spaces.
In the traceback below, and you can see the trailing space in the method
name that was picked up by the add external method form:

Traceback (innermost last):
  Module ZPublisher.Publish, line 115, in publish
  Module ZPublisher.mapply, line 88, in mapply
  Module ZPublisher.Publish, line 41, in call_object
  Module Products.ExternalMethod.ExternalMethod, line 59, in
manage_addExternalMethod
  Module Products.ExternalMethod.ExternalMethod, line 111, in __init__
  Module Products.ExternalMethod.ExternalMethod, line 134, in manage_edit
  Module Products.ExternalMethod.ExternalMethod, line 141, in getFunction
  Module App.Extensions, line 158, in getObject
   - __traceback_info__:
('/opt/Plone-2.5.5/zeocluster/client1/Extensions/WorkflowEmailScripts.py',
'WorkflowEmailScripts')
NotFound: The specified object, <em>edit_new_content </em>, was not
found in module, <em>WorkflowEmailScripts</em>.

If my understanding of python is correct, shouldn't manage_addExternalMethod
stip off leading and trailing white space from the id, title, module, and
function names passed into the method? In ExternalMethod,
manage_addExternalMethod does this:
    id=str(id)
    title=str(title)
    module=str(module)
    function=str(function)

should it be?
    id=str(id).strip()
    title=str(title).strip()
    module=str(module).strip()
    function=str(function).strip()

Thanks again for shining a light on an otherwise murky road to
understanding! How would I submit a bug report, if you think there is a bug
here. Just a newbie trying to give back.

Mark

On Tue, Sep 1, 2009 at 2:14 PM, Maurits van Rees <m.van.rees at zestsoftware.nl
> wrote:

> Mark Phillips, on 2009-09-01:
> >
> > I have Plone-2.5.5 installed with as a zeocluster. I created two sites,
> one
> > ahs and one ahs_dev. Each one has a separate data.fs file in separate
> > directories. Each site has identical products. I added a python script to
> > the Extensions directory under client1, client2, and skel. I am able to
> add
> > the script as an external method in the ahs site and it works. When I try
> to
> > add the same script as an external method in the ahs_dev site, I get a
> 404
> > Error - object not found. Why can't I add the external method to the
> second
> > site? I even tried renaming the script and I still cannot add an external
> > method to the second site. What am I doing wrong? Everything else works
> in
> > the ahs_dev site.
>
> Go to the error_log of ahs_dev, remove or #comment out the line with
> NotFound.  Then try adding that external method again and see if that
> now gives you a proper traceback; hopefully that contains more hints.
> When you get a 404 on a page it is not always that page itself that
> cannot be found.
>
> Having said that, I *can* imagine that the separate Data.fs files are
> the cause for the problem here; if that is the case then I would call
> this a bug.
>
> --
> Maurits van Rees | http://maurits.vanrees.org/
>            Work | http://zestsoftware.nl/
> "This is your day, don't let them take it away." [Barlow Girl]
>
>
> _______________________________________________
> Product-Developers mailing list
> Product-Developers at lists.plone.org
> http://lists.plone.org/mailman/listinfo/product-developers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.plone.org/pipermail/plone-product-developers/attachments/20090901/760bf1af/attachment.html>


More information about the Product-Developers mailing list