From d756e69ae26a856a0f20a3a8a7e24f62613b6301 Mon Sep 17 00:00:00 2001
From: Nicolas Delaby <nicolas@nexedi.com>
Date: Mon, 6 Aug 2007 14:24:03 +0000
Subject: [PATCH] Set alert code on Subscription objects

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@15497 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5SyncML/Subscription.py | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/product/ERP5SyncML/Subscription.py b/product/ERP5SyncML/Subscription.py
index e62d15648d..9c00259a16 100644
--- a/product/ERP5SyncML/Subscription.py
+++ b/product/ERP5SyncML/Subscription.py
@@ -669,13 +669,14 @@ class Subscription(Folder, SyncCode):
   def __init__(self, id, title, publication_url, subscription_url, 
       destination_path, source_uri, target_uri, query, xml_mapping, 
       conduit, gpg_key, id_generator, gid_generator, media_type, login, 
-      password, activity_enabled):
+      password, activity_enabled, alert_code):
     """
       We need to create a dictionnary of
       signatures of documents which belong to the synchronisation
       process
     """
     self.id = id
+    self.setAlertCode(alert_code)
     self.setActivityEnabled(activity_enabled)
     self.publication_url = (publication_url)
     self.subscription_url = str(subscription_url)
@@ -699,9 +700,22 @@ class Subscription(Folder, SyncCode):
     self.setConduit(conduit)
     Folder.__init__(self, id)
     self.title = title
-    
+
     #self.signatures = PersitentMapping()
 
+  def getAlertCodeList(self):
+    #XXX replace by a dictionary or a list in SyncCode
+    return [self.TWO_WAY, self.ONE_WAY_FROM_SERVER]
+
+  def getAlertCode(self):
+    return getattr(self, 'alert_code', 200)
+
+  def setAlertCode(self, value):
+    self.alert_code = int(value)
+
+  def isOneWayFromServer(self):
+    return self.getDomainType() == self.SUB and self.getAlertCode() == self.ONE_WAY_FROM_SERVER
+
   def getActivityEnabled(self):
     """
     return true if we are using activity, false otherwise
-- 
2.30.9