Commit c8b8bf09 authored by Bartek Górny's avatar Bartek Górny

2006-07-27

Type checking upon upload using content_type_registry

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@8878 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 9fbdee6d
......@@ -30,6 +30,12 @@
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>_owner</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_tree</string> </key>
<value>
......@@ -41,11 +47,104 @@
<value> <string>python: []</string> </value>
</item>
<item>
<key> <string>categories</string> </key>
<key> <string>creation_date</string> </key>
<value>
<object>
<klass>
<global id="1.1" name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<string>publication_section</string>
<none/>
</tuple>
<state>
<dictionary>
<item>
<key> <string>_aday</string> </key>
<value> <string>Sun</string> </value>
</item>
<item>
<key> <string>_amon</string> </key>
<value> <string>Dec</string> </value>
</item>
<item>
<key> <string>_d</string> </key>
<value> <float>38323.8602553</float> </value>
</item>
<item>
<key> <string>_day</string> </key>
<value> <int>4</int> </value>
</item>
<item>
<key> <string>_dayoffset</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>_fday</string> </key>
<value> <string>Sunday</string> </value>
</item>
<item>
<key> <string>_fmon</string> </key>
<value> <string>December</string> </value>
</item>
<item>
<key> <string>_hour</string> </key>
<value> <int>21</int> </value>
</item>
<item>
<key> <string>_millis</string> </key>
<value> <long>1133728726060</long> </value>
</item>
<item>
<key> <string>_minute</string> </key>
<value> <int>38</int> </value>
</item>
<item>
<key> <string>_month</string> </key>
<value> <int>12</int> </value>
</item>
<item>
<key> <string>_nearsec</string> </key>
<value> <float>46.0</float> </value>
</item>
<item>
<key> <string>_pday</string> </key>
<value> <string>Sun.</string> </value>
</item>
<item>
<key> <string>_pm</string> </key>
<value> <string>pm</string> </value>
</item>
<item>
<key> <string>_pmhour</string> </key>
<value> <int>9</int> </value>
</item>
<item>
<key> <string>_pmon</string> </key>
<value> <string>Dec.</string> </value>
</item>
<item>
<key> <string>_second</string> </key>
<value> <float>46.06</float> </value>
</item>
<item>
<key> <string>_t</string> </key>
<value> <float>1133728726.06</float> </value>
</item>
<item>
<key> <string>_tz</string> </key>
<value> <string>GMT+1</string> </value>
</item>
<item>
<key> <string>_year</string> </key>
<value> <int>2005</int> </value>
</item>
<item>
<key> <string>time</string> </key>
<value> <float>0.860255324071</float> </value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
......@@ -62,13 +161,112 @@
<key> <string>last_id</string> </key>
<value> <string>1</string> </value>
</item>
<item>
<key> <string>modification_date</string> </key>
<value>
<object>
<klass> <reference id="1.1"/> </klass>
<tuple>
<none/>
</tuple>
<state>
<dictionary>
<item>
<key> <string>_aday</string> </key>
<value> <string>Sun</string> </value>
</item>
<item>
<key> <string>_amon</string> </key>
<value> <string>Dec</string> </value>
</item>
<item>
<key> <string>_d</string> </key>
<value> <float>38323.8604503</float> </value>
</item>
<item>
<key> <string>_day</string> </key>
<value> <int>4</int> </value>
</item>
<item>
<key> <string>_dayoffset</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>_fday</string> </key>
<value> <string>Sunday</string> </value>
</item>
<item>
<key> <string>_fmon</string> </key>
<value> <string>December</string> </value>
</item>
<item>
<key> <string>_hour</string> </key>
<value> <int>21</int> </value>
</item>
<item>
<key> <string>_millis</string> </key>
<value> <long>1133728742906</long> </value>
</item>
<item>
<key> <string>_minute</string> </key>
<value> <int>39</int> </value>
</item>
<item>
<key> <string>_month</string> </key>
<value> <int>12</int> </value>
</item>
<item>
<key> <string>_nearsec</string> </key>
<value> <float>2.0</float> </value>
</item>
<item>
<key> <string>_pday</string> </key>
<value> <string>Sun.</string> </value>
</item>
<item>
<key> <string>_pm</string> </key>
<value> <string>pm</string> </value>
</item>
<item>
<key> <string>_pmhour</string> </key>
<value> <int>9</int> </value>
</item>
<item>
<key> <string>_pmon</string> </key>
<value> <string>Dec.</string> </value>
</item>
<item>
<key> <string>_second</string> </key>
<value> <float>2.906</float> </value>
</item>
<item>
<key> <string>_t</string> </key>
<value> <float>1133728742.91</float> </value>
</item>
<item>
<key> <string>_tz</string> </key>
<value> <string>GMT+1</string> </value>
</item>
<item>
<key> <string>_year</string> </key>
<value> <int>2005</int> </value>
</item>
<item>
<key> <string>time</string> </key>
<value> <float>0.860450300926</float> </value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Base Category</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Publication Section</string> </value>
<value> <string>Publication Sections</string> </value>
</item>
<item>
<key> <string>uid</string> </key>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.ERP5Type.Document.BaseCategory</string>
<string>BaseCategory</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__ac_local_roles__</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_count</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>_mt_index</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>_owner</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_tree</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>acquisition_portal_type</string> </key>
<value> <string>python: []</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>classification</string> </value>
</item>
<item>
<key> <string>last_id</string> </key>
<value> <string>1</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Base Category</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Security Classification</string> </value>
</item>
<item>
<key> <string>uid</string> </key>
<value>
<none/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<tuple>
<tuple>
<string>BTrees.Length</string>
<string>Length</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle> <int>0</int> </pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<tuple>
<tuple>
<string>BTrees.OOBTree</string>
<string>OOBTree</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<none/>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<tuple>
<tuple>
<string>BTrees.OOBTree</string>
<string>OOBTree</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<none/>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.ERP5Form.Form</string>
<string>ERP5Form</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__ac_local_roles__</string> </key>
<value>
<none/>
</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/>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>action</string> </key>
<value> <string>Base_doSelect</string> </value>
</item>
<item>
<key> <string>encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>enctype</string> </key>
<value> <string>multipart/form-data</string> </value>
</item>
<item>
<key> <string>group_list</string> </key>
<value>
<list>
<string>left</string>
<string>right</string>
<string>center</string>
<string>bottom</string>
</list>
</value>
</item>
<item>
<key> <string>groups</string> </key>
<value>
<dictionary>
<item>
<key> <string>bottom</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>center</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>left</string> </key>
<value>
<list>
<string>listbox</string>
</list>
</value>
</item>
<item>
<key> <string>right</string> </key>
<value>
<list/>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ImageModule_viewImageList</string> </value>
</item>
<item>
<key> <string>method</string> </key>
<value> <string>POST</string> </value>
</item>
<item>
<key> <string>name</string> </key>
<value> <string>ImageModule_viewImageList</string> </value>
</item>
<item>
<key> <string>pt</string> </key>
<value> <string>form_list</string> </value>
</item>
<item>
<key> <string>rid</string> </key>
<value> <int>-1722436574</int> </value>
</item>
<item>
<key> <string>row_length</string> </key>
<value> <int>4</int> </value>
</item>
<item>
<key> <string>stored_encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Image List</string> </value>
</item>
<item>
<key> <string>uid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>unicode_mode</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>update_action</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -119,8 +119,8 @@
<key> <string>right</string> </key>
<value>
<list>
<string>my_classification</string>
<string>my_source_project_title</string>
<string>my_classification</string>
<string>my_publication_section</string>
<string>my_function</string>
<string>my_group</string>
......
......@@ -93,6 +93,13 @@ if f is not None and f:\n
# if file uploaded, then:\n
ob.log(\'file\',f)\n
fname=f.filename\n
# we check for appropriate file type (by extension, using content_type_registry)\n
ctype=context.content_type_registry.findTypeName(fname,None,None)\n
context.log(context.getPortalType(),ctype)\n
if ctype is None:\n
raise Exception(\'File type of \'+fname+\' is not registered\')\n
if ctype!=ob.getPortalType():\n
raise Exception(\'This file should be created as \'+ctype)\n
ob.setOriginalFilename(fname)\n
ob.setTitle(fname)\n
ob.setLastUploadTime(DateTime())\n
......@@ -153,6 +160,9 @@ if f is not None and f:\n
<string>_getitem_</string>
<string>_write_</string>
<string>fname</string>
<string>context</string>
<string>ctype</string>
<string>Exception</string>
<string>DateTime</string>
</tuple>
</value>
......
2006-07-27
Type checking upon upload using content_type_registry
2006-07-26 BG
Cleaned redundant paths; removed wiki; removed redundant portal_types; removed predecessor base_cat (overlaps with erp5_project); completed content_type_registry; tidied up roles and actions in all types; implemented Graphic support.
......
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