[Zope] Re: More product writing problems

Tille, Andreas TilleA@rki.de
Wed, 5 Dec 2001 11:39:08 +0100 (CET)


On Wed, 5 Dec 2001, Seb Bacon wrote:

> Not quite sure what's wrong here.  foo:lines should get coerced into a list
> type.
>
> Your default value in the function signature should therefore be
> keywords=(), rather than keywords=''.  But if you're passing a value in,
> this shouldn't be a problem.
I now seem to have found the solution:

def manage_addMyFolder(self, id, title='',
                     keywords=[],
 ...
    ob.keywords=[]
    for keyword in keywords:
        keyword=keyword.strip()
        if keyword != '' :
            ob.keywords.append(keyword)

Anyway, thanks for the hint.

> Watch out for using the name kw for a variable, since this is the standard
> name for a dictionary of keyword arguments.
Thanks.  As you see I now use a more general variable name.

But as any answer opens a new question:

Now I managed to get striped keywords at creation time of my Folder.
But if I change the keywords via the properties tab they will not be
stripped.  I guess I have to rewrite a further method - but which one?

Is there any template?

Kind regards

        Andreas.