[Zope] [Tracker]Tracker errors and fixes on HP/UX 11.00 with Pyth on 2.0

Farrell, Troy troy.farrell@wcg.com
Fri, 11 May 2001 14:00:53 -0500


I sent this to the tracker-dev@zope.org list, but due to the lack of
activity on that list, I think it might be better placed here.  When looking
at the diffs below, note that I always append a # to a line of code that I
edit in someone elses sources.
Troy

-----Original Message-----
From: Farrell, Troy 
Sent: Friday, May 11, 2001 11:06 AM
To: 'tracker-dev@zope.org'
Subject: Tracker errors and fixes on HP/UX 11.00 with Python 2.0


Hi Guys-
  I've installed Tracker before on Linux/i386 with Python 1.52 before
without problems, but when I try it with HPUX 11.00/Python 2.0 and Zope
2.3.1 or 2.3.2, there are many issues.  I seem to have fixed most of them
and I felt that you guys could use the fixes, so here we go:

1)
Inside the Tracker ZClass, I've changed
/Control_Panel/Products/Tracker/Tracker/propertysheets/methods/TrackerItem/p
ropertysheets/methods/index_html to include the following lines after the
comment at the beginning:

<dtml-unless expr="PATH_TRANSLATED == URL0[_.len(BASE0):]">
  <dtml-call expr="RESPONSE.redirect(URL0)">
</dtml-unless>

These lines fix the problems associated with the TrackerItem ZClass being
inside the Tracker ZClass instead of the TrackerIssue ZClass.  These
problems show themselves inside the manage_tabs method for a TrackerItem's
index_html

2)
Change all the appends with too many arguments to appending tuples, and
change tracker_role() so that it doesn't throw up an error when it tries to
convert a tuple to a string, because we can't convert a tuple to a string.
Please review the changes to tracker_role() in TrackerMisc.py especially
well.  I'm not very confident about them.  I've attached diffs below.


****************************************
DIFFS for Tracker
****************************************

troy@caustic:~/Zope-2.3.2-src/lib/python/Products/TrackerBase$ ls
CHANGES.txt       README.txt              TrackerMisc.py       envsetup.py
CVS               Tracker.zexp            TrackerMisc.py.orig  forms
LICENSE.txt       TrackerBase.py          TrackerMisc.pyc      issue.gif
Noodging.diff     TrackerBase.py.orig     __init__.py          item.gif
Noodging.py       TrackerBase.pyc         __init__.pyc         tracks.gif
Noodging.py.orig  TrackerMethods.py       addTrackerForm.dtml
Noodging.pyc      TrackerMethods.py.orig  age.py
troy@caustic:~/Zope-2.3.2-src/lib/python/Products/TrackerBase$ diff -c
Noodging.py.orig Noodging.py
*** Noodging.py.orig    Fri May 11 09:02:19 2001
--- Noodging.py Fri May 11 09:07:04 2001
***************
*** 99,105 ****
                  if transaction:
                      transaction.abort()
                  aborted = 1
!                 exceptions.append(TransactionAbort, details, rule)
                  if DEBUG >= 2:
                      Note("TransactionAbort(%s) encountered for %s\n",
                           details, `rule`)
--- 99,105 ----
                  if transaction:
                      transaction.abort()
                  aborted = 1
!                 exceptions.append((TransactionAbort, details, rule))#
                  if DEBUG >= 2:
                      Note("TransactionAbort(%s) encountered for %s\n",
                           details, `rule`)
troy@caustic:~/Zope-2.3.2-src/lib/python/Products/TrackerBase$ diff -c
TrackerBase.py.orig TrackerBase.py
*** TrackerBase.py.orig Fri May 11 09:02:29 2001
--- TrackerBase.py      Fri May 11 09:04:11 2001
***************
*** 76,82 ****
          """Return all keys and issues which we are privileged to view."""
          got = []
          for k, v in self._issues.items():
!             got.append(k, v.__of__(self))
          return got
      def values(self):
          """Return all issues which we are privileged to view."""
--- 76,82 ----
          """Return all keys and issues which we are privileged to view."""
          got = []
          for k, v in self._issues.items():
!             got.append((k, v.__of__(self)))#
          return got
      def values(self):
          """Return all issues which we are privileged to view."""
***************
*** 306,312 ****
          items = self._messages
          got = []
          for k, v in items.items():
!             got.append(k, v.__of__(self))
          if reverse:
              got.reverse()
          return got
--- 306,312 ----
          items = self._messages
          got = []
          for k, v in items.items():
