From 41dc4d94111638ed5bf59aec5fb486066b1e3d40 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Aur=C3=A9lien=20Calonne?= <aurel@nexedi.com>
Date: Fri, 3 Mar 2006 15:56:05 +0000
Subject: [PATCH] remove inherintance from XMLOBject as it is get by Folder one
 add viewImage method to render image add importSignature method

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@5957 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/Document/Agent.py | 33 ++++++++++++++++++++++++++++++++-
 1 file changed, 32 insertions(+), 1 deletion(-)

diff --git a/product/ERP5/Document/Agent.py b/product/ERP5/Document/Agent.py
index 791062e078..9bd7ab08ae 100755
--- a/product/ERP5/Document/Agent.py
+++ b/product/ERP5/Document/Agent.py
@@ -34,7 +34,7 @@ from Products.ERP5Type.XMLObject import XMLObject
 from Products.ERP5Type.Document.Folder import Folder
 
 
-class Agent(Folder, Image, XMLObject):
+class Agent(Folder, Image):
   """
     An Agent is a Person who is permitted to perform some actions on the bank account according to Privileges.
   """
@@ -56,3 +56,34 @@ class Agent(Folder, Image, XMLObject):
                     , PropertySheet.Task
                     , PropertySheet.Agent
                     )
+
+
+  def __init__(self, *args, **kw):
+    Folder.__init__(self, *args, **kw)
+    Image.__init__(self, *args, **kw)
+
+  security.declareProtected(Permissions.AccessContentsInformation, 'viewImage')
+  viewImage = Image.index_html
+  
+  def importSignature(self, import_file=None, form_id=None, REQUEST=None, **kw):
+
+    if REQUEST is None:
+      REQUEST = getattr(self, 'REQUEST', None)
+        
+    if (import_file is None) or (len(import_file.read()) == 0) :
+      if REQUEST is not None :
+        REQUEST.RESPONSE.redirect("%s?portal_status_message=No+file+or+an+empty+file+was+specified"
+                                  % self.absolute_url())
+        return
+      else :
+        raise RuntimeError, 'No file or an empty file was specified'
+
+    import_file.seek(0)
+    self.manage_editPhoto(file=import_file)
+    #    self._data = import_file.read()
+
+    if REQUEST is not None:
+      ret_url = self.absolute_url() + '/' + REQUEST.get('form_id', 'view')
+      REQUEST.RESPONSE.redirect("%s?portal_status_message=Signature+Imported+Successfully"
+                                % ret_url)
+
-- 
2.30.9