Merge lp:~bellini666/stoq/pyflakes_improvements into lp:~stoq-dev/stoq/master

Proposed by Thiago Bellini
Status: Merged
Merged at revision: 4393
Proposed branch: lp:~bellini666/stoq/pyflakes_improvements
Merge into: lp:~stoq-dev/stoq/master
Diff against target: 1428 lines (+194/-228)
74 files modified
Makefile (+1/-1)
plugins/books/bookssearch.py (+0/-1)
plugins/books/booksslave.py (+0/-3)
plugins/books/booksui.py (+0/-3)
plugins/books/publishersearch.py (+1/-8)
plugins/ecf/ecfui.py (+1/-5)
plugins/ecf/tests/test_device.py (+0/-1)
plugins/nfe/nfegenerator.py (+0/-5)
plugins/nfe/nfeui.py (+0/-1)
stoq/dbadmin.py (+4/-4)
stoq/gui/pos.py (+0/-1)
stoq/gui/receivable.py (+1/-19)
stoq/gui/stock.py (+0/-1)
stoqlib/chart/chart.py (+7/-7)
stoqlib/chart/chartserver.py (+5/-3)
stoqlib/chart/paymentcharts.py (+3/-0)
stoqlib/database/admin.py (+4/-4)
stoqlib/database/database.py (+2/-2)
stoqlib/database/migration.py (+1/-2)
stoqlib/database/runtime.py (+1/-1)
stoqlib/database/testsuite.py (+1/-1)
stoqlib/domain/address.py (+1/-1)
stoqlib/domain/base.py (+1/-1)
stoqlib/domain/devices.py (+0/-2)
stoqlib/domain/event.py (+3/-3)
stoqlib/domain/product.py (+1/-2)
stoqlib/domain/test/test_nfe.py (+1/-2)
stoqlib/domain/test/test_person.py (+0/-2)
stoqlib/domain/test/test_sellable.py (+1/-1)
stoqlib/gui/accounttree.py (+0/-1)
stoqlib/gui/base/lists.py (+0/-1)
stoqlib/gui/dialogs/branchdialog.py (+0/-4)
stoqlib/gui/dialogs/chartdialog.py (+2/-0)
stoqlib/gui/dialogs/productiondialog.py (+0/-3)
stoqlib/gui/dialogs/productionquotedialog.py (+0/-1)
stoqlib/gui/dialogs/purchasedetails.py (+0/-1)
stoqlib/gui/editors/accounttransactioneditor.py (+0/-1)
stoqlib/gui/editors/personeditor.py (+1/-1)
stoqlib/gui/editors/profileeditor.py (+0/-2)
stoqlib/gui/editors/sellableeditor.py (+0/-1)
stoqlib/gui/editors/tilleditor.py (+2/-3)
stoqlib/gui/fiscalprinter.py (+1/-3)
stoqlib/gui/printing.py (+0/-24)
stoqlib/gui/search/eventsearch.py (+0/-2)
stoqlib/gui/search/fiscalsearch.py (+0/-2)
stoqlib/gui/slaves/employeeslave.py (+0/-3)
stoqlib/gui/slaves/paymentmethodslave.py (+0/-2)
stoqlib/gui/slaves/userslave.py (+1/-2)
stoqlib/gui/splash.py (+0/-1)
stoqlib/gui/templates/individualtemplate.py (+0/-1)
stoqlib/gui/wizards/purchasewizard.py (+1/-2)
stoqlib/importers/branchimporter.py (+10/-7)
stoqlib/importers/clientimporter.py (+9/-6)
stoqlib/importers/creditproviderimporter.py (+7/-6)
stoqlib/importers/csvimporter.py (+2/-4)
stoqlib/importers/employeeimporter.py (+8/-7)
stoqlib/importers/ofximporter.py (+0/-1)
stoqlib/importers/purchaseimporter.py (+8/-6)
stoqlib/importers/serviceimporter.py (+2/-2)
stoqlib/importers/supplierimporter.py (+9/-6)
stoqlib/importers/transporterimporter.py (+9/-6)
stoqlib/lib/devicemanager.py (+1/-0)
stoqlib/lib/imageutils.py (+0/-2)
stoqlib/lib/test/test_ofximporter.py (+0/-6)
stoqlib/lib/test/test_parameters.py (+3/-4)
stoqlib/lib/test/test_sintegra.py (+0/-2)
stoqlib/lib/test/test_sintegragenerator.py (+2/-2)
stoqlib/lib/xmlrpc.py (+1/-1)
stoqlib/reporting/product.py (+0/-1)
stoqlib/reporting/purchase.py (+0/-1)
stoqlib/reporting/sale.py (+0/-2)
stoqlib/reporting/template.py (+0/-1)
stoqlib/reporting/tests/test_reporting.py (+7/-7)
stoqlib/test/test_pyflakes.py (+68/-0)
To merge this branch: bzr merge lp:~bellini666/stoq/pyflakes_improvements
Reviewer Review Type Date Requested Status
Ronaldo Maia Pending
Review via email: mp+80917@code.launchpad.net

Description of the change

Correções do Pyflakes e adição de testes.

* Corrigi vários erros e warnings de pyflakes pelo código (stoq, stoqlib e plugins).
* Alguns lugares a correção é estranha, como a remoção de um método inteiro. Esses casos era porque esse método estava sendo redefinido em baixo, logo não estava sendo usado. Até mesmo alguns erros de variáveis não definidas foram resolvidos. (o caso do charts, onde adicionei um XXX, aquela classe pelo log tem apenas a implementação inicial e lá mesmo diz que ela não funciona).
* Adicionei testes para testar pyflakes em stoq, stoqlib e plugins. Vai ser EXTREMAMENTE ÚTIL para encontrar erros de syntax que cometemos as vezes, e podem acabar despercebidos até um usuário chamar aquela função.

Não fiz nenhuma mudança funcional no código, apenas correções de pyflakes mesmo! Rodei os testes sem STOQLIB_TEST_QUICK e testei a gui em várias partes para ter certeza de que tudo ainda estava dentro dos conformes.

To post a comment you must log in.
4389. By Launchpad Translations on behalf of stoq-dev

Launchpad automatic translations update.

4390. By Launchpad Translations on behalf of stoq-dev

Launchpad automatic translations update.

4391. By Johan Dahlin

Pass in self.wizard to all dialogs created in wizard steps

Revision history for this message
Johan Dahlin (jdahlin-deactivatedaccount) wrote :

muito legal,era isso faz tempo. nem olhei direito ms acredito que vale pena
comitar como esta. proximo passo seria pep8.py, mas isso vai ser bem mais
trabalhoso.

bom trabalho thiago

On Tuesday, November 1, 2011, Thiago Bellini <email address hidden>
wrote:
> Thiago Bellini has proposed merging
lp:~hackedbellini/stoq/pyflakes_improvements into lp:stoq.
>
> Requested reviews:
> Ronaldo Maia (romaia)
>
> For more details, see:
>
https://code.launchpad.net/~hackedbellini/stoq/pyflakes_improvements/+merge/80917
>
> Correções do Pyflakes e adição de testes.
>
> * Corrigi vários erros e warnings de pyflakes pelo código (stoq, stoqlib
e plugins).
> * Alguns lugares a correção é estranha, como a remoção de um método
inteiro. Esses casos era porque esse método estava sendo redefinido em
baixo, logo não estava sendo usado. Até mesmo alguns erros de variáveis não
definidas foram resolvidos. (o caso do charts, onde adicionei um XXX,
aquela classe pelo log tem apenas a implementação inicial e lá mesmo diz
que ela não funciona).
> * Adicionei testes para testar pyflakes em stoq, stoqlib e plugins. Vai
ser EXTREMAMENTE ÚTIL para encontrar erros de syntax que cometemos as
vezes, e podem acabar despercebidos até um usuário chamar aquela função.
>
> Não fiz nenhuma mudança funcional no código, apenas correções de pyflakes
mesmo! Rodei os testes sem STOQLIB_TEST_QUICK e testei a gui em várias
partes para ter certeza de que tudo ainda estava dentro dos conformes.
> --
>
https://code.launchpad.net/~hackedbellini/stoq/pyflakes_improvements/+merge/80917
> You are subscribed to branch lp:stoq.
>

--
Johan Dahlin

4392. By Thiago Bellini

Correct 2 test methods names.

* test_runtime had a 'setDown' method. It wasn't really necessary as 'setUp'
  has it's logic in it. That's why it didn't interfered in nothing on test,
  since the right name for it would be 'tearDown'. Just removing it.
* TestReport's 'setUp' logic was written on 'tearUp'. For that reason, it
  wasn't being called and the workaround it tried to apply wasn't working (I
  didn't noticed it when I wrote the patch because I had no cache at the
  moment, and jenkins never fail on that test). Rename it and everything should
  be fine!

