~ubuntu-branches/ubuntu/utopic/python-apptools/utopic

« back to all changes in this revision

Viewing changes to enthought/naming/pyfs_initial_context_factory.py

  • Committer: Bazaar Package Importer
  • Author(s): Varun Hiremath
  • Date: 2011-07-08 23:55:50 UTC
  • mfrom: (2.1.9 sid)
  • Revision ID: james.westby@ubuntu.com-20110708235550-yz5u79ubeo4dhyfx
Tags: 4.0.0-1
* New upstream release
* Update debian/watch file

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#------------------------------------------------------------------------------
2
 
# Copyright (c) 2005, Enthought, Inc.
3
 
# All rights reserved.
4
 
5
 
# This software is provided without warranty under the terms of the BSD
6
 
# license included in enthought/LICENSE.txt and may be redistributed only
7
 
# under the conditions described in the aforementioned license.  The license
8
 
# is also available online at http://www.enthought.com/licenses/BSD.txt
9
 
# Thanks for using Enthought open source!
10
 
11
 
# Author: Enthought, Inc.
12
 
# Description: <Enthought naming package component>
13
 
#------------------------------------------------------------------------------
14
 
""" The initial context factory for Python file system contexts. """
15
 
 
16
 
 
17
 
# Local imports.
18
 
from context import Context
19
 
from initial_context_factory import InitialContextFactory
20
 
from object_serializer import ObjectSerializer
21
 
from pyfs_context import PyFSContext
22
 
from pyfs_context_factory import PyFSContextFactory
23
 
from pyfs_object_factory import PyFSObjectFactory
24
 
from pyfs_state_factory import PyFSStateFactory
25
 
 
26
 
 
27
 
class PyFSInitialContextFactory(InitialContextFactory):
28
 
    """ The initial context factory for Python file system contexts. """
29
 
 
30
 
    ###########################################################################
31
 
    # 'InitialContextFactory' interface.
32
 
    ###########################################################################
33
 
 
34
 
    def get_initial_context(self, environment):
35
 
        """ Creates an initial context for beginning name resolution. """
36
 
 
37
 
        # Object factories.
38
 
        object_factories = [PyFSObjectFactory(), PyFSContextFactory()]
39
 
        environment[Context.OBJECT_FACTORIES] = object_factories
40
 
 
41
 
        # State factories.
42
 
        state_factories = [PyFSStateFactory()]
43
 
        environment[Context.STATE_FACTORIES] = state_factories
44
 
 
45
 
        # Object serializers.
46
 
        object_serializers = [ObjectSerializer()]
47
 
        environment[PyFSContext.OBJECT_SERIALIZERS] = object_serializers
48
 
 
49
 
        return PyFSContext(path=r'', environment=environment)
50
 
 
51
 
#### EOF ######################################################################