From 2b0f1e9bdd40ddcf4176454cf1295e17d67f517c Mon Sep 17 00:00:00 2001
From: Vincent Pelletier <vincent@nexedi.com>
Date: Mon, 4 Aug 2014 16:22:07 +0200
Subject: [PATCH] document.erp5.FTPConnector: Add bind address support.

---
 .../document.erp5.FTPConnector.py             |  6 +-
 .../FTPConnector/bind_address_property.xml    | 32 +++++++
 .../erp5_web_service/FTPConnector_view.xml    |  1 +
 .../FTPConnector_view/my_bind_address.xml     | 96 +++++++++++++++++++
 bt5/erp5_web_service/bt/revision              |  2 +-
 5 files changed, 135 insertions(+), 2 deletions(-)
 create mode 100644 bt5/erp5_web_service/PropertySheetTemplateItem/portal_property_sheets/FTPConnector/bind_address_property.xml
 create mode 100644 bt5/erp5_web_service/SkinTemplateItem/portal_skins/erp5_web_service/FTPConnector_view/my_bind_address.xml

diff --git a/bt5/erp5_web_service/DocumentTemplateItem/portal_components/document.erp5.FTPConnector.py b/bt5/erp5_web_service/DocumentTemplateItem/portal_components/document.erp5.FTPConnector.py
index 1c1507a262..2cf65833f8 100644
--- a/bt5/erp5_web_service/DocumentTemplateItem/portal_components/document.erp5.FTPConnector.py
+++ b/bt5/erp5_web_service/DocumentTemplateItem/portal_components/document.erp5.FTPConnector.py
@@ -55,7 +55,11 @@ class FTPConnector(XMLObject):
         password=self.getPassword(),
         url=self.getUrlString(),
         transport=self.getUrlProtocol(),
-        transport_kw={"private_key":self.getDescription(),},)
+        transport_kw={
+          'private_key':self.getDescription(),
+          'bind_address': self.getBindAddress(),
+        },
+      )
     else:
       # XXX Must manage in the future ftp and ftps protocol
       raise NotImplementedError("Protocol %s is not yet implemented" %(self.getUrlProtocol(),))
diff --git a/bt5/erp5_web_service/PropertySheetTemplateItem/portal_property_sheets/FTPConnector/bind_address_property.xml b/bt5/erp5_web_service/PropertySheetTemplateItem/portal_property_sheets/FTPConnector/bind_address_property.xml
new file mode 100644
index 0000000000..51128ff078
--- /dev/null
+++ b/bt5/erp5_web_service/PropertySheetTemplateItem/portal_property_sheets/FTPConnector/bind_address_property.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <global name="Standard Property" module="erp5.portal_type"/>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>categories</string> </key>
+            <value>
+              <tuple>
+                <string>elementary_type/string</string>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>description</string> </key>
+            <value> <string>Local address to bind client connection to.</string> </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>bind_address_property</string> </value>
+        </item>
+        <item>
+            <key> <string>portal_type</string> </key>
+            <value> <string>Standard Property</string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/bt5/erp5_web_service/SkinTemplateItem/portal_skins/erp5_web_service/FTPConnector_view.xml b/bt5/erp5_web_service/SkinTemplateItem/portal_skins/erp5_web_service/FTPConnector_view.xml
index 4759901a8b..46c6703b63 100644
--- a/bt5/erp5_web_service/SkinTemplateItem/portal_skins/erp5_web_service/FTPConnector_view.xml
+++ b/bt5/erp5_web_service/SkinTemplateItem/portal_skins/erp5_web_service/FTPConnector_view.xml
@@ -107,6 +107,7 @@
                     <value>
                       <list>
                         <string>my_url_string</string>
+                        <string>my_bind_address</string>
                         <string>my_url_protocol</string>
                         <string>my_translated_validation_state_title</string>
                       </list>
diff --git a/bt5/erp5_web_service/SkinTemplateItem/portal_skins/erp5_web_service/FTPConnector_view/my_bind_address.xml b/bt5/erp5_web_service/SkinTemplateItem/portal_skins/erp5_web_service/FTPConnector_view/my_bind_address.xml
new file mode 100644
index 0000000000..777af1e58f
--- /dev/null
+++ b/bt5/erp5_web_service/SkinTemplateItem/portal_skins/erp5_web_service/FTPConnector_view/my_bind_address.xml
@@ -0,0 +1,96 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>delegated_list</string> </key>
+            <value>
+              <list>
+                <string>title</string>
+              </list>
+            </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>my_bind_address</string> </value>
+        </item>
+        <item>
+            <key> <string>message_values</string> </key>
+            <value>
+              <dictionary>
+                <item>
+                    <key> <string>external_validator_failed</string> </key>
+                    <value> <string>The input failed the external validator.</string> </value>
+                </item>
+              </dictionary>
+            </value>
+        </item>
+        <item>
+            <key> <string>overrides</string> </key>
+            <value>
+              <dictionary>
+                <item>
+                    <key> <string>field_id</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>form_id</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>target</string> </key>
+                    <value> <string></string> </value>
+                </item>
+              </dictionary>
+            </value>
+        </item>
+        <item>
+            <key> <string>tales</string> </key>
+            <value>
+              <dictionary>
+                <item>
+                    <key> <string>field_id</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>form_id</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>target</string> </key>
+                    <value> <string></string> </value>
+                </item>
+              </dictionary>
+            </value>
+        </item>
+        <item>
+            <key> <string>values</string> </key>
+            <value>
+              <dictionary>
+                <item>
+                    <key> <string>field_id</string> </key>
+                    <value> <string>my_string_field</string> </value>
+                </item>
+                <item>
+                    <key> <string>form_id</string> </key>
+                    <value> <string>Base_viewFieldLibrary</string> </value>
+                </item>
+                <item>
+                    <key> <string>target</string> </key>
+                    <value> <string>Click to edit the target</string> </value>
+                </item>
+                <item>
+                    <key> <string>title</string> </key>
+                    <value> <string>Bind Address</string> </value>
+                </item>
+              </dictionary>
+            </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/bt5/erp5_web_service/bt/revision b/bt5/erp5_web_service/bt/revision
index c7930257df..f11c82a4cb 100644
--- a/bt5/erp5_web_service/bt/revision
+++ b/bt5/erp5_web_service/bt/revision
@@ -1 +1 @@
-7
\ No newline at end of file
+9
\ No newline at end of file
-- 
2.30.9