From 3a75231a641671c37b9080dd0c4b6f13068dd250 Mon Sep 17 00:00:00 2001
From: Leonardo Rochael Almeida <leonardo@nexedi.com>
Date: Mon, 4 Apr 2011 12:32:17 +0000
Subject: [PATCH] Allow querying the Business Process for Business Links w/o
 predecessor or sucessor

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@45045 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/Document/BusinessProcess.py | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/product/ERP5/Document/BusinessProcess.py b/product/ERP5/Document/BusinessProcess.py
index e55afcae32..4558f86387 100644
--- a/product/ERP5/Document/BusinessProcess.py
+++ b/product/ERP5/Document/BusinessProcess.py
@@ -40,6 +40,8 @@ import zope.interface
 
 from zLOG import LOG
 
+_marker = object()
+
 class BusinessProcess(Path, XMLObject):
   """The BusinessProcess class is a container class which is used
   to describe business processes in the area of trade, payroll
@@ -195,7 +197,7 @@ class BusinessProcess(Path, XMLObject):
   # IBusinessLinkProcess implementation
   security.declareProtected(Permissions.AccessContentsInformation, 'getBusinessLinkValueList')
   def getBusinessLinkValueList(self, trade_phase=None, context=None,
-                               predecessor=None, successor=None, **kw):
+                               predecessor=_marker, successor=_marker, **kw):
     """Returns all Business Links of the current BusinessProcess which
     are matching the given trade_phase and the optional context.
 
@@ -223,9 +225,11 @@ class BusinessProcess(Path, XMLObject):
     # First, collect business links which can be applicable to a given context.
     business_link_list = []
     for business_link in original_business_link_list:
-      if predecessor is not None and business_link.getPredecessor() != predecessor:
+      if (predecessor is not _marker and
+          business_link.getPredecessor() != predecessor):
         continue # Filter our business link which predecessor does not match
-      if successor is not None and business_link.getSuccessor() != successor:
+      if (successor is not _marker and
+          business_link.getSuccessor() != successor):
         continue # Filter our business link which successor does not match
       if trade_phase is not None and not trade_phase.intersection(
                                    business_link.getTradePhaseList()):
-- 
2.30.9