Commit 8d634e0f authored by Jérome Perrin's avatar Jérome Perrin

Fix run_my_doc coding style

Enable coding style on erp5_run_my_doc since it now gets installed with erp5_officejs

See merge request !1325
parents fbb90c1a 647f746d
......@@ -77,7 +77,7 @@
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/TestPageModule_viewCreationWizard</string> </value>
<value> <string>string:${object_url}/TestPageModule_viewCreationWizardDialog</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -75,7 +75,7 @@
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/TestPage_viewExportTestReport</string> </value>
<value> <string>string:${object_url}/TestPage_viewExportTestReportDialog</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -79,7 +79,7 @@
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string: ${object_url}/TestPage_viewRunSeleniumTest</string> </value>
<value> <string>string: ${object_url}/TestPage_viewRunSeleniumTestDialog</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -75,7 +75,7 @@
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/TestPage_viewUpdateReport</string> </value>
<value> <string>string:${object_url}/TestPage_viewUpdateReportDialog</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -75,7 +75,7 @@
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/TestPage_viewSlideShowWithGadget</string> </value>
<value> <string>string:${object_url}/TestPage_viewSlideShowWithGadgetDialog</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -77,7 +77,7 @@
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/TestPageModule_viewCreationWizard</string> </value>
<value> <string>string:${object_url}/TestPageModule_viewCreationWizardDialog</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -54,7 +54,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5RunMyDocs_acquireSession</string> </value>
<value> <string>ERP5Site_acquireRunMyDocsSession</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -42,7 +42,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5RunMyDocs_initTest</string> </value>
<value> <string>ERP5Site_initRunMyDocsTest</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
......
......@@ -13,10 +13,10 @@
</tr>
<tr>
<td style="vertical-align:middle;text-align:right;">
<a href="./test_page_module/TestPageModule_viewCreationWizard"><span style="background-repeat: no-repeat; display: block; height: 22px; width: 22px;background-image:url('launch_icon.png');"></span></a>
<a href="./test_page_module/TestPageModule_viewCreationWizardDialog"><span style="background-repeat: no-repeat; display: block; height: 22px; width: 22px;background-image:url('launch_icon.png');"></span></a>
</td>
<td style="vertical-align:middle;text-align:left;">
<a href="./test_page_module/TestPageModule_viewCreationWizard">I would like to create a new Test Page.</a>
<a href="./test_page_module/TestPageModule_viewCreationWizardDialog">I would like to create a new Test Page.</a>
</td>
</tr>
</tbody>
......
annotation_list = context.getAnnotation().split('\n');
annotation_list = context.getAnnotation().split('\n')
user_name = context.getPortalObject().portal_membership.getAuthenticatedMember().getId()
for uid in listbox_uid:
i = int(uid)
old_comment, locator, context_url, author, color = annotation_list[i][1:-1].split("},{");
old_comment, locator, context_url, author, color = annotation_list[i][1:-1].split("},{")
new_comment = context.REQUEST['field_listbox_title_' + uid]
#print('Old title: ' + old_comment + ' -> ' + new_comment)
if old_comment != new_comment:
......
......@@ -2,7 +2,7 @@
Fetches Commentaries to display them in a listbox
"""
from Products.ERP5Type.Document import newTempBase
annotation_list = context.getAnnotation().split('\n');
annotation_list = context.getAnnotation().split('\n')
element_list = []
relative_url = context.getRelativeUrl()
......@@ -27,6 +27,7 @@ if len(annotation_list) > 0 and annotation_list[0] != "":
counter += 1
for sorted_element in sort_on:
# pylint:disable=cell-var-from-loop
element_list = sorted(element_list, key = lambda x: x.getProperty(sorted_element[0]), reverse = sorted_element[1] == 'descending')
return element_list
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>sort_on = [], **kw</string> </value>
<value> <string>sort_on=(), **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
......@@ -23,8 +23,9 @@ for uid in uids:
contributor_list = obj.getContributorList())
conv_obj = conv_obj.manage_pasteObjects(
obj.manage_copyObjects(
map(lambda x: x.getId(), obj.objectValues())))
obj.manage_copyObjects(list(obj.objectIds())))
return conv_obj_module.Base_redirect('',
dict(portal_status_message=context.Base_translateString(str(counter) + " object(s) converted.")))
dict(portal_status_message=context.Base_translateString(
"${document_count} documents converted.",
mapping={'document_count': counter})))
# pylint:disable=redefined-builtin
"""
Adds a chapter in the listbox, and upload an image if necessary (it doesn't generate the html code corresponding to the text)
"""
from Products.ERP5Type.Document import newTempBase
translateString = context.Base_translateString
portal_status_message = ""
if image_caption in [None, ""]:
image_caption = chapter_title
session = context.ERP5RunMyDocs_acquireSession()
session = context.ERP5Site_acquireRunMyDocsSession()
if session.has_key('listbox') and len(session['listbox']) > 0:
listbox = session['listbox']
int_index = listbox[-1].int_index + 1
......@@ -29,7 +29,7 @@ if slide_type in ['Illustration', 'Screenshot']:
image_id = image_url
else:
image_id = test_page.TestPage_getNextImageID(chapter_title, slide_type)
image = test_page.TestPage_uploadImage(image_id, file, batch_mode=True, image_caption=image_caption)
test_page.TestPage_uploadImage(image_id, file, batch_mode=True, image_caption=image_caption)
listbox.append(newTempBase(context.getPortalObject(),
'',
......@@ -46,5 +46,5 @@ listbox.append(newTempBase(context.getPortalObject(),
))
session['listbox'] = listbox
return context.Base_redirect('TestPageModule_viewChapterCreationWizard',
return context.Base_redirect('TestPageModule_viewChapterCreationWizardDialog',
keep_items = dict(portal_status_message=portal_status_message))
......@@ -15,7 +15,7 @@ portal_status_message = translateString("%s created. You can now add your first
page = context.newContent(portal_type=portal_type,
title = title)
session = context.ERP5RunMyDocs_acquireSession()
session = context.ERP5Site_acquireRunMyDocsSession()
session['title'] = title
session['author'] = author
session['author_mail'] = author_mail
......@@ -32,5 +32,5 @@ session['listbox'] = [newTempBase(context.getPortalObject(), '',
tested = False
)]
return context.Base_redirect('TestPageModule_viewChapterCreationWizard',
return context.Base_redirect('TestPageModule_viewChapterCreationWizardDialog',
keep_items = dict(portal_status_message=portal_status_message))
# pylint:disable=redefined-builtin
"""
Generate the html code from the listbox after adding the current chapter to the listbox
"""
from Products.ERP5Type.Document import newTempBase
# Add the last chapter to the listbox
context.TestPageModule_createChapter(chapter_title, slide_type, image_url, image_caption,
file, text_content, slide_content, tested, **kw)
translateString = context.Base_translateString
portal_status_message = ""
session = context.ERP5RunMyDocs_acquireSession()
session = context.ERP5Site_acquireRunMyDocsSession()
test_page = context.restrictedTraverse(session['test_page_path'])
listbox = session['listbox']
title = session['title']
......@@ -68,7 +67,7 @@ for chapter in listbox[1:]:
<test>"""
if first:
text_content +="""
<span metal:use-macro="container/ERP5RunMyDocs_initTest/macros/init_test_environment" style="display:none;"> init</span>"""
<span metal:use-macro="container/ERP5Site_initRunMyDocsTest/macros/init_test_environment" style="display:none;"> init</span>"""
first = False
text_content +="""
......
......@@ -2,7 +2,7 @@
Fetches the listbox from session variables
"""
session = context.ERP5RunMyDocs_acquireSession()
session = context.ERP5Site_acquireRunMyDocsSession()
if session.has_key('listbox'):
listbox = session['listbox']
else:
......
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>sort_on = [], **kw</string> </value>
<value> <string>sort_on=(), **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
......@@ -120,7 +120,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>TestPageModule_viewChapterCreationWizard</string> </value>
<value> <string>TestPageModule_viewChapterCreationWizardDialog</string> </value>
</item>
<item>
<key> <string>method</string> </key>
......@@ -128,7 +128,7 @@
</item>
<item>
<key> <string>name</string> </key>
<value> <string>TestPageModule_viewChapterCreationWizard</string> </value>
<value> <string>TestPageModule_viewChapterCreationWizardDialog</string> </value>
</item>
<item>
<key> <string>pt</string> </key>
......
......@@ -114,7 +114,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>TestPageModule_viewCreationWizard</string> </value>
<value> <string>TestPageModule_viewCreationWizardDialog</string> </value>
</item>
<item>
<key> <string>method</string> </key>
......@@ -122,7 +122,7 @@
</item>
<item>
<key> <string>name</string> </key>
<value> <string>TestPageModule_viewCreationWizard</string> </value>
<value> <string>TestPageModule_viewCreationWizardDialog</string> </value>
</item>
<item>
<key> <string>pt</string> </key>
......
......@@ -11,10 +11,8 @@ image_id = ''.join(c for c in ('_'.join(image_id.split(' '))) if c.isalnum() or
found = True
while found:
image_path = path + '/' + image_id
try:
image = context.restrictedTraverse(image_path)
except:
image = None
image = context.restrictedTraverse(image_path, None)
if image is None:
found = False
break
# If there's already an image with the same url
......@@ -22,7 +20,7 @@ while found:
# Check if the end is a number and increment in that case
try:
end_number = int(image_id.split('_')[-1])
except:
except IndexError:
end_number = -1
if end_number > 0:
image_id = image_id.split('_')[0:-1]
......
return """
<style type="text/css">
body, table {
font-family: Verdana,Arial,sans-serif;
font-size: 24px;
margin:auto;
}
table {
border: 1px solid #CCCCCC;
border-collapse: collapse;
}
th, td {
padding-left: 0.3em;
padding-right: 0.3em;
}
a {
text-decoration: none;
}
.title {
font-style: italic;
}
.selected {
background-color: #FFFFCC;
}
.status_done {
background-color: #EEFFEE;
}
.status_passed {
background-color: #CCFFCC;
}
.status_failed {
background-color: #FFCCCC;
}
.breakpoint {
background-color: #CCCCCC;
border: 1px solid black;
}
</style>
"""
return """\
<link rel="stylesheet" type="text/css" href="{}/test_page_report.css">
""".format(context.getPortalObject().absolute_url())
#pylint:disable=redefined-builtin
"""
Create an image object and upload the image if necessary
"""
......@@ -20,9 +21,8 @@ def createImage(image_id):
if slide_type in ['Screenshot', 'Illustration'] and upload_image:
if not(file is None or not file):
if edit_mode:
try:
image = context.restrictedTraverse(context.getPath() + '/' + image_id)
except:
image = context.restrictedTraverse(context.getPath() + '/' + image_id, None)
if image is None:
image = createImage(image_id)
msg += ' Image %s created.' % image_id
else:
......@@ -42,4 +42,4 @@ if slide_type in ['Screenshot', 'Illustration'] and upload_image:
form_id = context.REQUEST.get('dialog_id', None)
context.Base_redirect(form_id,
keep_items = dict(portal_status_message=translateString(msg)))
keep_items = dict(portal_status_message=msg))
......@@ -108,7 +108,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>TestPage_viewExportTestReport</string> </value>
<value> <string>TestPage_viewExportTestReportDialog</string> </value>
</item>
<item>
<key> <string>method</string> </key>
......@@ -116,7 +116,7 @@
</item>
<item>
<key> <string>name</string> </key>
<value> <string>TestPage_viewExportTestReport</string> </value>
<value> <string>TestPage_viewExportTestReportDialog</string> </value>
</item>
<item>
<key> <string>pt</string> </key>
......
......@@ -83,7 +83,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>TestPage_viewRunSeleniumTest</string> </value>
<value> <string>TestPage_viewRunSeleniumTestDialog</string> </value>
</item>
<item>
<key> <string>method</string> </key>
......@@ -115,7 +115,7 @@
</item>
<item>
<key> <string>update_action</string> </key>
<value> <string>TestPage_viewRunSeleniumTest</string> </value>
<value> <string>TestPage_viewRunSeleniumTestDialog</string> </value>
</item>
<item>
<key> <string>update_action_title</string> </key>
......
......@@ -75,7 +75,7 @@
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>TestPageModule_viewChapterCreationWizard</string> </value>
<value> <string>TestPageModule_viewChapterCreationWizardDialog</string> </value>
</item>
<item>
<key> <string>target</string> </key>
......
......@@ -75,7 +75,7 @@
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>TestPageModule_viewChapterCreationWizard</string> </value>
<value> <string>TestPageModule_viewChapterCreationWizardDialog</string> </value>
</item>
<item>
<key> <string>target</string> </key>
......
......@@ -105,7 +105,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>TestPage_viewSlideShowWithGadget</string> </value>
<value> <string>TestPage_viewSlideShowWithGadgetDialog</string> </value>
</item>
<item>
<key> <string>method</string> </key>
......@@ -113,7 +113,7 @@
</item>
<item>
<key> <string>name</string> </key>
<value> <string>TestPage_viewSlideShowWithGadget</string> </value>
<value> <string>TestPage_viewSlideShowWithGadgetDialog</string> </value>
</item>
<item>
<key> <string>pt</string> </key>
......
......@@ -109,7 +109,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>TestPage_viewUpdateReport</string> </value>
<value> <string>TestPage_viewUpdateReportDialog</string> </value>
</item>
<item>
<key> <string>method</string> </key>
......@@ -117,7 +117,7 @@
</item>
<item>
<key> <string>name</string> </key>
<value> <string>TestPage_viewUpdateReport</string> </value>
<value> <string>TestPage_viewUpdateReportDialog</string> </value>
</item>
<item>
<key> <string>pt</string> </key>
......
......@@ -3,14 +3,9 @@
<link rel="stylesheet" type="text/css" tal:attributes="href string:${portal_url}/jquery/ui/css/erp5-theme/jquery-ui.css">
<link rel="stylesheet" type="text/css" tal:attributes="href string:${portal_url}/test_editor.css">
<script language="javascript" tal:attributes="src string:${portal_url}/test_editor.js"></script>
<script language="javascript" tal:attributes="src string:${portal_url}/erp5_run_my_docs.js"></script>
<script tal:attributes="src string:${portal_url}/test_editor.js"></script>
<script tal:attributes="src string:${portal_url}/erp5_run_my_docs.js"></script>
<table id="test_table">
<col class='action_column' />
<col class='action_column' />
<col/>
<col/>
<col/>
<thead>
</thead>
<tbody id="list">
......
body, table {
font-family: Verdana,Arial,sans-serif;
font-size: 24px;
margin:auto;
}
table {
border: 1px solid #CCCCCC;
border-collapse: collapse;
}
th, td {
padding-left: 0.3em;
padding-right: 0.3em;
}
a {
text-decoration: none;
}
.title {
font-style: italic;
}
.selected {
background-color: #FFFFCC;
}
.status_done {
background-color: #EEFFEE;
}
.status_passed {
background-color: #CCFFCC;
}
.status_failed {
background-color: #FFCCCC;
}
.breakpoint {
background-color: #CCCCCC;
border: 1px solid black;
}
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string>test_page_report.css</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/css</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
object = state_change['object']
object.Base_checkConsistency()
state_change['object'].Base_checkConsistency()
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