Maybe we should try to create a pattern on tests. Use 'setUp/setDown' or
'tearUp/tearDown' (I think the second makes more sense) to avoid problems like
that, that happened for distraction and the assumption of a pattern.

Revision history for this message
Thiago Bellini (bellini666) wrote :

Johan: Valeu :) Vou comitar então

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Makefile'
2--- Makefile 2011-07-11 03:30:12 +0000
3+++ Makefile 2011-11-05 17:07:26 +0000
4@@ -29,7 +29,7 @@
5 pep8 stoq stoqlib
6
7 pyflakes:
8- pyflakes stoq stoqlib
9+ pyflakes stoq stoqlib plugins
10
11 check:
12 LC_ALL=C trial stoq stoqlib
13
14=== modified file 'plugins/books/bookssearch.py'
15--- plugins/books/bookssearch.py 2011-05-19 17:52:30 +0000
16+++ plugins/books/bookssearch.py 2011-11-05 17:07:26 +0000
17@@ -32,7 +32,6 @@
18
19 from stoqlib.domain.sellable import Sellable
20 from stoqlib.gui.search.productsearch import ProductSearch
21-from stoqlib.lib.defaults import sort_sellable_code
22 from stoqlib.lib.translation import stoqlib_gettext as _
23 from stoqlib.lib.formatters import format_quantity, get_formatted_cost
24
25
26=== modified file 'plugins/books/booksslave.py'
27--- plugins/books/booksslave.py 2011-02-08 14:06:58 +0000
28+++ plugins/books/booksslave.py 2011-11-05 17:07:26 +0000
29@@ -30,10 +30,7 @@
30 from kiwi.datatypes import ValidationError
31
32 from stoqlib.gui.editors.baseeditor import BaseEditorSlave
33-from stoqlib.gui.slaves.sellableslave import SellableDetailsSlave
34-from stoqlib.domain.interfaces import IStorable
35 from stoqlib.domain.person import Person
36-from stoqlib.domain.product import Product
37 from stoqlib.lib.countries import get_countries
38 from stoqlib.lib.translation import stoqlib_gettext
39
40
41=== modified file 'plugins/books/booksui.py'
42--- plugins/books/booksui.py 2011-02-08 14:06:58 +0000
43+++ plugins/books/booksui.py 2011-11-05 17:07:26 +0000
44@@ -22,8 +22,6 @@
45 ## Author(s): Stoq Team <stoq-devel@async.com.br>
46 ##
47
48-import os
49-
50 import gtk
51
52 from kiwi.log import Logger
53@@ -31,7 +29,6 @@
54 from stoqlib.database.runtime import get_connection
55 from stoqlib.gui.base.dialogs import run_dialog
56 from stoqlib.gui.events import StartApplicationEvent
57-from stoqlib.lib.message import info
58 from stoqlib.lib.translation import stoqlib_gettext
59
60 from bookssearch import ProductBookSearch
61
62=== modified file 'plugins/books/publishersearch.py'
63--- plugins/books/publishersearch.py 2011-05-19 17:52:30 +0000
64+++ plugins/books/publishersearch.py 2011-11-05 17:07:26 +0000
65@@ -24,17 +24,10 @@
66
67 """ Search dialog/Editor for publishers """
68
69-from kiwi.argcheck import argcheck
70-from kiwi.enums import SearchFilterPosition
71-from kiwi.ui.search import ComboSearchFilter
72-from kiwi.ui.objectlist import Column, SearchColumn
73+from kiwi.ui.objectlist import SearchColumn
74
75-from stoqlib.database.runtime import new_transaction
76 from stoqlib.lib.translation import stoqlib_gettext
77-from stoqlib.lib.formatters import format_phone_number
78
79-from stoqlib.gui.base.search import SearchEditor, SearchDialog
80-from stoqlib.gui.base.dialogs import run_dialog
81 from stoqlib.gui.search.personsearch import BasePersonSearch
82 from stoqlib.gui.templates.persontemplate import BasePersonRoleEditor
83
84
85=== modified file 'plugins/ecf/ecfui.py'
86--- plugins/ecf/ecfui.py 2011-10-05 19:46:41 +0000
87+++ plugins/ecf/ecfui.py 2011-11-05 17:07:26 +0000
88@@ -55,7 +55,6 @@
89 from couponprinter import CouponPrinter
90 from ecfdomain import ECFPrinter, FiscalSaleHistory
91 from ecfprinterdialog import ECFListDialog
92-from ecfprinterstatus import ECFAsyncPrinterStatus
93 from ecfmemorydialog import FiscalMemoryDialog
94 from paulistainvoicedialog import PaulistaInvoiceDialog
95
96@@ -104,9 +103,6 @@
97 _("This operation requires a connected fiscal printer"))
98
99 if not self._printer_verified:
100- domain = self._printer.get_printer()
101- driver = self._printer.get_driver()
102-
103 if not self._printer.check_serial():
104 raise DeviceError(
105 _("Fiscalprinters serial number is different!"))
106@@ -198,7 +194,7 @@
107 log.info('ecfui._check_printer')
108 try:
109 self._validate_printer()
110- except (DriverError, DeviceError), details:
111+ except (DriverError, DeviceError):
112 warning('Não foi possível comunicar com a impressora.')
113 raise SystemExit
114
115
116=== modified file 'plugins/ecf/tests/test_device.py'
117--- plugins/ecf/tests/test_device.py 2011-06-21 13:31:33 +0000
118+++ plugins/ecf/tests/test_device.py 2011-11-05 17:07:26 +0000
119@@ -85,7 +85,6 @@
120 settings = self.create_ecf_printer()
121 settings.create_fiscal_printer_constants()
122
123- constants = list(settings.constants)
124 for constant_type in [DeviceConstant.TYPE_UNIT,
125 DeviceConstant.TYPE_TAX,
126 DeviceConstant.TYPE_PAYMENT]:
127
128=== modified file 'plugins/nfe/nfegenerator.py'
129--- plugins/nfe/nfegenerator.py 2011-10-27 16:07:50 +0000
130+++ plugins/nfe/nfegenerator.py 2011-11-05 17:07:26 +0000
131@@ -30,9 +30,6 @@
132 from xml.etree.ElementTree import Element
133 from xml.sax.saxutils import escape
134
135-from stoqdrivers.enum import TaxType
136-
137-import stoqlib
138 from stoqlib.domain.interfaces import ICompany, IIndividual
139 from stoqlib.exceptions import ModelDataError
140 from stoqlib.lib.parameters import sysparam
141@@ -449,7 +446,6 @@
142 def as_txt(self):
143 txt = u'%s|%s|%s|\n' % (self.txttag, self.element.get('versao'),
144 self.get_id_value())
145- children = self.get_children()
146 for child in self.get_children():
147 txt += child.as_txt()
148
149@@ -1599,7 +1595,6 @@
150
151 address = person.get_main_address()
152 if address:
153- postal_code = ''.join([i for i in address.postal_code if i in '1234567890'])
154 self.set_attr('xEnder', address.get_address_string()[:60])
155 self.set_attr('xMun', address.city_location.city[:60])
156 self.set_attr('UF', address.city_location.state)
157
158=== modified file 'plugins/nfe/nfeui.py'
159--- plugins/nfe/nfeui.py 2011-10-19 19:44:32 +0000
160+++ plugins/nfe/nfeui.py 2011-11-05 17:07:26 +0000
161@@ -31,7 +31,6 @@
162 from stoqlib.domain.sale import Sale
163 from stoqlib.gui.events import StartApplicationEvent
164 from stoqlib.lib.osutils import get_application_dir
165-from stoqlib.lib.message import info
166 from stoqlib.lib.translation import stoqlib_gettext
167
168 from nfegenerator import NFeGenerator
169
170=== modified file 'stoq/dbadmin.py'
171--- stoq/dbadmin.py 2011-11-01 01:13:11 +0000
172+++ stoq/dbadmin.py 2011-11-05 17:07:26 +0000
173@@ -192,10 +192,10 @@
174 branch = None
175
176 try:
177- station = BranchStation(connection=trans,
178- is_active=True,
179- branch=branch,
180- name=socket.gethostname())
181+ BranchStation(connection=trans,
182+ is_active=True,
183+ branch=branch,
184+ name=socket.gethostname())
185 except StoqlibError, e:
186 raise SystemExit("ERROR: %s" % e)
187
188
189=== modified file 'stoq/gui/pos.py'
190--- stoq/gui/pos.py 2011-11-01 01:13:11 +0000
191+++ stoq/gui/pos.py 2011-11-05 17:07:26 +0000
192@@ -511,7 +511,6 @@
193 self.set_sensitive([self.advanced_search], has_quantity)
194
195 def _read_quantity(self):
196- quantity_text = self.quantity.get_text()
197 try:
198 quantity = self.quantity.read()
199 except ValidationError:
200
201=== modified file 'stoq/gui/receivable.py'
202--- stoq/gui/receivable.py 2011-10-24 13:53:17 +0000
203+++ stoq/gui/receivable.py 2011-11-05 17:07:26 +0000
204@@ -35,7 +35,7 @@
205 from kiwi.datatypes import currency
206 from kiwi.enums import SearchFilterPosition
207 from kiwi.python import all
208-from kiwi.ui.search import ComboSearchFilter, DateSearchOption
209+from kiwi.ui.search import ComboSearchFilter
210 from kiwi.ui.objectlist import SearchColumn, Column
211 from stoqlib.database.runtime import new_transaction, finish_transaction
212 from stoqlib.domain.payment.operation import register_payment_operations
213@@ -64,24 +64,6 @@
214
215 _ = gettext.gettext
216
217-class NextMonthOption(DateSearchOption):
218- name = _('Next month')
219- def get_interval(self):
220- today = datetime.date.today()
221- year = today.year
222- month = today.month + 1
223- if month > 12:
224- month = 1
225- year += 1
226- # Try 31 first then add one until date() does not complain.
227- day = today.day
228- while True:
229- try:
230- end_date = datetime.date(year, month, day)
231- break
232- except ValueError:
233- day += 1
234- return datetime.date.today(), end_date
235
236 class ReceivableApp(SearchableAppWindow):
237
238
239=== modified file 'stoq/gui/stock.py'
240--- stoq/gui/stock.py 2011-10-04 16:01:38 +0000
241+++ stoq/gui/stock.py 2011-11-05 17:07:26 +0000
242@@ -41,7 +41,6 @@
243 from stoqlib.domain.sellable import Sellable
244 from stoqlib.domain.views import ProductFullStockView
245 from stoqlib.lib.defaults import sort_sellable_code
246-from stoqlib.lib.message import warning
247 from stoqlib.gui.editors.producteditor import ProductStockEditor
248 from stoqlib.gui.wizards.loanwizard import NewLoanWizard, CloseLoanWizard
249 from stoqlib.gui.wizards.receivingwizard import ReceivingOrderWizard
250
251=== modified file 'stoqlib/chart/chart.py'
252--- stoqlib/chart/chart.py 2011-07-01 18:41:05 +0000
253+++ stoqlib/chart/chart.py 2011-11-05 17:07:26 +0000
254@@ -23,13 +23,13 @@
255 ##
256 """ Charting """
257
258-import datetime
259-import gettext
260-import string
261-
262-from kiwi.python import namedAny, Settable
263-
264-_ = gettext.gettext
265+import pprint
266+
267+from kiwi.python import namedAny
268+from stoqlib.lib.translation import stoqlib_gettext
269+
270+_ = stoqlib_gettext
271+
272
273 class DateArgument(object):
274 pass
275
276=== modified file 'stoqlib/chart/chartserver.py'
277--- stoqlib/chart/chartserver.py 2011-07-01 18:41:05 +0000
278+++ stoqlib/chart/chartserver.py 2011-11-05 17:07:26 +0000
279@@ -26,15 +26,14 @@
280 import cgi
281 import json
282
283-from kiwi.environ import environ
284 from twisted.internet import reactor
285 from twisted.web.resource import Resource
286 from twisted.web.server import Site
287 from twisted.web.static import File
288
289 from stoqlib.chart.chart import get_chart_class
290+from stoqlib.database.runtime import get_connection
291 from stoqlib.lib.template import render_template
292-
293 from stoqlib.lib.translation import stoqlib_gettext
294
295 _ = stoqlib_gettext
296@@ -53,6 +52,8 @@
297 class ChartChartResource(Resource):
298
299 def _get_chart(self, request):
300+ conn = get_connection()
301+
302 if not '?' in request.uri:
303 raise TypeError("Missing arguments")
304 args = cgi.parse_qs(request.uri.split('?', 1)[1])
305@@ -70,7 +71,8 @@
306 opt['data'] = chart.run()
307 opt['options'] = {
308 "xaxis": { "mode": "time" },
309- "bars": { "show": True, "barWidth": 20 * _JS_DAY },
310+ # XXX: _JS_DAY is not defined
311+ #"bars": { "show": True, "barWidth": 20 * _JS_DAY },
312 "points": { "show": False },
313 "lines": { "show": False },
314 "grid": { "hoverable": True,
315
316=== modified file 'stoqlib/chart/paymentcharts.py'
317--- stoqlib/chart/paymentcharts.py 2011-07-01 19:35:48 +0000
318+++ stoqlib/chart/paymentcharts.py 2011-11-05 17:07:26 +0000
319@@ -23,9 +23,11 @@
320 ##
321 """ Payment charts """
322
323+import datetime
324 import string
325
326 from stoqlib.chart.chart import Chart
327+from stoqlib.database.runtime import get_connection
328 from stoqlib.lib.translation import stoqlib_gettext
329
330 _ = stoqlib_gettext
331@@ -164,6 +166,7 @@
332 @month: month to show payments for
333 @returns: (month, total in payments, total out payments, profit)
334 """
335+ conn = get_connection()
336
337 if 2100 > year < 1900:
338 raise ValueError(year)
339
340=== modified file 'stoqlib/database/admin.py'
341--- stoqlib/database/admin.py 2011-07-27 15:43:30 +0000
342+++ stoqlib/database/admin.py 2011-11-05 17:07:26 +0000
343@@ -236,10 +236,10 @@
344 TaxType.NONE,
345 TaxType.SERVICE]:
346 desc = describe_constant(enum)
347- constant = SellableTaxConstant(description=desc,
348- tax_type=int(enum),
349- tax_value=None,
350- connection=trans)
351+ SellableTaxConstant(description=desc,
352+ tax_type=int(enum),
353+ tax_value=None,
354+ connection=trans)
355
356 trans.commit(close=True)
357
358
359=== modified file 'stoqlib/database/database.py'
360--- stoqlib/database/database.py 2011-10-26 17:46:38 +0000
361+++ stoqlib/database/database.py 2011-11-05 17:07:26 +0000
362@@ -38,7 +38,7 @@
363 from stoqlib.database.exceptions import SQLError
364 from stoqlib.database.interfaces import IDatabaseSettings
365
366-from stoqlib.lib.message import error, warning
367+from stoqlib.lib.message import warning
368 from stoqlib.lib.translation import stoqlib_gettext
369
370 _ = stoqlib_gettext
371@@ -308,7 +308,7 @@
372 log.debug('executing %s' % (' '.join(args), ))
373
374 proc = subprocess.Popen(args, stderr=subprocess.PIPE)
375- retcode = proc.wait()
376+ proc.wait()
377 return newname
378 else:
379 raise NotImplementedError(settings.rdbms)
380
381=== modified file 'stoqlib/database/migration.py'
382--- stoqlib/database/migration.py 2011-11-01 01:13:11 +0000
383+++ stoqlib/database/migration.py 2011-11-05 17:07:26 +0000
384@@ -38,7 +38,6 @@
385
386 from stoqlib.database.database import (execute_sql, dump_database,
387 restore_database, test_connection)
388-from stoqlib.database.exceptions import SQLError
389 from stoqlib.database.runtime import new_transaction, get_connection
390 from stoqlib.domain.plugin import InstalledPlugin
391 from stoqlib.domain.profile import update_profile_applications
392@@ -327,7 +326,7 @@
393 super(StoqlibSchemaMigration, self).update()
394 if plugins:
395 self.update_plugins()
396- except Exception, e:
397+ except Exception:
398 exc = sys.exc_info()
399 tb_str = ''.join(traceback.format_exception(*exc))
400 collect_traceback(exc, submit=True)
401
402=== modified file 'stoqlib/database/runtime.py'
403--- stoqlib/database/runtime.py 2011-10-28 15:04:24 +0000
404+++ stoqlib/database/runtime.py 2011-11-05 17:07:26 +0000
405@@ -32,7 +32,7 @@
406 IDatabaseSettings, IConnection, ITransaction, ICurrentBranch,
407 ICurrentBranchStation, ICurrentUser)
408 from stoqlib.database.orm import ORMObject, Transaction
409-from stoqlib.database.orm import sqlIdentifier, const, Update, IN
410+from stoqlib.database.orm import sqlIdentifier, const
411 from stoqlib.exceptions import LoginError, StoqlibError
412 from stoqlib.lib.message import error, yesno
413 from stoqlib.lib.translation import stoqlib_gettext
414
415=== modified file 'stoqlib/database/testsuite.py'
416--- stoqlib/database/testsuite.py 2011-07-20 20:33:08 +0000
417+++ stoqlib/database/testsuite.py 2011-11-05 17:07:26 +0000
418@@ -216,7 +216,7 @@
419 initialize_system()
420 ensure_admin_user("")
421 create(utilities=True)
422- except Exception, e:
423+ except Exception:
424 # Work around trial
425 import traceback
426 traceback.print_exc()
427
428=== modified file 'stoqlib/domain/address.py'
429--- stoqlib/domain/address.py 2011-09-28 19:55:17 +0000
430+++ stoqlib/domain/address.py 2011-11-05 17:07:26 +0000
431@@ -25,7 +25,7 @@
432 from kiwi.argcheck import argcheck
433 from zope.interface import implements
434
435-from stoqlib.database.orm import (AND, const, UnicodeCol, IntCol, ForeignKey,
436+from stoqlib.database.orm import (AND, UnicodeCol, IntCol, ForeignKey,
437 BoolCol, ILIKE)
438 from stoqlib.database.runtime import StoqlibTransaction
439 from stoqlib.domain.base import Domain
440
441=== modified file 'stoqlib/domain/base.py'
442--- stoqlib/domain/base.py 2011-10-13 17:51:40 +0000
443+++ stoqlib/domain/base.py 2011-11-05 17:07:26 +0000
444@@ -26,7 +26,7 @@
445 from zope.interface.interface import adapter_hooks
446
447 from stoqlib.database.orm import orm_name, ForeignKey, IntCol
448-from stoqlib.database.orm import ORMObject, const, AND, const, ILIKE
449+from stoqlib.database.orm import ORMObject, const, AND, ILIKE
450 from stoqlib.database.runtime import (StoqlibTransaction,
451 get_current_user, get_current_station)
452 from stoqlib.domain.system import TransactionEntry
453
454=== modified file 'stoqlib/domain/devices.py'
455--- stoqlib/domain/devices.py 2011-07-15 18:01:20 +0000
456+++ stoqlib/domain/devices.py 2011-11-05 17:07:26 +0000
457@@ -25,8 +25,6 @@
458 Domain classes related to stoqdrivers package.
459 """
460
461-import platform
462-
463 from zope.interface import implements
464 from stoqdrivers.printers.cheque import ChequePrinter
465 from stoqdrivers.scales.scales import Scale
466
467=== modified file 'stoqlib/domain/event.py'
468--- stoqlib/domain/event.py 2011-10-29 20:25:07 +0000
469+++ stoqlib/domain/event.py 2011-11-05 17:07:26 +0000
470@@ -64,9 +64,9 @@
471 @classmethod
472 def log(cls, event_type, description):
473 trans = new_transaction()
474- event = cls(event_type=event_type,
475- description=description,
476- connection=trans)
477+ cls(event_type=event_type,
478+ description=description,
479+ connection=trans)
480 trans.commit()
481
482
483
484=== modified file 'stoqlib/domain/product.py'
485--- stoqlib/domain/product.py 2011-10-27 19:50:12 +0000
486+++ stoqlib/domain/product.py 2011-11-05 17:07:26 +0000
487@@ -38,8 +38,7 @@
488 from stoqlib.domain.events import (ProductCreateEvent, ProductEditEvent,
489 ProductRemoveEvent, ProductStockUpdateEvent)
490 from stoqlib.domain.person import Person
491-from stoqlib.domain.interfaces import (IStorable, IContainer,
492- IBranch)
493+from stoqlib.domain.interfaces import IStorable, IBranch
494 from stoqlib.exceptions import StockError, DatabaseInconsistency
495 from stoqlib.lib.translation import stoqlib_gettext
496 from stoqlib.lib.parameters import sysparam
497
498=== modified file 'stoqlib/domain/test/test_nfe.py'
499--- stoqlib/domain/test/test_nfe.py 2011-11-01 01:13:11 +0000
500+++ stoqlib/domain/test/test_nfe.py 2011-11-05 17:07:26 +0000
501@@ -41,8 +41,7 @@
502
503 # This test should be inside plugins/nfe, but it's not reachable there
504 sys.path.append('plugins/nfe')
505-from nfegenerator import (NFeGenerator, remove_accentuation, nfe_tostring,
506- NFeIdentification)
507+from nfegenerator import NFeGenerator, remove_accentuation, NFeIdentification
508
509
510 class TestNfeGenerator(DomainTest):
511
512=== modified file 'stoqlib/domain/test/test_person.py'
513--- stoqlib/domain/test/test_person.py 2011-10-28 18:01:18 +0000
514+++ stoqlib/domain/test/test_person.py 2011-11-05 17:07:26 +0000
515@@ -27,8 +27,6 @@
516
517 from kiwi.datatypes import currency
518
519-from twisted.trial.unittest import SkipTest
520-
521 from stoqlib.database.orm import ORMObjectMoreThanOneResultError, AND
522 from stoqlib.domain.account import BankAccount
523 from stoqlib.domain.person import Calls, Liaison
524
525=== modified file 'stoqlib/domain/test/test_sellable.py'
526--- stoqlib/domain/test/test_sellable.py 2011-10-03 16:59:34 +0000
527+++ stoqlib/domain/test/test_sellable.py 2011-11-05 17:07:26 +0000
528@@ -369,7 +369,7 @@
529 def testRemove(self):
530 # Remove category price and sellable
531 sellable = self.create_sellable()
532- storable = sellable.product.addFacet(IStorable, connection=self.trans)
533+ sellable.product.addFacet(IStorable, connection=self.trans)
534
535 ClientCategoryPrice(sellable=sellable,
536 category=self.create_client_category(),
537
538=== modified file 'stoqlib/gui/accounttree.py'
539--- stoqlib/gui/accounttree.py 2011-08-08 19:18:15 +0000
540+++ stoqlib/gui/accounttree.py 2011-11-05 17:07:26 +0000
541@@ -22,7 +22,6 @@
542 import gtk
543
544 from kiwi.currency import currency
545-from kiwi.datatypes import converter
546 from kiwi.python import Settable
547 from kiwi.ui.objectlist import ColoredColumn, Column, ObjectTree
548 from stoqlib.database.runtime import get_connection
549
550=== modified file 'stoqlib/gui/base/lists.py'
551--- stoqlib/gui/base/lists.py 2011-08-01 13:47:11 +0000
552+++ stoqlib/gui/base/lists.py 2011-11-05 17:07:26 +0000
553@@ -24,7 +24,6 @@
554 """ List management for common dialogs. """
555
556 import gtk
557-from kiwi.ui.delegates import GladeSlaveDelegate
558 from kiwi.ui.objectlist import ObjectList
559 from kiwi.ui.listdialog import ListSlave
560 from kiwi.utils import gsignal
561
562=== modified file 'stoqlib/gui/dialogs/branchdialog.py'
563--- stoqlib/gui/dialogs/branchdialog.py 2011-07-11 19:31:50 +0000
564+++ stoqlib/gui/dialogs/branchdialog.py 2011-11-05 17:07:26 +0000
565@@ -65,10 +65,6 @@
566 BaseEditor.__init__(self, trans, model, visual_mode=False)
567 self._setup_widgets()
568
569- def _setup_widgets(self):
570- self.title_label.set_size('large')
571- self.title_label.set_bold(True)
572-
573 def _update_system_parameters(self, person):
574 icms = self.tax_proxy.model.icms
575 self.param.update_parameter('ICMS_TAX', unicode(icms))
576
577=== modified file 'stoqlib/gui/dialogs/chartdialog.py'
578--- stoqlib/gui/dialogs/chartdialog.py 2011-07-01 18:41:05 +0000
579+++ stoqlib/gui/dialogs/chartdialog.py 2011-11-05 17:07:26 +0000
580@@ -26,6 +26,8 @@
581 import gtk
582 import webkit
583
584+from twisted.internet import reactor
585+
586 class ChartDialog(gtk.Window):
587 def __init__(self):
588 gtk.Window.__init__(self)
589
590=== modified file 'stoqlib/gui/dialogs/productiondialog.py'
591--- stoqlib/gui/dialogs/productiondialog.py 2011-10-28 17:21:28 +0000
592+++ stoqlib/gui/dialogs/productiondialog.py 2011-11-05 17:07:26 +0000
593@@ -24,7 +24,6 @@
594 ##
595
596 from decimal import Decimal
597-from sys import maxint as MAXINT
598
599 import gtk
600 from gtk import gdk
601@@ -232,7 +231,6 @@
602 self.remove_product_button.set_sensitive(can_remove)
603
604 def _get_columns(self):
605- adj = gtk.Adjustment(upper=MAXINT, step_incr=1)
606 return [Column('code', title=_(u'Code'), data_type=int),
607 Column('category', title=_(u'Category'), data_type=str,
608 expand=True, sorted=True),
609@@ -312,7 +310,6 @@
610 self.export_csv_button.set_sensitive(self.has_rows)
611
612 def _get_columns(self):
613- adj = gtk.Adjustment(upper=MAXINT, step_incr=1)
614 return [Column('industrialized_str', title=_(u'Ind.'), data_type=str),
615 Column('code', title=_(u'code'), data_type=str),
616 Column('category', title=_(u'Category'), data_type=str,
617
618=== modified file 'stoqlib/gui/dialogs/productionquotedialog.py'
619--- stoqlib/gui/dialogs/productionquotedialog.py 2011-02-08 14:21:07 +0000
620+++ stoqlib/gui/dialogs/productionquotedialog.py 2011-11-05 17:07:26 +0000
621@@ -57,7 +57,6 @@
622 order = self._create_purchase_order(trans)
623 to_quote_items = {}
624 for production in productions:
625- materials = production.get_material_items()
626 for material in production.get_material_items():
627 if material.to_purchase <= 0:
628 continue
629
630=== modified file 'stoqlib/gui/dialogs/purchasedetails.py'
631--- stoqlib/gui/dialogs/purchasedetails.py 2011-07-12 19:35:02 +0000
632+++ stoqlib/gui/dialogs/purchasedetails.py 2011-11-05 17:07:26 +0000
633@@ -76,7 +76,6 @@
634
635 if orders.count():
636 discount = surcharge = freight = subtotal = total = 0
637- freight_type = None
638 for order in orders:
639 discount += order._get_total_discounts()
640 surcharge += order._get_total_surcharges()
641
642=== modified file 'stoqlib/gui/editors/accounttransactioneditor.py'
643--- stoqlib/gui/editors/accounttransactioneditor.py 2011-08-10 18:24:18 +0000
644+++ stoqlib/gui/editors/accounttransactioneditor.py 2011-11-05 17:07:26 +0000
645@@ -24,7 +24,6 @@
646
647 import datetime
648
649-import gobject
650 import gtk
651 from kiwi.currency import currency
652 from kiwi.datatypes import ValidationError
653
654=== modified file 'stoqlib/gui/editors/personeditor.py'
655--- stoqlib/gui/editors/personeditor.py 2011-08-04 19:49:44 +0000
656+++ stoqlib/gui/editors/personeditor.py 2011-11-05 17:07:26 +0000
657@@ -44,7 +44,7 @@
658 from stoqlib.domain.person import EmployeeRole, PersonAdaptToCreditProvider
659 from stoqlib.domain.interfaces import (IClient, ICreditProvider, IEmployee,
660 ISupplier, ITransporter, IUser,
661- ICompany, IIndividual, IBranch)
662+ IIndividual, IBranch)
663
664 _ = stoqlib_gettext
665
666
667=== modified file 'stoqlib/gui/editors/profileeditor.py'
668--- stoqlib/gui/editors/profileeditor.py 2011-09-28 19:55:17 +0000
669+++ stoqlib/gui/editors/profileeditor.py 2011-11-05 17:07:26 +0000
670@@ -28,8 +28,6 @@
671 from kiwi.datatypes import ValidationError
672 from kiwi.ui.widgets.checkbutton import ProxyCheckButton
673
674-from stoqlib.database.orm import const, AND
675-from stoqlib.database.runtime import get_connection
676 from stoqlib.domain.profile import UserProfile, ProfileSettings
677 from stoqlib.gui.editors.baseeditor import BaseEditor
678 from stoqlib.lib.interfaces import IApplicationDescriptions
679
680=== modified file 'stoqlib/gui/editors/sellableeditor.py'
681--- stoqlib/gui/editors/sellableeditor.py 2011-10-03 16:59:34 +0000
682+++ stoqlib/gui/editors/sellableeditor.py 2011-11-05 17:07:26 +0000
683@@ -410,7 +410,6 @@
684 def _update_tax_value(self):
685 if not hasattr(self, 'tax_proxy'):
686 return
687- constant = self.tax_constant.get_selected_data()
688 self.tax_proxy.update('tax_constant.tax_value')
689
690 def get_taxes(self):
691
692=== modified file 'stoqlib/gui/editors/tilleditor.py'
693--- stoqlib/gui/editors/tilleditor.py 2011-10-05 17:33:34 +0000
694+++ stoqlib/gui/editors/tilleditor.py 2011-11-05 17:07:26 +0000
695@@ -29,12 +29,12 @@
696 from kiwi.python import Settable
697 from kiwi.ui.objectlist import Column, ColoredColumn, SummaryLabel
698
699-from stoqdrivers.exceptions import CouponOpenError, DriverError
700+from stoqdrivers.exceptions import DriverError
701
702 from stoqlib.database.orm import const
703 from stoqlib.database.runtime import (get_current_station, new_transaction,
704 finish_transaction)
705-from stoqlib.domain.account import Account, AccountTransaction
706+from stoqlib.domain.account import AccountTransaction
707 from stoqlib.domain.events import (TillOpenEvent, TillCloseEvent,
708 TillAddTillEntryEvent,
709 TillAddCashEvent, TillRemoveCashEvent)
710@@ -50,7 +50,6 @@
711 _ = stoqlib_gettext
712
713 def _create_transaction(conn, till_entry):
714- till = till_entry.till
715 AccountTransaction(description=till_entry.description,
716 source_account=sysparam(conn).IMBALANCE_ACCOUNT,
717 account=sysparam(conn).TILLS_ACCOUNT,
718
719=== modified file 'stoqlib/gui/fiscalprinter.py'
720--- stoqlib/gui/fiscalprinter.py 2011-11-01 01:13:11 +0000
721+++ stoqlib/gui/fiscalprinter.py 2011-11-05 17:07:26 +0000
722@@ -54,8 +54,6 @@
723 from stoqlib.lib.translation import stoqlib_gettext
724 from stoqlib.gui.wizards.salewizard import ConfirmSaleWizard
725
726-from stoqlib.domain.devices import FiscalDayHistory, FiscalDayTax
727-
728
729 _ = stoqlib_gettext
730
731@@ -212,7 +210,7 @@
732
733 try:
734 CouponCreatedEvent.emit(coupon)
735- except (DriverError, DeviceError), e:
736+ except (DriverError, DeviceError):
737 warning('Não foi possível abrir o cupom')
738 coupon = None
739
740
741=== modified file 'stoqlib/gui/printing.py'
742--- stoqlib/gui/printing.py 2011-10-03 14:12:38 +0000
743+++ stoqlib/gui/printing.py 2011-11-05 17:07:26 +0000
744@@ -207,30 +207,6 @@
745 kwargs['filter_strings'] = filter_strings
746 return kwargs
747
748-
749-def print_report(report_class, *args, **kwargs):
750- if kwargs.has_key('filters') and kwargs['filters']:
751- kwargs = describe_search_filters_for_reports(**kwargs)
752-
753- tmp = tempfile.mktemp(suffix='.pdf', prefix='stoqlib-reporting')
754- report = report_class(tmp, *args, **kwargs)
755- report.filename = tmp
756- report.save()
757- op = PrintOperation()
758- op.print_pdf(report)
759-
760-def describe_search_filters_for_reports(**kwargs):
761- filters = kwargs.pop('filters')
762- filter_strings = []
763- for filter in filters:
764- description = filter.get_description()
765- if description:
766- filter_strings.append(description)
767-
768- kwargs['filter_strings'] = filter_strings
769- return kwargs
770-
771-
772 def print_report(report_class, *args, **kwargs):
773 if kwargs.has_key('filters') and kwargs['filters']:
774 kwargs = describe_search_filters_for_reports(**kwargs)
775
776=== modified file 'stoqlib/gui/search/eventsearch.py'
777--- stoqlib/gui/search/eventsearch.py 2011-10-29 20:25:07 +0000
778+++ stoqlib/gui/search/eventsearch.py 2011-11-05 17:07:26 +0000
779@@ -24,8 +24,6 @@
780 ##
781 """ Implementation of event search """
782
783-import datetime
784-
785 from kiwi.ui.objectlist import Column
786
787 from stoqlib.gui.base.search import SearchEditor
788
789=== modified file 'stoqlib/gui/search/fiscalsearch.py'
790--- stoqlib/gui/search/fiscalsearch.py 2011-07-14 17:15:00 +0000
791+++ stoqlib/gui/search/fiscalsearch.py 2011-11-05 17:07:26 +0000
792@@ -83,11 +83,9 @@
793 searchbar_result_strings = _("fiscal entry"), _("fiscal entries")
794
795 def _setup_columns(self, column, table, col_name, summary_label_text):
796- label_text = '<b>%s</b>' % summary_label_text
797 columns = self.get_columns() + [column]
798 self.results.set_columns(columns)
799 self.set_table(table)
800- #self.setup_summary_label(col_name, label_text)
801
802 def _setup_icms_columns(self):
803 col = SearchColumn('icms_value',
804
805=== modified file 'stoqlib/gui/slaves/employeeslave.py'
806--- stoqlib/gui/slaves/employeeslave.py 2011-02-08 14:06:58 +0000
807+++ stoqlib/gui/slaves/employeeslave.py 2011-11-05 17:07:26 +0000
808@@ -207,11 +207,8 @@
809
810 def _update_sensitivity(self):
811 editor = True
812- settings = False
813 if self.role.get_text():
814 editor = self.role.is_valid()
815- if editor:
816- settings = self._is_default_salesperson_role()
817 else:
818 self.model.role = None
819 self.role_editor_button.set_sensitive(editor)
820
821=== modified file 'stoqlib/gui/slaves/paymentmethodslave.py'
822--- stoqlib/gui/slaves/paymentmethodslave.py 2011-08-05 16:54:09 +0000
823+++ stoqlib/gui/slaves/paymentmethodslave.py 2011-11-05 17:07:26 +0000
824@@ -28,10 +28,8 @@
825 from kiwi.ui.delegates import GladeSlaveDelegate
826 from kiwi.utils import gsignal
827
828-from stoqlib.database.runtime import get_connection
829 from stoqlib.domain.payment.views import PaymentMethodView
830 from stoqlib.exceptions import StoqlibError
831-from stoqlib.lib.message import marker
832 from stoqlib.lib.translation import stoqlib_gettext
833
834 N_ = _ = stoqlib_gettext
835
836=== modified file 'stoqlib/gui/slaves/userslave.py'
837--- stoqlib/gui/slaves/userslave.py 2011-09-28 19:55:17 +0000
838+++ stoqlib/gui/slaves/userslave.py 2011-11-05 17:07:26 +0000
839@@ -29,10 +29,9 @@
840 import gtk
841 from kiwi.datatypes import ValidationError
842
843-from stoqlib.database.orm import const
844 from stoqlib.database.runtime import get_current_user
845 from stoqlib.domain.profile import UserProfile
846-from stoqlib.domain.person import EmployeeRole, Person
847+from stoqlib.domain.person import EmployeeRole
848 from stoqlib.domain.interfaces import IEmployee, ISalesPerson, IUser
849 from stoqlib.gui.editors.baseeditor import BaseEditor, BaseEditorSlave
850 from stoqlib.gui.base.dialogs import run_dialog
851
852=== modified file 'stoqlib/gui/splash.py'
853--- stoqlib/gui/splash.py 2011-06-29 20:21:26 +0000
854+++ stoqlib/gui/splash.py 2011-11-05 17:07:26 +0000
855@@ -27,7 +27,6 @@
856 import time
857
858 import gobject
859-import cairo
860 import gtk
861 import pango
862 import pangocairo
863
864=== modified file 'stoqlib/gui/templates/individualtemplate.py'
865--- stoqlib/gui/templates/individualtemplate.py 2011-06-21 13:31:33 +0000
866+++ stoqlib/gui/templates/individualtemplate.py 2011-11-05 17:07:26 +0000
867@@ -140,7 +140,6 @@
868 self.birth_state.prefill(get_country_states())
869
870 def _update_marital_status(self):
871- marital_status = self.marital_status.get_selected_data()
872 if self.model.is_married():
873 self.spouse_lbl.show()
874 self.spouse_name.show()
875
876=== modified file 'stoqlib/gui/wizards/purchasewizard.py'
877--- stoqlib/gui/wizards/purchasewizard.py 2011-11-04 12:06:43 +0000
878+++ stoqlib/gui/wizards/purchasewizard.py 2011-11-05 17:07:26 +0000
879@@ -25,7 +25,6 @@
880 """ Purchase wizard definition """
881
882 import datetime
883-from decimal import Decimal
884 import sys
885
886 import gtk
887@@ -38,7 +37,7 @@
888 from stoqlib.domain.interfaces import IBranch, ITransporter, ISupplier
889 from stoqlib.domain.payment.group import PaymentGroup
890 from stoqlib.domain.payment.operation import register_payment_operations
891-from stoqlib.domain.person import Person, PersonAdaptToTransporter
892+from stoqlib.domain.person import Person
893 from stoqlib.domain.product import ProductSupplierInfo
894 from stoqlib.domain.purchase import PurchaseOrder, PurchaseItem
895 from stoqlib.domain.receiving import (ReceivingOrder, ReceivingOrderItem,
896
897=== modified file 'stoqlib/importers/branchimporter.py'
898--- stoqlib/importers/branchimporter.py 2011-02-08 14:06:58 +0000
899+++ stoqlib/importers/branchimporter.py 2011-11-05 17:07:26 +0000
900@@ -62,13 +62,16 @@
901 state=data.state,
902 country=data.country)
903 streetnumber = data.streetnumber and int(data.streetnumber) or None
904- address = Address(is_main_address=True,
905- person=person, city_location=ctloc,
906- connection=trans,
907- street=data.street,
908- streetnumber=streetnumber,
909- district=data.district,
910- postal_code=data.postal_code)
911+ Address(
912+ is_main_address=True,
913+ person=person,
914+ city_location=ctloc,
915+ connection=trans,
916+ street=data.street,
917+ streetnumber=streetnumber,
918+ district=data.district,
919+ postal_code=data.postal_code
920+ )
921
922 person.addFacet(IBranch, connection=trans)
923
924
925=== modified file 'stoqlib/importers/clientimporter.py'
926--- stoqlib/importers/clientimporter.py 2011-02-08 14:06:58 +0000
927+++ stoqlib/importers/clientimporter.py 2011-11-05 17:07:26 +0000
928@@ -59,11 +59,14 @@
929 state=data.state,
930 country=data.country)
931 streetnumber = data.streetnumber and int(data.streetnumber) or None
932- address = Address(is_main_address=True,
933- person=person, city_location=ctloc,
934- connection=trans,
935- street=data.street,
936- streetnumber=streetnumber,
937- district=data.district)
938+ Address(
939+ is_main_address=True,
940+ person=person,
941+ city_location=ctloc,
942+ connection=trans,
943+ street=data.street,
944+ streetnumber=streetnumber,
945+ district=data.district
946+ )
947
948 person.addFacet(IClient, connection=trans)
949
950=== modified file 'stoqlib/importers/creditproviderimporter.py'
951--- stoqlib/importers/creditproviderimporter.py 2011-02-08 14:06:58 +0000
952+++ stoqlib/importers/creditproviderimporter.py 2011-11-05 17:07:26 +0000
953@@ -64,12 +64,13 @@
954 state=data.state,
955 country=data.country)
956 streetnumber = data.streetnumber and int(data.streetnumber) or None
957- address = Address(is_main_address=True,
958- person=person, city_location=ctloc,
959- connection=trans,
960- street=data.street,
961- streetnumber=streetnumber,
962- district=data.district)
963+ Address(is_main_address=True,
964+ person=person,
965+ city_location=ctloc,
966+ connection=trans,
967+ street=data.street,
968+ streetnumber=streetnumber,
969+ district=data.district)
970
971 person.addFacet(ICreditProvider, connection=trans,
972 open_contract_date=const.NOW(),
973
974=== modified file 'stoqlib/importers/csvimporter.py'
975--- stoqlib/importers/csvimporter.py 2011-07-15 19:57:51 +0000
976+++ stoqlib/importers/csvimporter.py 2011-11-05 17:07:26 +0000
977@@ -73,9 +73,6 @@
978 #
979
980 def feed(self, fp, filename='<stdin>'):
981- field_names = self.fields + self.optional_fields
982-
983- t = time.time()
984 trans = new_transaction()
985 self.before_start(trans)
986 trans.commit(close=True)
987@@ -86,6 +83,7 @@
988 return len(self.rows)
989
990 def process_item(self, trans, item_no):
991+ t = time.time()
992 item = self.rows[item_no]
993 if not item or item[0].startswith('%'):
994 self.lineno += 1
995@@ -106,7 +104,7 @@
996 row = CSVRow(item, field_names)
997 try:
998 self.process_one(row, row.fields, trans)
999- except Exception, e:
1000+ except Exception:
1001 print
1002 print 'Error while processing row %d %r' % (self.lineno, row,)
1003 print
1004
1005=== modified file 'stoqlib/importers/employeeimporter.py'
1006--- stoqlib/importers/employeeimporter.py 2011-02-08 14:06:58 +0000
1007+++ stoqlib/importers/employeeimporter.py 2011-11-05 17:07:26 +0000
1008@@ -72,7 +72,7 @@
1009 registry_number=data.employee_number)
1010
1011 start = self.parse_date(data.start)
1012- role_history = EmployeeRoleHistory(
1013+ EmployeeRoleHistory(
1014 connection=trans, role=role,
1015 employee=employee,
1016 is_active=True,
1017@@ -84,12 +84,13 @@
1018 state=data.state,
1019 country=data.country)
1020 streetnumber = data.streetnumber and int(data.streetnumber) or None
1021- address = Address(is_main_address=True,
1022- person=person, city_location=ctloc,
1023- connection=trans,
1024- street=data.street,
1025- streetnumber=streetnumber,
1026- district=data.district)
1027+ Address(is_main_address=True,
1028+ person=person,
1029+ city_location=ctloc,
1030+ connection=trans,
1031+ street=data.street,
1032+ streetnumber=streetnumber,
1033+ district=data.district)
1034
1035 profile = UserProfile.selectOneBy(name=data.profile, connection=trans)
1036
1037
1038=== modified file 'stoqlib/importers/ofximporter.py'
1039--- stoqlib/importers/ofximporter.py 2011-07-19 19:18:46 +0000
1040+++ stoqlib/importers/ofximporter.py 2011-11-05 17:07:26 +0000
1041@@ -201,7 +201,6 @@
1042 value=value,
1043 date=date,
1044 connection=trans)
1045- last_date = date
1046 t.sync()
1047 return True
1048
1049
1050=== modified file 'stoqlib/importers/purchaseimporter.py'
1051--- stoqlib/importers/purchaseimporter.py 2011-02-08 14:21:07 +0000
1052+++ stoqlib/importers/purchaseimporter.py 2011-11-05 17:07:26 +0000
1053@@ -102,10 +102,12 @@
1054 connection=trans)
1055
1056 for purchase_item in purchase.get_items():
1057- receicing_item = ReceivingOrderItem(connection=trans,
1058- cost=purchase_item.sellable.cost,
1059- sellable=purchase_item.sellable,
1060- quantity=int(data.quantity),
1061- purchase_item=purchase_item,
1062- receiving_order=receiving_order)
1063+ ReceivingOrderItem(
1064+ connection=trans,
1065+ cost=purchase_item.sellable.cost,
1066+ sellable=purchase_item.sellable,
1067+ quantity=int(data.quantity),
1068+ purchase_item=purchase_item,
1069+ receiving_order=receiving_order
1070+ )
1071 receiving_order.confirm()
1072
1073=== modified file 'stoqlib/importers/serviceimporter.py'
1074--- stoqlib/importers/serviceimporter.py 2011-06-21 13:31:33 +0000
1075+++ stoqlib/importers/serviceimporter.py 2011-11-05 17:07:26 +0000
1076@@ -57,5 +57,5 @@
1077 cost=int(data.cost),
1078 code=data.barcode,
1079 barcode=data.barcode)
1080- service = Service(sellable=sellable,
1081- connection=trans)
1082+ Service(sellable=sellable,
1083+ connection=trans)
1084
1085=== modified file 'stoqlib/importers/supplierimporter.py'
1086--- stoqlib/importers/supplierimporter.py 2011-02-08 14:06:58 +0000
1087+++ stoqlib/importers/supplierimporter.py 2011-11-05 17:07:26 +0000
1088@@ -61,12 +61,15 @@
1089 state=data.state,
1090 country=data.country)
1091 streetnumber = data.streetnumber and int(data.streetnumber) or None
1092- address = Address(is_main_address=True,
1093- person=person, city_location=ctloc,
1094- connection=trans,
1095- street=data.street,
1096- streetnumber=streetnumber,
1097- district=data.district)
1098+ Address(
1099+ is_main_address=True,
1100+ person=person,
1101+ city_location=ctloc,
1102+ connection=trans,
1103+ street=data.street,
1104+ streetnumber=streetnumber,
1105+ district=data.district
1106+ )
1107
1108 person.addFacet(ISupplier, connection=trans)
1109
1110
1111=== modified file 'stoqlib/importers/transporterimporter.py'
1112--- stoqlib/importers/transporterimporter.py 2011-06-21 13:31:33 +0000
1113+++ stoqlib/importers/transporterimporter.py 2011-11-05 17:07:26 +0000
1114@@ -62,12 +62,15 @@
1115 state=data.state,
1116 country=data.country)
1117 streetnumber = data.streetnumber and int(data.streetnumber) or None
1118- address = Address(is_main_address=True,
1119- person=person, city_location=ctloc,
1120- connection=trans,
1121- street=data.street,
1122- streetnumber=streetnumber,
1123- district=data.district)
1124+ Address(
1125+ is_main_address=True,
1126+ person=person,
1127+ city_location=ctloc,
1128+ connection=trans,
1129+ street=data.street,
1130+ streetnumber=streetnumber,
1131+ district=data.district
1132+ )
1133
1134 dict(open_contract_date=self.parse_date(data.open_contract),
1135 freight_percentage=data.freight_percentage),
1136
1137=== modified file 'stoqlib/lib/devicemanager.py'
1138--- stoqlib/lib/devicemanager.py 2011-04-18 21:23:31 +0000
1139+++ stoqlib/lib/devicemanager.py 2011-11-05 17:07:26 +0000
1140@@ -30,6 +30,7 @@
1141
1142 try:
1143 import gudev
1144+ gudev # pyflakes
1145 except ImportError:
1146 gudev = None
1147
1148
1149=== modified file 'stoqlib/lib/imageutils.py'
1150--- stoqlib/lib/imageutils.py 2011-09-12 20:14:28 +0000
1151+++ stoqlib/lib/imageutils.py 2011-11-05 17:07:26 +0000
1152@@ -31,8 +31,6 @@
1153 import gtk
1154 import gobject
1155
1156-from kiwi.environ import environ
1157-
1158
1159 class ImageHelper(object):
1160
1161
1162=== modified file 'stoqlib/lib/test/test_ofximporter.py'
1163--- stoqlib/lib/test/test_ofximporter.py 2011-06-17 17:11:48 +0000
1164+++ stoqlib/lib/test/test_ofximporter.py 2011-11-05 17:07:26 +0000
1165@@ -24,11 +24,9 @@
1166 from decimal import Decimal
1167 import operator
1168
1169-from stoqlib.database.runtime import new_transaction
1170 from stoqlib.domain.account import Account
1171 from stoqlib.domain.test.domaintest import DomainTest
1172 from stoqlib.importers.ofximporter import OFXImporter
1173-from stoqlib.lib.parameters import sysparam
1174
1175
1176 OFX_DATA = """OFXHEADER:100
1177@@ -218,7 +216,6 @@
1178 ofx.feed(StringIO(OFX_DATA))
1179 ofx.set_dry(True)
1180 ofx.process(self.trans)
1181- imbalance_account = sysparam(self.trans).IMBALANCE_ACCOUNT
1182 account = Account.select(connection=self.trans).orderBy('id')[-1]
1183 self.failUnless(account)
1184 self.assertEquals(account.description, "Bank - CHECKING")
1185@@ -236,7 +233,6 @@
1186 ofx.feed(StringIO(OFX_DATA2))
1187 ofx.set_dry(True)
1188 ofx.process(self.trans)
1189- imbalance_account = sysparam(self.trans).IMBALANCE_ACCOUNT
1190 account = Account.select(connection=self.trans).orderBy('id')[-1]
1191 self.failUnless(account)
1192 self.assertEquals(account.description, "Banco do Brasil - CHECKING")
1193@@ -254,8 +250,6 @@
1194 ofx.feed(StringIO(OFX_DATA3))
1195 ofx.set_dry(True)
1196 ofx.process(self.trans)
1197- imbalance_account = sysparam(self.trans).IMBALANCE_ACCOUNT
1198- trans = new_transaction()
1199 account = Account.select(connection=self.trans).orderBy('id')[-1]
1200 self.failUnless(account)
1201 self.assertEquals(account.description, "SANTANDER - CHECKING")
1202
1203=== modified file 'stoqlib/lib/test/test_parameters.py'
1204--- stoqlib/lib/test/test_parameters.py 2011-06-17 20:40:14 +0000
1205+++ stoqlib/lib/test/test_parameters.py 2011-11-05 17:07:26 +0000
1206@@ -46,11 +46,11 @@
1207 person = Person(name='Jonas', connection=self.trans)
1208 person.addFacet(IIndividual, connection=self.trans)
1209 role = EmployeeRole(connection=self.trans, name='desenvolvedor')
1210- employee = person.addFacet(IEmployee, connection=self.trans,
1211- role=role)
1212+ person.addFacet(IEmployee, connection=self.trans,
1213+ role=role)
1214 self.salesperson = person.addFacet(ISalesPerson,
1215 connection=self.trans)
1216- company = person.addFacet(ICompany, connection=self.trans)
1217+ person.addFacet(ICompany, connection=self.trans)
1218 client = person.addFacet(IClient, connection=self.trans)
1219 self.branch = person.addFacet(IBranch, connection=self.trans)
1220
1221@@ -100,7 +100,6 @@
1222
1223 def testUseLogicQuantity(self):
1224 storable = self.create_storable()
1225- param = self.sparam.USE_LOGIC_QUANTITY
1226 self.assertEqual(storable._check_logic_quantity(), None)
1227 self.sparam.update_parameter(parameter_name='USE_LOGIC_QUANTITY',
1228 value=u'0')
1229
1230=== modified file 'stoqlib/lib/test/test_sintegra.py'
1231--- stoqlib/lib/test/test_sintegra.py 2008-10-01 16:11:05 +0000
1232+++ stoqlib/lib/test/test_sintegra.py 2011-11-05 17:07:26 +0000
1233@@ -20,7 +20,6 @@
1234 ## Foundation, Inc., or visit: http://www.gnu.org/.
1235 ##
1236
1237-from cStringIO import StringIO
1238 import datetime
1239 from decimal import Decimal
1240 import os
1241@@ -40,7 +39,6 @@
1242 expected = basename + '-expected.txt'
1243 output = basename + '-output.txt'
1244
1245- fp = StringIO()
1246 sfile.write(output)
1247 expected = os.path.join(test.__path__[0], expected)
1248 retval = diff_files(expected, output)
1249
1250=== modified file 'stoqlib/lib/test/test_sintegragenerator.py'
1251--- stoqlib/lib/test/test_sintegragenerator.py 2011-02-08 14:21:07 +0000
1252+++ stoqlib/lib/test/test_sintegragenerator.py 2011-11-05 17:07:26 +0000
1253@@ -77,8 +77,8 @@
1254 sale.order()
1255
1256 method = PaymentMethod.get_by_name(self.trans, 'money')
1257- payment = method.create_inpayment(sale.group,
1258- sale.get_sale_subtotal())
1259+ method.create_inpayment(sale.group,
1260+ sale.get_sale_subtotal())
1261
1262 sale.confirm()
1263 sale.set_paid()
1264
1265=== modified file 'stoqlib/lib/xmlrpc.py'
1266--- stoqlib/lib/xmlrpc.py 2011-09-12 18:10:48 +0000
1267+++ stoqlib/lib/xmlrpc.py 2011-11-05 17:07:26 +0000
1268@@ -62,7 +62,7 @@
1269 try:
1270 exc = namedAny(exc_name)
1271 raise exc(msg)
1272- except Exception, unused:
1273+ except Exception:
1274 # In case server/client side is out of sync
1275 raise Exception(msg)
1276
1277
1278=== modified file 'stoqlib/reporting/product.py'
1279--- stoqlib/reporting/product.py 2011-07-11 17:33:47 +0000
1280+++ stoqlib/reporting/product.py 2011-11-05 17:07:26 +0000
1281@@ -26,7 +26,6 @@
1282
1283 from decimal import Decimal
1284
1285-from stoqlib.database.runtime import get_connection, get_current_branch
1286 from stoqlib.reporting.template import (SearchResultsReport, PriceReport,
1287 ObjectListReport)
1288 from stoqlib.reporting.base.tables import ObjectTableColumn as OTC
1289
1290=== modified file 'stoqlib/reporting/purchase.py'
1291--- stoqlib/reporting/purchase.py 2011-10-17 19:36:32 +0000
1292+++ stoqlib/reporting/purchase.py 2011-11-05 17:07:26 +0000
1293@@ -277,7 +277,6 @@
1294 table_line=TABLE_LINE_BLANK, width=730)
1295
1296 def _setup_items_table(self):
1297- items = self._order.get_items()
1298 # XXX: Stoqlib Reporting try to apply len() on the table data, but
1299 # Purchase's get_items returns a SelectResult instance (ORMObject)
1300 # that not supports the len operator.
1301
1302=== modified file 'stoqlib/reporting/sale.py'
1303--- stoqlib/reporting/sale.py 2011-07-26 13:53:02 +0000
1304+++ stoqlib/reporting/sale.py 2011-11-05 17:07:26 +0000
1305@@ -324,8 +324,6 @@
1306 if total_amount:
1307 va = total_amount/sales_qty
1308 text = _("Sold value per sales %s") % (get_formatted_price(va,))
1309- total_sellables = sum([item.sale.get_items_total_quantity()
1310- for item in self.salesperson_list])
1311
1312 self.add_object_table(self.salesperson_list, self._get_columns(),
1313 summary_row=summary_row)
1314
1315=== modified file 'stoqlib/reporting/template.py'
1316--- stoqlib/reporting/template.py 2011-07-11 17:33:47 +0000
1317+++ stoqlib/reporting/template.py 2011-11-05 17:07:26 +0000
1318@@ -379,7 +379,6 @@
1319 """
1320 conn = get_connection()
1321 branch = get_current_branch(conn)
1322- branch_address = branch.person.address
1323 logo = _get_logotype_path(conn)
1324
1325 ns['title'] = self.title
1326
1327=== modified file 'stoqlib/reporting/tests/test_reporting.py'
1328--- stoqlib/reporting/tests/test_reporting.py 2011-11-05 16:46:12 +0000
1329+++ stoqlib/reporting/tests/test_reporting.py 2011-11-05 17:07:26 +0000
1330@@ -271,18 +271,18 @@
1331 storable = product.addFacet(IStorable, connection=self.trans)
1332 storable.increase_stock(100, get_current_branch(self.trans))
1333
1334- source = CommissionSource(sellable=sellable,
1335- direct_value=Decimal(10),
1336- installments_value=1,
1337- connection=self.trans)
1338+ CommissionSource(sellable=sellable,
1339+ direct_value=Decimal(10),
1340+ installments_value=1,
1341+ connection=self.trans)
1342
1343 sale.order()
1344
1345 method = PaymentMethod.get_by_name(self.trans, 'money')
1346 till = Till.get_last_opened(self.trans)
1347- payment = method.create_inpayment(sale.group,
1348- sale.get_sale_subtotal(),
1349- till=till)
1350+ method.create_inpayment(sale.group,
1351+ sale.get_sale_subtotal(),
1352+ till=till)
1353 sale.confirm()
1354 sale.set_paid()
1355
1356
1357=== added file 'stoqlib/test/test_pyflakes.py'
1358--- stoqlib/test/test_pyflakes.py 1970-01-01 00:00:00 +0000
1359+++ stoqlib/test/test_pyflakes.py 2011-11-05 17:07:26 +0000
1360@@ -0,0 +1,68 @@
1361+# -*- coding: utf-8 -*-
1362+# vi:si:et:sw=4:sts=4:ts=4
1363+
1364+##
1365+## Copyright (C) 2011 Async Open Source <http://www.async.com.br>
1366+## All rights reserved
1367+##
1368+## This program is free software; you can redistribute it and/or modify
1369+## it under the terms of the GNU General Public License as published by
1370+## the Free Software Foundation; either version 2 of the License, or
1371+## (at your option) any later version.
1372+##
1373+## This program is distributed in the hope that it will be useful,
1374+## but WITHOUT ANY WARRANTY; without even the implied warranty of
1375+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1376+## GNU General Public License for more details.
1377+##
1378+## You should have received a copy of the GNU General Public License
1379+## along with this program; if not, write to the Free Software
1380+## Foundation, Inc., or visit: http://www.gnu.org/.
1381+##
1382+## Author(s): Stoq Team <stoq-devel@async.com.br>
1383+##
1384+"""Test pyflakes on stoq, stoqlib and plugins directories
1385+
1386+Useful to early find syntax errors and other common problems.
1387+"""
1388+
1389+import sys
1390+import os.path
1391+
1392+from twisted.trial import unittest
1393+try:
1394+ from pyflakes.scripts import pyflakes
1395+ pyflakes # pyflakes (ironique ah?)
1396+except ImportError:
1397+ pyflakes = None
1398+
1399+
1400+class TestPyflakes(unittest.TestCase):
1401+
1402+ def __init__(self, *args, **kwargs):
1403+ super(TestPyflakes, self).__init__(*args, **kwargs)
1404+
1405+ def _test_path(self, path_name):
1406+ # Skip test if user doesn't have pyflakes installed.
1407+ if not pyflakes:
1408+ raise unittest.SkipTest("Pyflakes not installed")
1409+
1410+ test_path = None
1411+ for path in sys.path:
1412+ if path.endswith('stoq'):
1413+ test_path = path
1414+ break
1415+ self.assertTrue(test_path)
1416+
1417+ path = os.path.join(test_path, path_name)
1418+ retval = pyflakes.main([path])
1419+ self.assertEqual(retval, 0)
1420+
1421+
1422+for subpath in ('stoq', 'stoqlib', 'plugins'):
1423+ # subpath has to be passed as a kw, or it will always be plugins (the
1424+ # last subpath variable on for).
1425+ func = lambda self, subpath=subpath: self._test_path(subpath)
1426+ name = 'test_%s_pyflakes' % (subpath,)
1427+ func.__name__ = name
1428+ setattr(TestPyflakes, name, func)

Subscribers

People subscribed via source and target branches