Skip to content

Commit 0a736d0

Browse files
author
Richard Jones
committed
[SF#503353] setting properties in initial email
1 parent bd1437e commit 0a736d0

File tree

4 files changed

+63
-3
lines changed

4 files changed

+63
-3
lines changed

CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Fixed:
2323
. plain rendering of links in the htmltemplate now generate a hyperlink to
2424
the linked node's page.
2525
. #503330 ] ANONYMOUS_REGISTER now applies to mail
26+
. #503353 ] setting properties in initial email
2627

2728

2829
2002-01-08 - 0.4.0b1

roundup/roundupdb.py

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
# $Id: roundupdb.py,v 1.39 2002-01-14 02:20:15 richard Exp $
18+
# $Id: roundupdb.py,v 1.40 2002-01-14 22:21:38 richard Exp $
1919

2020
__doc__ = """
2121
Extending hyperdb with types specific to issue-tracking.
@@ -452,6 +452,38 @@ def email_signature(self, nodeid, msgid):
452452
line = '_' * max(len(web), len(email))
453453
return '%s\n%s\n%s\n%s'%(line, email, web, line)
454454

455+
def generateCreateNote(self, nodeid):
456+
"""Generate a create note that lists initial property values
457+
"""
458+
cn = self.classname
459+
cl = self.db.classes[cn]
460+
props = cl.getprops(protected=0)
461+
462+
# list the values
463+
m = []
464+
for propname, prop in props.items():
465+
value = cl.get(nodeid, propname, None)
466+
if isinstance(prop, hyperdb.Link):
467+
link = self.db.classes[prop.classname]
468+
if value:
469+
key = link.labelprop(default_to_id=1)
470+
if key:
471+
value = link.get(value, key)
472+
else:
473+
value = ''
474+
elif isinstance(prop, hyperdb.Multilink):
475+
if value is None: value = []
476+
l = []
477+
link = self.db.classes[prop.classname]
478+
key = link.labelprop(default_to_id=1)
479+
if key:
480+
value = [link.get(entry, key) for entry in value]
481+
value = ', '.join(value)
482+
m.append('%s: %s'%(propname, value))
483+
m.insert(0, '----------')
484+
m.insert(0, '')
485+
return '\n'.join(m)
486+
455487
def generateChangeNote(self, nodeid, oldvalues):
456488
"""Generate a change note that lists property changes
457489
"""
@@ -529,6 +561,15 @@ def generateChangeNote(self, nodeid, oldvalues):
529561

530562
#
531563
# $Log: not supported by cvs2svn $
564+
# Revision 1.39 2002/01/14 02:20:15 richard
565+
# . changed all config accesses so they access either the instance or the
566+
# config attriubute on the db. This means that all config is obtained from
567+
# instance_config instead of the mish-mash of classes. This will make
568+
# switching to a ConfigParser setup easier too, I hope.
569+
#
570+
# At a minimum, this makes migration a _little_ easier (a lot easier in the
571+
# 0.5.0 switch, I hope!)
572+
#
532573
# Revision 1.38 2002/01/10 05:57:45 richard
533574
# namespace clobberation
534575
#

roundup/templates/classic/detectors/nosyreaction.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
#$Id: nosyreaction.py,v 1.10 2002-01-11 23:22:29 richard Exp $
18+
#$Id: nosyreaction.py,v 1.11 2002-01-14 22:21:38 richard Exp $
1919

2020
from roundup import roundupdb
2121

@@ -39,6 +39,7 @@ def nosyreaction(db, cl, nodeid, oldvalues):
3939
if oldvalues is None:
4040
# the action was a create, so use all the messages in the create
4141
messages = cl.get(nodeid, 'messages')
42+
change_note = cl.generateCreateNote(nodeid)
4243
elif oldvalues.has_key('messages'):
4344
# the action was a set (so adding new messages to an existing issue)
4445
m = {}
@@ -67,6 +68,14 @@ def init(db):
6768

6869
#
6970
#$Log: not supported by cvs2svn $
71+
#Revision 1.10 2002/01/11 23:22:29 richard
72+
# . #502437 ] rogue reactor and unittest
73+
# in short, the nosy reactor was modifying the nosy list. That code had
74+
# been there for a long time, and I suspsect it was there because we
75+
# weren't generating the nosy list correctly in other places of the code.
76+
# We're now doing that, so the nosy-modifying code can go away from the
77+
# nosy reactor.
78+
#
7079
#Revision 1.9 2001/12/15 19:24:39 rochecompaan
7180
# . Modified cgi interface to change properties only once all changes are
7281
# collected, files created and messages generated.

roundup/templates/extended/detectors/nosyreaction.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
#$Id: nosyreaction.py,v 1.10 2002-01-11 23:22:29 richard Exp $
18+
#$Id: nosyreaction.py,v 1.11 2002-01-14 22:21:38 richard Exp $
1919

2020
from roundup import roundupdb
2121

@@ -39,6 +39,7 @@ def nosyreaction(db, cl, nodeid, oldvalues):
3939
if oldvalues is None:
4040
# the action was a create, so use all the messages in the create
4141
messages = cl.get(nodeid, 'messages')
42+
change_note = cl.generateCreateNote(nodeid)
4243
elif oldvalues.has_key('messages'):
4344
# the action was a set (so adding new messages to an existing issue)
4445
m = {}
@@ -68,6 +69,14 @@ def init(db):
6869

6970
#
7071
#$Log: not supported by cvs2svn $
72+
#Revision 1.10 2002/01/11 23:22:29 richard
73+
# . #502437 ] rogue reactor and unittest
74+
# in short, the nosy reactor was modifying the nosy list. That code had
75+
# been there for a long time, and I suspsect it was there because we
76+
# weren't generating the nosy list correctly in other places of the code.
77+
# We're now doing that, so the nosy-modifying code can go away from the
78+
# nosy reactor.
79+
#
7180
#Revision 1.9 2001/12/15 19:24:39 rochecompaan
7281
# . Modified cgi interface to change properties only once all changes are
7382
# collected, files created and messages generated.

0 commit comments

Comments
 (0)