~lazr-developers/lazr.restful/oops-fix

« back to all changes in this revision

Viewing changes to src/lazr/restful/example/base/root.py

  • Committer: Leonard Richardson
  • Date: 2009-09-02 19:37:43 UTC
  • mfrom: (66.2.14 grok)
  • Revision ID: leonard.richardson@canonical.com-20090902193743-n9dijkeifk6ojhc4
[r=gary] Use grok to define web service configuration classes more idiomatically.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
 
22
22
from lazr.restful import ServiceRootResource
23
23
 
 
24
from lazr.restful import directives
24
25
from lazr.restful.interfaces import (
25
26
    IByteStorage, IEntry, IServiceRootResource, ITopLevelEntryLink,
26
27
    IWebServiceConfiguration)
27
28
from lazr.restful.example.base.interfaces import (
28
29
    AlreadyNew, Cuisine, ICookbook, ICookbookSet, IDish, IDishSet,
29
30
    IFileManager, IRecipe, IRecipeSet, IHasGet, NameAlreadyTaken)
30
 
from lazr.restful.simple import make_simple_configuration
 
31
from lazr.restful.simple import BaseWebServiceConfiguration
31
32
from lazr.restful.testing.webservice import WebServiceTestPublication
32
33
 
33
34
 
35
36
class CookbookWebServiceObject:
36
37
    """A basic object published through the web service."""
37
38
 
 
39
 
38
40
class SimpleByteStorage(CookbookWebServiceObject,
39
41
                        grokcore.component.MultiAdapter):
40
42
    """A simple IByteStorage implementation"""
373
375
 
374
376
# Define the web service configuration.
375
377
 
376
 
attributes = dict(
377
 
    code_revision='test.revision',
378
 
    default_batch_size=5,
379
 
    hostname='cookbooks.dev',
380
 
    match_batch_size=50,
381
 
    service_version_uri_prefix='1.0',
382
 
    use_https=False,
383
 
    view_permission='lazr.restful.example.base.View',
384
 
    )
 
378
class WebServiceConfiguration(BaseWebServiceConfiguration):
 
379
    directives.publication_class(WebServiceTestPublication)
 
380
    code_revision='test.revision'
 
381
    default_batch_size=5
 
382
    hostname='cookbooks.dev'
 
383
    match_batch_size=50
 
384
    service_version_uri_prefix='1.0'
 
385
    use_https=False
 
386
    view_permission='lazr.restful.example.base.View'
385
387
 
386
 
WebServiceConfiguration = make_simple_configuration(
387
 
    attributes, publication_class=WebServiceTestPublication)
388
 
grokcore.component.global_utility(WebServiceConfiguration)