On 19/02/2004, Tim Legant wrote:
> Regardless of whether we use eval() or exec(), we will be limited to
> one line of Python code.  The solution to having more than one line is
> to define a Python function in your config file.  Once you've done
> that, eval() turns out to be simpler, since you can return a string
> containing anything that should be in the field body (i.e., whatever
> comes after "x-answer:" in the above example.

I've been thinking about something like this for a filter command as
well - a sort of "python-filter". I like the idea of being able to
define some functions in the config file which can be called from the
filters. They'd be more useful if they got passed a standard set of
args as well (sender, recipients, headers/body/message object
whatever). That way you could write advanced filters in python which
exit true/false depending on the filter action.

In fact, I'd like to generalise it even further and provide a python
function that you can call in a config that allows you to define
filter keywords (like "python-filter") that become parsable actions
associated with the functions. But I may be jumping ahead of myself a
little here.

Tag actions could do a similar thing, but like you say exit with a
string.

I'd be up for submitting a patch (for the filter) if other people are
interested.

Marcus

-- 
Marcus Williams -- http://www.quintic.co.uk
Quintic Ltd, 39 Newnham Road, Cambridge, UK
  This message is private [ ] public [*]

_________________________________________________
tmda-workers mailing list ([EMAIL PROTECTED])
http://tmda.net/lists/listinfo/tmda-workers

Reply via email to