Merge lp:~bellini666/stoqlib/crash_report_62_59 into lp:~stoq-dev/stoqlib/master

Proposed by Thiago Bellini
Status: Merged
Merged at revision: 3502
Proposed branch: lp:~bellini666/stoqlib/crash_report_62_59
Merge into: lp:~stoq-dev/stoqlib/master
Diff against target: 60 lines (+18/-8)
2 files modified
stoqlib/domain/sale.py (+5/-4)
stoqlib/gui/dialogs/csvexporterdialog.py (+13/-4)
To merge this branch: bzr merge lp:~bellini666/stoqlib/crash_report_62_59
Reviewer Review Type Date Requested Status
Ronaldo Maia Approve
Review via email: mp+62931@code.launchpad.net

Description of the change

Fix for crash reports 62 and 59.

To post a comment you must log in.
Revision history for this message
Thiago Bellini (bellini666) wrote :

Just commenting. Some commits, like the 3501, it looks like it has nothing to do with the bug, but they are there because of the changes on stoq.

3501. By Ronaldo Maia

Merge translations from lp

Revision history for this message
Ronaldo Maia (romaia) :
review: Approve
3504. By Thiago Bellini

Permission denied error on csv export was bad.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'stoqlib/domain/sale.py'
2--- stoqlib/domain/sale.py 2011-02-08 14:21:07 +0000
3+++ stoqlib/domain/sale.py 2011-06-01 02:18:24 +0000
4@@ -124,12 +124,13 @@
5 sparam = sysparam(conn)
6 if not (branch and
7 branch.id == get_current_branch(conn).id):
8- raise SellError("Stock still doesn't support sales for "
9- "branch companies different than the "
10- "current one")
11+ raise SellError(_(u"Stock still doesn't support sales for "
12+ u"branch companies different than the "
13+ u"current one"))
14
15 if not self.sellable.can_be_sold():
16- raise SellError('%r is already sold' % self.sellable)
17+ raise SellError(_(u"%r does not have enough stock to be sold."
18+ % self.sellable.get_description()))
19
20 storable = IStorable(self.sellable.product, None)
21 if storable:
22
23=== modified file 'stoqlib/gui/dialogs/csvexporterdialog.py'
24--- stoqlib/gui/dialogs/csvexporterdialog.py 2011-02-08 14:06:58 +0000
25+++ stoqlib/gui/dialogs/csvexporterdialog.py 2011-06-01 02:18:24 +0000
26@@ -25,6 +25,7 @@
27
28
29 import csv
30+import errno
31
32 import gtk
33
34@@ -34,6 +35,7 @@
35 from stoqlib.database.orm import ORMObject, SelectResults, export_csv, Viewable
36 from stoqlib.gui.editors.baseeditor import BaseEditor
37 from stoqlib.gui.csvexporter import objectlist2csv
38+from stoqlib.lib.message import warning
39 from stoqlib.lib.translation import stoqlib_gettext
40
41 _ = stoqlib_gettext
42@@ -127,7 +129,14 @@
43
44 def _save(self, filename):
45 encoding = self.encoding.get_selected()
46- csv_file = open(filename, 'w')
47- writer = csv.writer(csv_file, doublequote=True, quoting=csv.QUOTE_ALL)
48- writer.writerows(self._get_csv_content(encoding))
49- csv_file.close()
50+ try:
51+ with open(filename, 'w') as csv_file:
52+ writer = csv.writer(csv_file, doublequote=True,
53+ quoting=csv.QUOTE_ALL)
54+ writer.writerows(self._get_csv_content(encoding))
55+ except IOError as err:
56+ if err.errno == errno.EACCES:
57+ warning(_(u"You do not have enought permissions "
58+ u"to save on that folder."))
59+ else:
60+ raise

Subscribers

People subscribed via source and target branches