Browse Source

Change uri test to make it work on windows. Fix #47

pull/58/head
Florian Mounier 12 years ago
parent
commit
643373c8d9
  1. 5
      pygal/_compat.py
  2. 8
      pygal/svg.py

5
pygal/_compat.py

@ -18,11 +18,6 @@
# along with pygal. If not, see <http://www.gnu.org/licenses/>.
import sys
try:
from urllib.parse import urlparse
except ImportError:
from urlparse import urlparse
def to_str(string):
if sys.version_info[0] == 3:

8
pygal/svg.py

@ -22,7 +22,7 @@ Svg helper
"""
from __future__ import division
from pygal._compat import urlparse, to_str, u
from pygal._compat import to_str, u
import io
import os
import json
@ -57,7 +57,7 @@ class Svg(object):
self.root.append(
etree.Comment(u(
'Generated with pygal %s ©Kozea 2011-2013 on %s' % (
__version__, date.today().isoformat()))))
__version__, date.today().isoformat()))))
self.root.append(etree.Comment(u('http://pygal.org')))
self.root.append(etree.Comment(u('http://github.com/Kozea/pygal')))
self.defs = self.node(tag='defs')
@ -69,7 +69,7 @@ class Svg(object):
colors = self.graph.style.get_colors(self.id)
all_css = []
for css in ['base.css'] + list(self.graph.css):
if urlparse(css).scheme:
if '://' in css:
self.processing_instructions.append(
etree.PI(
u('xml-stylesheet'), u('href="%s"' % css)))
@ -97,7 +97,7 @@ class Svg(object):
("window.config", json.dumps(self.graph.config.to_dict())))
for js in self.graph.js:
if urlparse(js).scheme:
if '://' in js:
self.node(
self.defs, 'script', type='text/javascript', href=js)
else:

Loading…
Cancel
Save