Ejemplo n.º 1
0
 def __init__(self, id, **kwargs):
     Resource.__init__(self, id, **kwargs)
     self._data['inline'] = kwargs.get('inline', False)
     self._data['compression'] = kwargs.get('compression', 'safe')
     if self.isExternal:
         self._data['inline'] = False #No inline rendering for External Resources
         self._data['compression'] = 'none' #External Resources are not compressible
Ejemplo n.º 2
0
 def __init__(self, id, **kwargs):
     Resource.__init__(self, id, **kwargs)
     self._data['media'] = kwargs.get('media', 'screen')
     self._data['rel'] = kwargs.get('rel', 'stylesheet')
     self._data['rendering'] = kwargs.get('rendering', 'link')
     self._data['compression'] = kwargs.get('compression', 'safe')
     self._data['applyPrefix'] = kwargs.get('applyPrefix', False)
 def __init__(self, id, **kwargs):
     Resource.__init__(self, id, **kwargs)
     self._data['inline'] = kwargs.get('inline', False)
     self._data['compression'] = kwargs.get('compression', 'safe')
     if self.isExternal:
         self._data['inline'] = False #No inline rendering for External Resources
         self._data['compression'] = 'none' #External Resources are not compressible
Ejemplo n.º 4
0
 def __init__(self, id, **kwargs):
     Resource.__init__(self, id, **kwargs)
     self._data['media'] = kwargs.get('media', '')
     self._data['rel'] = kwargs.get('rel', 'stylesheet')
     self._data['title'] = kwargs.get('title', '')
     self._data['rendering'] = kwargs.get('rendering', 'import')
     self._data['compression'] = kwargs.get('compression', 'safe')
Ejemplo n.º 5
0
 def __init__(self, id, **kwargs):
     Resource.__init__(self, id, **kwargs)
     self._data['media'] = kwargs.get('media', 'screen')
     self._data['rel'] = kwargs.get('rel', 'stylesheet')
     self._data['rendering'] = kwargs.get('rendering', 'link')
     self._data['compression'] = kwargs.get('compression', 'safe')
     self._data['applyPrefix'] = kwargs.get('applyPrefix', False)
 def __init__(self, id, **kwargs):
     Resource.__init__(self, id, **kwargs)
     self._data["media"] = kwargs.get("media", "screen")
     self._data["rel"] = kwargs.get("rel", "stylesheet")
     self._data["title"] = kwargs.get("title", "")
     self._data["rendering"] = kwargs.get("rendering", "link")
     self._data["compression"] = kwargs.get("compression", "safe")
     self._data["applyPrefix"] = kwargs.get("applyPrefix", False)
     if self.isExternal:
         if self._data["compression"] not in config.CSS_EXTERNAL_COMPRESSION_METHODS:
             self._data["compression"] = "none"  # we have to assume none because of the default values
         if self._data["rendering"] not in config.CSS_EXTERNAL_RENDER_METHODS:
             raise ValueError("Render method %s not allowed for External Resource" % (self._data["rendering"],))
 def __init__(self, id, **kwargs):
     Resource.__init__(self, id, **kwargs)
     self._data['media'] = kwargs.get('media', 'screen')
     self._data['rel'] = kwargs.get('rel', 'stylesheet')
     self._data['title'] = kwargs.get('title', '')
     self._data['rendering'] = kwargs.get('rendering', 'link')
     self._data['compression'] = kwargs.get('compression', 'safe')
     self._data['applyPrefix'] = kwargs.get('applyPrefix', False)
     if self.isExternal:
         if self._data['compression'] not in config.CSS_EXTERNAL_COMPRESSION_METHODS:
             self._data['compression'] = 'none' #we have to assume none because of the default values
         if self._data['rendering'] not in config.CSS_EXTERNAL_RENDER_METHODS:
             raise ValueError("Render method %s not allowed for External Resource" % (self._data['rendering'],))
