Commit e3f4af0f authored by Sebastien Robin's avatar Sebastien Robin

we can set id_generator and gid_generator into the user interface


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@1866 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 31d9605f
......@@ -833,7 +833,7 @@ class Subscription(Folder, SyncCode):
This set the method name wich allows to find a gid
from any object
"""
if method in (None,''):
if method in (None,'','None'):
method = 'getId'
self.gid_generator = method
......@@ -927,7 +927,7 @@ class Subscription(Folder, SyncCode):
o_base = aq_base(object)
new_id = None
if callable(id_generator):
new_id = id_generator(object)
new_id = id_generator(object,gid=gid)
elif hasattr(o_base, id_generator):
generator = getattr(object, id_generator)
new_id = generator()
......@@ -940,6 +940,8 @@ class Subscription(Folder, SyncCode):
This set the method name wich allows to generate
a new id
"""
if method in ('','None'):
method = None
self.id_generator = method
def getIdGenerator(self):
......
......@@ -202,7 +202,8 @@ class SynchronizationTool( SubscriptionSynchronization, PublicationSynchronizati
security.declareProtected(Permissions.ModifyPortalContent, 'manage_editPublication')
def manage_editPublication(self, title, publication_url, destination_path,
query, xml_mapping, conduit, gpg_key, RESPONSE=None):
query, xml_mapping, conduit, gpg_key, id_generator,
gid_generator, RESPONSE=None):
"""
modify a publication
"""
......@@ -214,12 +215,15 @@ class SynchronizationTool( SubscriptionSynchronization, PublicationSynchronizati
pub.setConduit(conduit)
pub.setXMLMapping(xml_mapping)
pub.setGPGKey(gpg_key)
pub.setIdGenerator(id_generator)
pub.setGidGenerator(gid_generator)
if RESPONSE is not None:
RESPONSE.redirect('managePublications')
security.declareProtected(Permissions.ModifyPortalContent, 'manage_editSubscription')
def manage_editSubscription(self, title, publication_url, subscription_url,
destination_path, query, xml_mapping, conduit, gpg_key, RESPONSE=None):
destination_path, query, xml_mapping, conduit, gpg_key, id_generator,
gid_generator, RESPONSE=None):
"""
modify a subscription
"""
......@@ -232,6 +236,8 @@ class SynchronizationTool( SubscriptionSynchronization, PublicationSynchronizati
sub.setXMLMapping(xml_mapping)
sub.setGPGKey(gpg_key)
sub.setSubscriptionUrl(subscription_url)
sub.setIdGenerator(id_generator)
sub.setGidGenerator(gid_generator)
if RESPONSE is not None:
RESPONSE.redirect('manageSubscriptions')
......
......@@ -769,7 +769,7 @@ class XMLSyncUtilsMixin(SyncCode):
if next_action.nodeName == 'Add':
# Then store the xml of this new subobject
if object is None:
object_id = domain.generateNewIdWithGenerator(object=destination_path)
object_id = domain.generateNewIdWithGenerator(object=destination_path,gid=object_gid)
conflict_list += conduit.addNode(xml=data_subnode, object=destination_path,
object_id=object_id)
object = domain.getObjectFromGid(object_gid)
......
......@@ -107,6 +107,26 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
<input type="text" name="gpg_key" value="<dtml-var getGPGKey>" size="40" />
</td>
</tr>
<tr>
<td align="left" valign="top">
<div class="form-label">
Id Generator
</label></div>
</td>
<td align="left" valign="top">
<input type="text" name="id_generator" value="<dtml-var getIdGenerator>" size="40" />
</td>
</tr>
<tr>
<td align="left" valign="top">
<div class="form-label">
Gid Generator
</label></div>
</td>
<td align="left" valign="top">
<input type="text" name="gid_generator" value="<dtml-var getGidGenerator>" size="40" />
</td>
</tr>
</table>
<table>
<tr>
......
......@@ -117,6 +117,26 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
<input type="text" name="gpg_key" value="<dtml-var getGPGKey>" size="40" />
</td>
</tr>
<tr>
<td align="left" valign="top">
<div class="form-label">
Id Generator
</label></div>
</td>
<td align="left" valign="top">
<input type="text" name="id_generator" value="<dtml-var getIdGenerator>" size="40" />
</td>
</tr>
<tr>
<td align="left" valign="top">
<div class="form-label">
Gid Generator
</label></div>
</td>
<td align="left" valign="top">
<input type="text" name="gid_generator" value="<dtml-var getGidGenerator>" size="40" />
</td>
</tr>
</table>
<table>
<tr>
......
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