List Info

Thread: Re: create a message in a detector (default nosy, based on userlists)




Re: create a message in a detector (default nosy, based on userlists)
country flaguser name
Germany
2007-03-28 02:09:41
David Linke wrote:
> Tobias Herp <tobias.herp <at> gmx.de>
writes:
> 
>> Hi,
>>
>> I have a userlist class, multilinking users, and
the following three entries:
>>
> (...)
>>     # DOESN'T WORK YET:
>>     if 0 and txtlist:
>>         txt = 'nn'.join(txtlist)
>>         from roundup.mailgw import Message
>>         if not newvalues.has_key('messages'):
>>             newvalues['messages'] = []
>>         # the Message constructor apparently
expects
>>         # a complete mail message, so this won't
work:
>>         newvalues['messages'].append(Message(txt))
>>     # DEBUG (this *does* work):
>>     elif txtlist:
>>         i=1
>>         for s in txtlist:
>>             print 'txtlist (%d): %s' % (i, s)
>>             i += 1
>>
>>     if newvalues.has_key('nosy'):
>>         newvalues['nosy'] = list(set(default_nosy +
newvalues['nosy']))
>>     else:
>>         newvalues['nosy'] =
list(set(default_nosy))
>>
>> This seams to work nicely. There ist just one wish
unfulfilled:
 >> I'd like to add a message automagically,
>> based on my txtlist (see above). How is this
supposed to be accomplished?
> 
> Shouldn't you use newvalues['content'] instead of
newvalues['messages']?

I don't know; should I? This didn't occur to me because I
don't 
understand completely for now how the content is turned into
a message...

-- 
Tobias


------------------------------------------------------------
-------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the
chance to share your
opinions on IT & business topics through brief
surveys-and earn cash
http://www.techsay.com/default.
php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Roundup-users mailing list
Roundup-userslists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/roundup-u
sers

Re: create a message in a detector (default nosy, based on userlists)
country flaguser name
Germany
2007-03-28 03:25:10
Tobias Herp <tobias.herp <at> gmx.de> writes:

> 
> David Linke wrote:
> > Tobias Herp <tobias.herp <at> gmx.de>
writes:
> > 
> >> Hi,
> >>
> >> I have a userlist class, multilinking users,
and the following
> >> three entries:
> >>
> > (...)
> >>     # DOESN'T WORK YET:
> >>     if 0 and txtlist:
> >>         txt = 'nn'.join(txtlist)
> >>         from roundup.mailgw import Message
> >>         if not newvalues.has_key('messages'):
> >>             newvalues['messages'] = []
> >>         # the Message constructor apparently
expects
> >>         # a complete mail message, so this
won't work:
> >>        
newvalues['messages'].append(Message(txt))
> > 
> > Shouldn't you use newvalues['content'] instead of
newvalues
> > ['messages']?
> 
> I don't know; should I? This didn't occur to me because
I don't 
> understand completely for now how the content is turned
into a 
> message...

No. That was nonsense. Try this:

content = 'Hi from the auditor!'
if newvalues.has_key('messages'):
    messageid = newvalues['messages'][-1] # add to last
message
    content = 'n'.join([db.msg.get(messageid, 'content'),
content])
    db.msg.set(messageid, content=content)
else:
    messageid = db.msg.create(author=db.getuid(),           
                  
    date=date.Date('.'),
                              content=content)
    newvalues['messages'] = [messageid]

David





------------------------------------------------------------
-------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the
chance to share your
opinions on IT & business topics through brief
surveys-and earn cash
http://www.techsay.com/default.
php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Roundup-users mailing list
Roundup-userslists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/roundup-u
sers

[1-2]

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