Merge lp:~therp-nl/ocb-web/6.1_lp1340813 into lp:ocb-web/6.1

Proposed by Holger Brunn (Therp)
Status: Merged
Merged at revision: 2523
Proposed branch: lp:~therp-nl/ocb-web/6.1_lp1340813
Merge into: lp:ocb-web/6.1
Diff against target: 33 lines (+14/-5)
1 file modified
addons/web/controllers/main.py (+14/-5)
To merge this branch: bzr merge lp:~therp-nl/ocb-web/6.1_lp1340813
Reviewer Review Type Date Requested Status
Yann Papouin code review Approve
Pedro Manuel Baeza code review Approve
Review via email: mp+226487@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

LGTM

review: Approve (code review)
Revision history for this message
Yann Papouin (yann-papouin) wrote :

Ok

review: Approve (code review)
Revision history for this message
Holger Brunn (Therp) (hbrunn) wrote :

6.1 still lives on launchpad, so we can process with this one here.

Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

OK, I think we can proceed with the merge due to the 2 approvals. May I?

Regards.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'addons/web/controllers/main.py'
2--- addons/web/controllers/main.py 2014-01-08 13:14:56 +0000
3+++ addons/web/controllers/main.py 2014-07-11 16:27:56 +0000
4@@ -1871,15 +1871,24 @@
5 if action_context.get('active_model') and action_context['active_ids']:
6 # Use built-in ORM method to get data from DB
7 m = req.session.model(action_context['active_model'])
8- r = m.name_get(action_context['active_ids'], context)
9+ r = []
10+ try:
11+ r = m.name_get(action_context['active_ids'], context)
12+ except xmlrpclib.Fault:
13+ #we assume this went wrong because of incorrect/missing
14+ #_rec_name. We don't have access to _columns here to do
15+ # a proper check
16+ pass
17 # Parse result to create a better filename
18 item_names = [item[1] or str(item[0]) for item in r]
19 if action.get('name'):
20 item_names.insert(0, action['name'])
21- file_name = '-'.join(item_names)
22- # Create safe filename
23- p = re.compile('[/:(")<>|?*]|(\\\)')
24- file_name = p.sub('_', file_name)
25+ #only change filename if we have something better
26+ if item_names:
27+ file_name = '-'.join(item_names)
28+ # Create safe filename
29+ p = re.compile('[/:(")<>|?*]|(\\\)')
30+ file_name = p.sub('_', file_name)
31
32 report = base64.b64decode(report_struct['result'])
33 if report_struct.get('code') == 'zlib':

Subscribers

People subscribed via source and target branches