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

"Kaplan, Andrew H." <[email protected]>
Newsgroups gmane.comp.bug-tracking.roundup.user
Message-ID <[email protected]>
Hello --

Thanks for your reply. I implemented the suggestions mentioned in your e-mail, and the following text is current to the script.
NOTE: The line numbers are included for reference.

140 # old_priority = None
141 # for priority_order, activity_date, creation_date, issue_id in l:
142 # priority = db.issue.get(issue_id,'priority')
143 # if (priority != old_priority):
144 # old_priority = priority
145 # print >>body, '<tr><td>-></td><td>-></td><td>-></td><td><b>%s</b></td></tr>'%db.priority.get(priority,'name')
146 # creation = (creation_date - date.Date('.')).pretty()
147 # if creation is None:
148 # creation = (creation_date - date.Date('.')).pretty()
149 # title = db.issue.get(issue_id, 'title')
150 # issue_id = '<a href="%sissue%s">%s</a>'%(db.config.TRACKER_WEB,
151 # issue_id, issue_id)
152 # activity = (activity_date - date.Date('.')).pretty()
153 # print >>body, '''<tr><td>%s</td><td>%s</td><td>%s</td>
154 # <td>%s</td></tr>'''%(creation, issue_id, activity, title)
155 # print >>body, '</table>'
156 #
157 # print >>body, '''<p>To view or respond to any of the issues listed
158 # above, simply click on the issue ID. Do <b>not</b> respond to
159 # this message.</p>'''
160 #
161 # finish of the multipart
162     writer.lastpart()
163
164 # all done, send!
165     smtp = SMTPConnection(db.config)
166     smtp.sendmail(db.config.ADMIN_EMAIL, address, message.getvalue())

When I reran the script, the following error message appeared onscreen:

File "/root/roundup-reminder.py", line 162
writer.lastpart()
^
IndentationError: unexpected indent

What else should I do here?

________________________________
From: Werner F. Bruhin [mailto:[email protected]]
Sent: Monday, October 01, 2012 11:14 AM
To: [email protected]
Subject: Re: [Roundup-users] E-mails no longer being sent to a specific user account

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]<mailto:[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


The information in this e-mail is intended only for the person to whom it is
addressed. If you believe this e-mail was sent to you in error and the e-mail
contains patient information, please contact the Partners Compliance HelpLine at
http://www.partners.org/complianceline . If the e-mail was sent to you in error
but does not contain patient information, please contact the sender and properly
dispose of the e-mail.

------------------------------------------------------------------------------
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.