Ejemplo n.º 8
0
 def __init__(self, id, **kwargs):
     Resource.__init__(self, id, **kwargs)
     self._data['media'] = kwargs.get('media', 'screen')
     self._data['rel'] = kwargs.get('rel', 'stylesheet')
     self._data['title'] = kwargs.get('title', '')
     self._data['rendering'] = kwargs.get('rendering', 'link')
     self._data['compression'] = kwargs.get('compression', 'safe')
     self._data['applyPrefix'] = kwargs.get('applyPrefix', False)
     if self.isExternal:
         if id.startswith('//') and self._data['rendering'] != 'link':
             # force a link. it doesn't make sense any other way
             logging.warning(u'Stylesheets beginning with // must be rendered as links. Updated for you.')
             self._data['rendering'] = 'link'
         if self._data['compression'] not in config.CSS_EXTERNAL_COMPRESSION_METHODS:
             self._data['compression'] = 'none' #we have to assume none because of the default values
         if self._data['rendering'] not in config.CSS_EXTERNAL_RENDER_METHODS:
             raise ValueError("Render method %s not allowed for External Resource" % (self._data['rendering'],))
 def __init__(self, id, **kwargs):
     Resource.__init__(self, id, **kwargs)
     self._data['media'] = kwargs.get('media', 'screen')
     self._data['rel'] = kwargs.get('rel', 'stylesheet')
     self._data['title'] = kwargs.get('title', '')
     self._data['rendering'] = kwargs.get('rendering', 'link')
     self._data['compression'] = kwargs.get('compression', 'safe')
     self._data['applyPrefix'] = kwargs.get('applyPrefix', False)
     if self.isExternal:
         if self._data[
                 'compression'] not in config.CSS_EXTERNAL_COMPRESSION_METHODS:
             self._data[
                 'compression'] = 'none'  #we have to assume none because of the default values
         if self._data[
                 'rendering'] not in config.CSS_EXTERNAL_RENDER_METHODS:
             raise ValueError(
                 "Render method %s not allowed for External Resource" %
                 (self._data['rendering'], ))
 def testTraversableResourceID(self):
     ids = {
         '/bar.res': False,  #expected to fail
         'bar.res': True,  #expected to pass
         'bar.//res': False,  #expected to fail
         'bar.res/': False,  #expected to fail
         'foo/bar.res': True,  #perfectly fine
         'http://example.com/example.res': True,  #This should work now
     }
     for id in ids:
         if ids[id]:  #This shouldn't error
             Resource(id)
         else:  #This should throw a ValueError
             self.failUnlessRaises(ValueError, Resource, id)
             self.assertRaises(ValueError, Resource, id)
 def __init__(self, id, **kwargs):
     Resource.__init__(self, id, **kwargs)
     self._data['compression'] = kwargs.get('compression', 'safe')
     if self.isExternal:
         self._data['compression'] = 'none' #External resources are not compressable
Ejemplo n.º 12
0
 def __init__(self, id, **kwargs):
     Resource.__init__(self, id, **kwargs)
     self._data["compression"] = kwargs.get("compression", "safe")
Ejemplo n.º 13
0
 def __init__(self, id, **kwargs):
     Resource.__init__(self, id, **kwargs)
     self._data['compression'] = kwargs.get('compression', 'safe')
     if self.isExternal:
         self._data[
             'compression'] = 'none'  #External resources are not compressable
Ejemplo n.º 14
0
 def __init__(self, id, **kwargs):
     Resource.__init__(self, id, **kwargs)
     self._data['inline'] = kwargs.get('inline', False)
     self._data['compression'] = kwargs.get('compression', 'safe')
 def __init__(self, id, **kwargs):
     Resource.__init__(self, id, **kwargs)
     self._data["compression"] = kwargs.get("compression", "safe")
     if self.isExternal:
         self._data["compression"] = "none"  # External resources are not compressable
 def testGenerateId(self):
     self.failIf('++' in self.registry.generateId(
         Resource('++resource++foobar.css')))
     self.failIf('/' in self.registry.generateId(
         Resource('++resource++foo/bar.css')))