Skip to content

Commit

Permalink
Fix fallbacks if the reportlab.barcode.graphics package is not installed
Browse files Browse the repository at this point in the history
(which is the case with the default setup (sigh).
  • Loading branch information
strichter committed Mar 18, 2007
1 parent 22dc173 commit dcf9395
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 9 deletions.
8 changes: 0 additions & 8 deletions src/z3c/rml/chart.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,6 @@
from reportlab.graphics.charts import spider, doughnut
from z3c.rml import attr, element

try:
import reportlab.graphics.barcode
except ImportError:
# barcode package has not been installed
import reportlab.graphics
reportlab.graphics.barcode = types.ModuleType('barcode')
reportlab.graphics.barcode.getCodeNames = lambda : ()

# Patches against Reportlab 2.0
lineplots.Formatter = reportlab.lib.formatters.Formatter

Expand Down
3 changes: 2 additions & 1 deletion src/z3c/rml/flowable.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@
import reportlab.graphics.barcode
except ImportError:
# barcode package has not been installed
import types
import reportlab.graphics
reportlab.graphics.barcode = types.ModuleType('barcode')
reportlab.graphics.barcode.getCodeNames = lambda : ()
reportlab.graphics.barcode.createBarcodeDrawing = None

class Flowable(element.FunctionElement):
klass=None
Expand Down
1 change: 1 addition & 0 deletions src/z3c/rml/form.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import reportlab.graphics.barcode
except ImportError:
# barcode package has not been installed
import types
import reportlab.graphics
reportlab.graphics.barcode = types.ModuleType('barcode')
reportlab.graphics.barcode.getCodeNames = lambda : ()
Expand Down

0 comments on commit dcf9395

Please sign in to comment.