[Erp5-report] r36777 mayoro - in /erp5/trunk/bt5/erp5_egov: SkinTemplateItem/portal_skins/e...

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Jul 1 14:50:47 CEST 2010


Author: mayoro
Date: Thu Jul  1 14:50:45 2010
New Revision: 36777

URL: http://svn.erp5.org?rev=36777&view=rev
Log:
2010-07-01 mayoro
* Test if the returned title or portal_type of attachments are not None before proceed

Added:
    erp5/trunk/bt5/erp5_egov/SkinTemplateItem/portal_skins/erp5_egov/PDF_checkConversionFormatPermission.xml
Modified:
    erp5/trunk/bt5/erp5_egov/SkinTemplateItem/portal_skins/erp5_egov/PDFDocument_uploadAttachment.xml
    erp5/trunk/bt5/erp5_egov/bt/change_log
    erp5/trunk/bt5/erp5_egov/bt/revision

Modified: erp5/trunk/bt5/erp5_egov/SkinTemplateItem/portal_skins/erp5_egov/PDFDocument_uploadAttachment.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_egov/SkinTemplateItem/portal_skins/erp5_egov/PDFDocument_uploadAttachment.xml?rev=36777&r1=36776&r2=36777&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_egov/SkinTemplateItem/portal_skins/erp5_egov/PDFDocument_uploadAttachment.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_egov/SkinTemplateItem/portal_skins/erp5_egov/PDFDocument_uploadAttachment.xml [utf8] Thu Jul  1 14:50:45 2010
@@ -80,7 +80,7 @@ if mode == \'edit\':\n
   for i in range(len(attachment_list)+1)[1:]:\n
     type = getattr(context.getTypeInfo(), "getAttachmentModel%s" % i, None)\n
     title = getattr(context.getTypeInfo(), "getAttachmentTitle%s" % i, None) \n
-    if title is not None and type is not None:\n
+    if title is not None and title() is not None and type is not None and type() is not None:\n
       type_object = context.restrictedTraverse(context.getPortalObject().getUrl()+"/portal_types/"+type())\n
       type_dict[title()] =  type_object.getId()\n
       if type_object.getId() not in type_allowed_content_type_list: \n

Added: erp5/trunk/bt5/erp5_egov/SkinTemplateItem/portal_skins/erp5_egov/PDF_checkConversionFormatPermission.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_egov/SkinTemplateItem/portal_skins/erp5_egov/PDF_checkConversionFormatPermission.xml?rev=36777&view=auto
==============================================================================
--- erp5/trunk/bt5/erp5_egov/SkinTemplateItem/portal_skins/erp5_egov/PDF_checkConversionFormatPermission.xml (added)
+++ erp5/trunk/bt5/erp5_egov/SkinTemplateItem/portal_skins/erp5_egov/PDF_checkConversionFormatPermission.xml [utf8] Thu Jul  1 14:50:45 2010
@@ -0,0 +1,170 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <tuple>
+        <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
+        <tuple/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>Script_magic</string> </key>
+            <value> <int>3</int> </value>
+        </item>
+        <item>
+            <key> <string>_bind_names</string> </key>
+            <value>
+              <object>
+                <klass>
+                  <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
+                </klass>
+                <tuple/>
+                <state>
+                  <dictionary>
+                    <item>
+                        <key> <string>_asgns</string> </key>
+                        <value>
+                          <dictionary>
+                            <item>
+                                <key> <string>name_container</string> </key>
+                                <value> <string>container</string> </value>
+                            </item>
+                            <item>
+                                <key> <string>name_context</string> </key>
+                                <value> <string>context</string> </value>
+                            </item>
+                            <item>
+                                <key> <string>name_m_self</string> </key>
+                                <value> <string>script</string> </value>
+                            </item>
+                            <item>
+                                <key> <string>name_subpath</string> </key>
+                                <value> <string>traverse_subpath</string> </value>
+                            </item>
+                          </dictionary>
+                        </value>
+                    </item>
+                  </dictionary>
+                </state>
+              </object>
+            </value>
+        </item>
+        <item>
+            <key> <string>_body</string> </key>
+            <value> <string encoding="cdata"><![CDATA[
+
+from Products.ERP5.Document.Document import VALID_IMAGE_FORMAT_LIST\n
+\n
+if format in VALID_IMAGE_FORMAT_LIST:\n
+  # Check if PDF size is not too large for conversion tool\n
+  content_information = context.getContentInformation()\n
+  size = content_information.get(\'Page size\')\n
+  if not size:\n
+    # If we can not extract the size,\n
+    # We do not take any risk and disallow conversion\n
+    return False\n
+\n
+  width = float(size.split(\' \')[0])\n
+  height = float(size.split(\' \')[2])\n
+  # The default resolution is 72 dots per inch,\n
+  # which is equivalent to one point per pixel (Macintosh and Postscript standard)\n
+\n
+  # Max surface allowed to convert an image,\n
+  # value is surface of A3 (11.7 inchs * 72 dpi * 16.5 inchs * 72 dpi)\n
+  maximum_surface = 1000772\n
+\n
+  if (width * height) > maximum_surface:\n
+    return False\n
+\n
+return True\n
+
+
+]]></string> </value>
+        </item>
+        <item>
+            <key> <string>_code</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>_params</string> </key>
+            <value> <string>format, **kw</string> </value>
+        </item>
+        <item>
+            <key> <string>_proxy_roles</string> </key>
+            <value>
+              <tuple>
+                <string>Manager</string>
+              </tuple>
+            </value>
+        </item>
+        <item>
+            <key> <string>errors</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+        <item>
+            <key> <string>func_code</string> </key>
+            <value>
+              <object>
+                <klass>
+                  <global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
+                </klass>
+                <tuple/>
+                <state>
+                  <dictionary>
+                    <item>
+                        <key> <string>co_argcount</string> </key>
+                        <value> <int>1</int> </value>
+                    </item>
+                    <item>
+                        <key> <string>co_varnames</string> </key>
+                        <value>
+                          <tuple>
+                            <string>format</string>
+                            <string>kw</string>
+                            <string>Products.ERP5.Document.Document</string>
+                            <string>VALID_IMAGE_FORMAT_LIST</string>
+                            <string>_getattr_</string>
+                            <string>context</string>
+                            <string>content_information</string>
+                            <string>size</string>
+                            <string>False</string>
+                            <string>float</string>
+                            <string>_getitem_</string>
+                            <string>width</string>
+                            <string>height</string>
+                            <string>maximum_surface</string>
+                            <string>True</string>
+                          </tuple>
+                        </value>
+                    </item>
+                  </dictionary>
+                </state>
+              </object>
+            </value>
+        </item>
+        <item>
+            <key> <string>func_defaults</string> </key>
+            <value>
+              <none/>
+            </value>
+        </item>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>PDF_checkConversionFormatPermission</string> </value>
+        </item>
+        <item>
+            <key> <string>warnings</string> </key>
+            <value>
+              <tuple/>
+            </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>

Modified: erp5/trunk/bt5/erp5_egov/bt/change_log
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_egov/bt/change_log?rev=36777&r1=36776&r2=36777&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_egov/bt/change_log [utf8] (original)
+++ erp5/trunk/bt5/erp5_egov/bt/change_log [utf8] Thu Jul  1 14:50:45 2010
@@ -1,11 +1,5 @@
-2010-06-30 mohamadou
-* test if user has access to a module before displaying it.
-
-2010-06-30 mohamadou
-* Add role information in EGov Type
-
-2010-06-30 mohamadou
-* clean EGov_security Extension
+2010-07-01 mayoro
+* Test if the returned title or portal_type of attachments are not None before proceed
 
 2010-06-29 mohamadou
 * Add erp5_egov_security skin folder

Modified: erp5/trunk/bt5/erp5_egov/bt/revision
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_egov/bt/revision?rev=36777&r1=36776&r2=36777&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_egov/bt/revision [utf8] (original)
+++ erp5/trunk/bt5/erp5_egov/bt/revision [utf8] Thu Jul  1 14:50:45 2010
@@ -1 +1 @@
-667
\ No newline at end of file
+665
\ No newline at end of file




More information about the Erp5-report mailing list