Re: E-mails no longer being sent to a specific user account

"Werner F. Bruhin" <[email protected]>
Newsgroups gmane.comp.bug-tracking.roundup.user
Message-ID <[email protected]>
On 01/10/2012 15:02, Kaplan, Andrew H. wrote:
> Hello --
>
> I just wanted follow-up to my previous e-mail, and ask if there is a way to have the roundup-reminder.py
> script be able to send notifications to more than one user account on the system?
>
> Thanks.
>
> -----Original Message-----
> From: Kaplan, Andrew H.
> Sent: Friday, September 28, 2012 9:31 AM
> To: 'Bernhard Reiter'; [email protected]
> Subject: Re: [Roundup-users] E-mails no longer being sent to a specific user account
>
> Hello --
>
> I added the two lines mentioned in your e-mail, and manually ran the script. The output that appeared
> on-screen was the following:
>
> /root/roundup-reminder.py:30: DeprecationWarning: the MimeWriter module is deprecated; use the email package instead
>    import sys, cStringIO, MimeWriter, smtplib
> <roundup.configuration.CoreConfig instance at 0xb76a086c>
> Traceback (most recent call last):
>    File "/root/roundup-reminder.py", line 166, in <module>
>      print repr(db.config.ADMIN_EMAIL, address, message.getvalue())
> TypeError: repr() takes exactly one argument (3 given)
>
> The DeprecationWarning is a known issue, and can be safely ignored. What I did notice was the TypeError that indicates
> that repr() takes only one argument. That could explain why only the new user account is getting the emails.
This exception has to do with the "print repr" statement Bernard ask you 
to add, to help debug the issue by seeing what is getting to "sendmail" 
just below.  "repr" is a Python builtin and it can only take one 
argument, so you could e.g. break it up into four lines like this:

print repr(db.config)
print repr(db.config.ADMIN_EMAIL)
print repr(address)
print repr(message.getvalue())

Python 2.7 doc for repr:

repr(/object/)

    Return a string containing a printable representation of an object.
    This is the same value yielded by conversions (reverse quotes). It
    is sometimes useful to be able to access this operation as an
    ordinary function. For many types, this function makes an attempt to
    return a string that would yield an object with the same value when
    passed to eval()
    <http://docs.python.org/library/functions.html?highlight=repr#eval>,
    otherwise the representation is a string enclosed in angle brackets
    that contains the name of the type of the object together with
    additional information often including the name and address of the
    object. A class can control what this function returns for its
    instances by defining a __repr__()
    <http://docs.python.org/reference/datamodel.html#object.__repr__>
    method.

I haven't got around to use roundup so take the rest with a grain of 
salt and if you haven't done so by now you might want to read up on 
Python a bit more.

I think that your original problem of only getting the last email has to 
do with the script indentation (in Python very i
important).

Here some things to look at:

- At line 56 you have a for loop in it "address" variable is being 
assigned on line 61
- that for loop ends at line 140
- the loop starting on line 101 and line 141 lock to me pretty much the same

So my "guess fix" without digging deeper is:
- comment lines 140 to 159
- indent lines 162 to 166 by one level, so that they are within the 
first for loop.

Werner

------------------------------------------------------------------------------
Got visibility?
Most devs has no idea what their production app looks like.
Find out how fast your code is with AppDynamics Lite.
http://ad.doubleclick.net/clk;262219671;13503038;y?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html

_______________________________________________
Roundup-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/roundup-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.