Commit 735002a9 authored by Sebastien Robin's avatar Sebastien Robin

add the ActivityEnabled to the Subscription (by fab)


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@15050 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 5a4ab808
...@@ -179,18 +179,6 @@ class Publication(Subscription): ...@@ -179,18 +179,6 @@ class Publication(Subscription):
self.authentication_format = authentication_format self.authentication_format = authentication_format
self.authentication_type = authentication_type self.authentication_type = authentication_type
def getActivityEnabled(self):
"""
return true if we are using activity, false otherwise
"""
return getattr(self, 'activity_enabled', None)
def setActivityEnabled(self, activity_enabled):
"""
set if we are using activity or not
"""
self.activity_enabled = activity_enabled
def getPublicationUrl(self): def getPublicationUrl(self):
""" """
return the publication url return the publication url
......
...@@ -669,13 +669,14 @@ class Subscription(Folder, SyncCode): ...@@ -669,13 +669,14 @@ class Subscription(Folder, SyncCode):
def __init__(self, id, title, publication_url, subscription_url, def __init__(self, id, title, publication_url, subscription_url,
destination_path, source_uri, target_uri, query, xml_mapping, destination_path, source_uri, target_uri, query, xml_mapping,
conduit, gpg_key, id_generator, gid_generator, media_type, login, conduit, gpg_key, id_generator, gid_generator, media_type, login,
password): password, activity_enabled):
""" """
We need to create a dictionnary of We need to create a dictionnary of
signatures of documents which belong to the synchronisation signatures of documents which belong to the synchronisation
process process
""" """
self.id = id self.id = id
self.setActivityEnabled(activity_enabled)
self.publication_url = (publication_url) self.publication_url = (publication_url)
self.subscription_url = str(subscription_url) self.subscription_url = str(subscription_url)
self.destination_path = str(destination_path) self.destination_path = str(destination_path)
...@@ -701,6 +702,18 @@ class Subscription(Folder, SyncCode): ...@@ -701,6 +702,18 @@ class Subscription(Folder, SyncCode):
#self.signatures = PersitentMapping() #self.signatures = PersitentMapping()
def getActivityEnabled(self):
"""
return true if we are using activity, false otherwise
"""
return getattr(self, 'activity_enabled', None)
def setActivityEnabled(self, activity_enabled):
"""
set if we are using activity or not
"""
self.activity_enabled = activity_enabled
def getTitle(self): def getTitle(self):
""" """
getter for title getter for title
......
...@@ -206,7 +206,7 @@ class SynchronizationTool( SubscriptionSynchronization, ...@@ -206,7 +206,7 @@ class SynchronizationTool( SubscriptionSynchronization,
xml_mapping, conduit, gpg_key, xml_mapping, conduit, gpg_key,
synchronization_id_generator=None, gid_generator=None, synchronization_id_generator=None, gid_generator=None,
media_type=None, login=None, password=None, media_type=None, login=None, password=None,
RESPONSE=None): RESPONSE=None, activity_enabled=False):
""" """
XXX should be renamed as addSubscription XXX should be renamed as addSubscription
create a new subscription create a new subscription
...@@ -220,7 +220,7 @@ class SynchronizationTool( SubscriptionSynchronization, ...@@ -220,7 +220,7 @@ class SynchronizationTool( SubscriptionSynchronization,
destination_path, source_uri, target_uri, query, destination_path, source_uri, target_uri, query,
xml_mapping, conduit, gpg_key, xml_mapping, conduit, gpg_key,
synchronization_id_generator, gid_generator, media_type, synchronization_id_generator, gid_generator, media_type,
login, password) login, password, activity_enabled)
folder._setObject( new_id, sub ) folder._setObject( new_id, sub )
#if len(self.list_subscriptions) == 0: #if len(self.list_subscriptions) == 0:
# self.list_subscriptions = PersistentMapping() # self.list_subscriptions = PersistentMapping()
...@@ -264,12 +264,13 @@ class SynchronizationTool( SubscriptionSynchronization, ...@@ -264,12 +264,13 @@ class SynchronizationTool( SubscriptionSynchronization,
def manage_editSubscription(self, title, publication_url, subscription_url, def manage_editSubscription(self, title, publication_url, subscription_url,
destination_path, source_uri, target_uri, query, xml_mapping, conduit, destination_path, source_uri, target_uri, query, xml_mapping, conduit,
gpg_key, synchronization_id_generator, gid_generator, media_type=None, gpg_key, synchronization_id_generator, gid_generator, media_type=None,
login='', password='', RESPONSE=None): login='', password='', RESPONSE=None, activity_enabled=False):
""" """
modify a subscription modify a subscription
""" """
sub = self.getSubscription(title) sub = self.getSubscription(title)
sub.setTitle(title) sub.setTitle(title)
sub.setActivityEnabled(activity_enabled)
sub.setPublicationUrl(publication_url) sub.setPublicationUrl(publication_url)
sub.setDestinationPath(destination_path) sub.setDestinationPath(destination_path)
sub.setSourceURI(source_uri) sub.setSourceURI(source_uri)
......
...@@ -47,6 +47,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ...@@ -47,6 +47,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
<input type="text" name="title" value="<dtml-var getTitle>" size="40"/> <input type="text" name="title" value="<dtml-var getTitle>" size="40"/>
</td> </td>
</tr> </tr>
<tr>
<td align="left" valign="top">
<div class="form-label">
Use Activity
</label></div>
</td>
<td align="left" valign="top">
<input type="checkbox" name="activity_enabled" value="1" <dtml-if expr="getActivityEnabled()">CHECKED</dtml-if>>
</td>
</tr>
<tr> <tr>
<td align="left" valign="top"> <td align="left" valign="top">
<div class="form-label"> <div class="form-label">
......
...@@ -43,6 +43,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ...@@ -43,6 +43,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
<input type="text" name="title" size="40" /> <input type="text" name="title" size="40" />
</td> </td>
</tr> </tr>
<tr>
<td align="left" valign="top">
<div class="form-label">
Use Activity
</label></div>
</td>
<td align="left" valign="top">
<input type="checkbox" name="activity_enabled" value="1">
</td>
</tr>
<tr> <tr>
<td align="left" valign="top"> <td align="left" valign="top">
<div class="form-label"> <div class="form-label">
......
...@@ -368,7 +368,8 @@ class TestERP5SyncML(TestERP5SyncMLMixin, ERP5TypeTestCase): ...@@ -368,7 +368,8 @@ class TestERP5SyncML(TestERP5SyncMLMixin, ERP5TypeTestCase):
xml_mapping=self.xml_mapping, xml_mapping=self.xml_mapping,
conduit='ERP5Conduit', conduit='ERP5Conduit',
gpg_key='', gpg_key='',
gid_generator='getId') gid_generator='getId',
activity_enabled=False)
sub = portal_sync.getSubscription(self.sub_id1) sub = portal_sync.getSubscription(self.sub_id1)
self.failUnless(sub is not None) self.failUnless(sub is not None)
...@@ -389,7 +390,8 @@ class TestERP5SyncML(TestERP5SyncMLMixin, ERP5TypeTestCase): ...@@ -389,7 +390,8 @@ class TestERP5SyncML(TestERP5SyncMLMixin, ERP5TypeTestCase):
xml_mapping=self.xml_mapping, xml_mapping=self.xml_mapping,
conduit='ERP5Conduit', conduit='ERP5Conduit',
gpg_key='', gpg_key='',
gid_generator='getId') gid_generator='getId',
activity_enabled=False)
sub = portal_sync.getSubscription(self.sub_id2) sub = portal_sync.getSubscription(self.sub_id2)
self.failUnless(sub is not None) self.failUnless(sub is not None)
...@@ -1334,7 +1336,8 @@ class TestERP5SyncML(TestERP5SyncMLMixin, ERP5TypeTestCase): ...@@ -1334,7 +1336,8 @@ class TestERP5SyncML(TestERP5SyncMLMixin, ERP5TypeTestCase):
xml_mapping='', xml_mapping='',
conduit='ERP5Conduit', conduit='ERP5Conduit',
gpg_key='', gpg_key='',
gid_generator='getId') gid_generator='getId',
activity_enabled=False)
sub = portal_sync.getSubscription(self.sub_id1) sub = portal_sync.getSubscription(self.sub_id1)
self.failUnless(sub is not None) self.failUnless(sub is not None)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment