Commit a144e693 authored by Mayoro Diagne's avatar Mayoro Diagne

2010-07-01 mayoro

* Test if the returned title or portal_type of attachments are not None before proceed

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@36777 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 68a3e52b
......@@ -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
......
<?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>
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
......
667
\ No newline at end of file
665
\ No newline at end of file
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