예제 #1
0
파일: asset.py 프로젝트: 00/wikihouse
  
"""

__all__ = [
    'ManifestedStaticURLGenerator'
]

from itertools import cycle

from zope.component import adapts
from zope.interface import implements

from weblayer.interfaces import IRequest, ISettings, IStaticURLGenerator
from weblayer.settings import require_setting

require_setting('static_url_prefix', default=u'/static/')
require_setting('assetgen_manifest')

class ManifestedStaticURLGenerator(object):
    """ Adapter to generate static URLs using an `Assetgen`_ manifest file.
      
      _`Assetgen`: http://pypi.python.org/pypi/assetgen
      
    """
    
    adapts(IRequest, ISettings)
    implements(IStaticURLGenerator)
    
    def __init__(self, request, settings):
        self._dev = settings.get('dev', False)
        self._host = settings.get('static_host', request.host)
예제 #2
0
파일: require.py 프로젝트: thruflo/weblayer
from weblayer.settings import require, require_setting
from weblayer.settings import override, override_setting

require_setting('test_module', category='weblayer.tests')

@require('test_function', category='weblayer.tests')
def foo(): # pragma: no cover
    pass


class Foo(object):
    @require('test_method', category='weblayer.tests')
    def bar(self): # pragma: no cover
        pass
    

예제 #3
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from weblayer.settings import require_setting, override

require_setting(
    'test_override_function', 
    default='something', 
    category='weblayer.tests'
)

@override(
    'test_override_function', 
    default='something else', 
    category='weblayer.tests'
)
def foo(): # pragma: no cover
    pass

예제 #4
0
파일: asset.py 프로젝트: todun/wikihouse
  
  _`Assetgen`: http://pypi.python.org/pypi/assetgen
  
"""

__all__ = ['ManifestedStaticURLGenerator']

from itertools import cycle

from zope.component import adapts
from zope.interface import implements

from weblayer.interfaces import IRequest, ISettings, IStaticURLGenerator
from weblayer.settings import require_setting

require_setting('static_url_prefix', default=u'/static/')
require_setting('assetgen_manifest')


class ManifestedStaticURLGenerator(object):
    """ Adapter to generate static URLs using an `Assetgen`_ manifest file.
      
      _`Assetgen`: http://pypi.python.org/pypi/assetgen
      
    """

    adapts(IRequest, ISettings)
    implements(IStaticURLGenerator)

    def __init__(self, request, settings):
        self._dev = settings.get('dev', False)
예제 #5
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from weblayer.settings import require_setting, override

require_setting('test_override_function',
                default='something',
                category='weblayer.tests')


@override('test_override_function',
          default='something else',
          category='weblayer.tests')
def foo():  # pragma: no cover
    pass