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

Conversion for PdfDocument

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@9754 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 938d4bac
...@@ -74,14 +74,18 @@ ...@@ -74,14 +74,18 @@
# ref arg is a tuple\n # ref arg is a tuple\n
# ref[0] is a complete reference string\n # ref[0] is a complete reference string\n
# ref[1] is a dict of values from parsed reference string\n # ref[1] is a dict of values from parsed reference string\n
\n context.log(script.getId(),ref)\n
reference=ref[1][\'reference\']\n reference=ref[1][\'reference\']\n
res=context.portal_catalog(reference=reference)\n res=context.portal_catalog(reference=reference,portal_type=context.getPortalDocumentTypeList())\n
res=[r.getObject() for r in res]\n res=[r.getObject() for r in res]\n
context.log(\'res\',res)\n
lng=ref[1].get(\'language\')\n lng=ref[1].get(\'language\')\n
context.log(\'lng\',lng)\n
if lng is not None:\n if lng is not None:\n
res=filter(lambda o:o.getLanguage()==lng,res)\n res=filter(lambda o:o.getLanguage()==lng,res)\n
context.log(\'res\',res)\n
res.sort(key=lambda o:o.getVersion(),reverse=True)\n res.sort(key=lambda o:o.getVersion(),reverse=True)\n
context.log(\'res\',res)\n
return res\n return res\n
</string> </value> </string> </value>
</item> </item>
...@@ -126,10 +130,11 @@ return res\n ...@@ -126,10 +130,11 @@ return res\n
<value> <value>
<tuple> <tuple>
<string>ref</string> <string>ref</string>
<string>_getitem_</string>
<string>reference</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>script</string>
<string>_getitem_</string>
<string>reference</string>
<string>res</string> <string>res</string>
<string>append</string> <string>append</string>
<string>$append0</string> <string>$append0</string>
......
...@@ -72,6 +72,7 @@ ...@@ -72,6 +72,7 @@
# we can return raw set, the class will get objects and make the records unique\n # we can return raw set, the class will get objects and make the records unique\n
# if you want only the most recent versions, filter the result and apply DMS_findDocument \n # if you want only the most recent versions, filter the result and apply DMS_findDocument \n
ss=[]\n ss=[]\n
context.log(script.getId(),\'running\')\n
ss.append(context.getReference())\n ss.append(context.getReference())\n
if context.getLanguage() is not None:\n if context.getLanguage() is not None:\n
ss.append(context.getReference()+\'-\'+context.getLanguage())\n ss.append(context.getReference()+\'-\'+context.getLanguage())\n
...@@ -128,6 +129,7 @@ return lst\n ...@@ -128,6 +129,7 @@ return lst\n
<string>ss</string> <string>ss</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>script</string>
<string>None</string> <string>None</string>
<string>lst</string> <string>lst</string>
<string>_getiter_</string> <string>_getiter_</string>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.PythonScripts.PythonScript</string>
<string>PythonScript</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Python_magic</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<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>
<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>request=context.REQUEST\n
fname=request.get(\'filename\')\n
format=request.get(\'format\')\n
context.log(\'format\',format)\n
if fname is None or format is None:\n
return\n
if not fname.endswith(\'.zip\'):\n
fname+=\'.zip\'\n
request.RESPONSE.setHeader(\'Content-type\', \'application/zip\')\n
request.RESPONSE.setHeader(\'Content-disposition\', \'attachment;; filename="%s"\' % fname)\n
return context.getTargetFile(format=format)[1]\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_filepath</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>**kw</string> </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>0</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>kw</string>
<string>_getattr_</string>
<string>context</string>
<string>request</string>
<string>fname</string>
<string>format</string>
<string>None</string>
<string>_getitem_</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>PdfDocument_getTargetFile</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</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>PdfDocument_getTargetFile</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>
</list>
</value>
</item>
<item>
<key> <string>groups</string> </key>
<value>
<dictionary>
<item>
<key> <string>left</string> </key>
<value>
<list>
<string>my_format</string>
<string>my_filename</string>
</list>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>PdfDocument_viewTargetFileDialog</string> </value>
</item>
<item>
<key> <string>method</string> </key>
<value> <string>POST</string> </value>
</item>
<item>
<key> <string>name</string> </key>
<value> <string>PdfDocument_viewTargetFileDialog</string> </value>
</item>
<item>
<key> <string>pt</string> </key>
<value> <string>form_dialog</string> </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>Download Target File</string> </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>
2006-09-07
Conversion for PdfDocument
2006-09-05 BG 2006-09-05 BG
Extended search functions (requires SQLCatalog patch) Extended search functions (requires SQLCatalog patch)
......
127 131
\ No newline at end of file \ No newline at end of file
0.71 0.72
\ No newline at end of file \ 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