!             got.append((k, v.__of__(self)))#
          if reverse:
              got.reverse()
          return got
troy@caustic:~/Zope-2.3.2-src/lib/python/Products/TrackerBase$ diff -c
TrackerMisc.py.orig TrackerMisc.py
*** TrackerMisc.py.orig Fri May 11 09:02:41 2001
--- TrackerMisc.py      Fri May 11 09:08:45 2001
***************
*** 165,171 ****
              and str(user.acl_users._nobody) == str(user)):
              return 1
          if (string.lower(i) == "superuser"
!             and str(user.acl_users._super) == str(user)):
              return 1
          if not categories.has_key(i):
              candidates.append(i)
--- 165,171 ----
              and str(user.acl_users._nobody) == str(user)):
              return 1
          if (string.lower(i) == "superuser"
!             and user.acl_users._emergency_user == str(user)):#
              return 1
          if not categories.has_key(i):
              candidates.append(i)
troy@caustic:~/Zope-2.3.2-src/lib/python/Products/TrackerBase$ diff -c
TrackerMethods.py.orig TrackerMethods.py
*** TrackerMethods.py.orig      Fri May 11 09:02:53 2001
--- TrackerMethods.py   Fri May 11 09:06:37 2001
***************
*** 377,393 ****
          if REQUEST is None: val = None
          else: val = REQUEST.get(i + "__trait", None)
          if val is not None:
!             traitVals.append(i, val)
              traitdict[i] = val
          elif origTraitValsDict.has_key(i):
!             traitVals.append(i, origTraitValsDict[i])
              traitdict[i] = origTraitValsDict[i]
          else:
              traitdict[i] = ''
              if extend:
                  vals = traitsStruct[i + "_range"][1]
!                 if vals: traitVals.append(i, vals[0])
!                 else: traitVals.append(i, '')

      if not hasattr(issue, 'traitVals') or issue.traitVals != traitVals:
          issue.traitVals = traitVals
--- 377,393 ----
          if REQUEST is None: val = None
          else: val = REQUEST.get(i + "__trait", None)
          if val is not None:
!             traitVals.append((i, val))#
              traitdict[i] = val
          elif origTraitValsDict.has_key(i):
!             traitVals.append((i, origTraitValsDict[i]))#
              traitdict[i] = origTraitValsDict[i]
          else:
              traitdict[i] = ''
              if extend:
                  vals = traitsStruct[i + "_range"][1]
!                 if vals: traitVals.append((i, vals[0]))#
!                 else: traitVals.append((i, ''))#

      if not hasattr(issue, 'traitVals') or issue.traitVals != traitVals:
          issue.traitVals = traitVals
***************
*** 2067,2077 ****
              else:
                  msg = str(tbobj)
              msg = msg + ', ' + str((herepath, branchpoint, ps))
!             got.append(p, msg)

          if o is not None:
              if not hasattr(o, 'type') or o.type != 'tracker':
!                 got.append(o, "Not a tracker")
              else:
                  if gotids.has_key(id(o.aq_base)):
                      # Already have one.
--- 2067,2077 ----
              else:
                  msg = str(tbobj)
              msg = msg + ', ' + str((herepath, branchpoint, ps))
!             got.append((p, msg))#

          if o is not None:
              if not hasattr(o, 'type') or o.type != 'tracker':
!                 got.append((o, "Not a tracker"))#
              else:
                  if gotids.has_key(id(o.aq_base)):
                      # Already have one.
***************
*** 2079,2088 ****
                  if o.tracker_role(o, 'staff',
user=REQUEST.AUTHENTICATED_USER):
                      # Bingo - we have staff access in this object.
                      gotids[id(o.aq_base)] = 1
!                     got.append(p, (o,))
                      gotobjs.append(o)
                  else:
!                     got.append(p, "Not staff in this tracker")
      tracker.peers = peers
      return (gotobjs, got)

--- 2079,2088 ----
                  if o.tracker_role(o, 'staff',
user=REQUEST.AUTHENTICATED_USER):
                      # Bingo - we have staff access in this object.
                      gotids[id(o.aq_base)] = 1
!                     got.append((p, (o,)))#
                      gotobjs.append(o)
                  else:
!                     got.append((p, "Not staff in this tracker"))#
      tracker.peers = peers
      return (gotobjs, got)

troy@caustic:~/Zope-2.3.2-src/lib/python/Products/TrackerBase$

*********************************************
End DIFFS
*********************************************