~ubuntu-branches/ubuntu/jaunty/python-django/jaunty-updates

« back to all changes in this revision

Viewing changes to django/contrib/gis/gdal/layer.py

  • Committer: Bazaar Package Importer
  • Author(s): Scott James Remnant
  • Date: 2008-11-15 19:15:33 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20081115191533-xbt1ut2xf4fvwtvc
Tags: 1.0.1-0ubuntu1
* New upstream release:
  - Bug fixes.

* The tests/ sub-directory appaers to have been dropped upstream, so pull
  our patch to workaround the tests and modify the rules.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
    "A class that wraps an OGR Layer, needs to be instantiated from a DataSource object."
26
26
 
27
27
    #### Python 'magic' routines ####
28
 
    def __init__(self, layer_ptr):
29
 
        "Needs a C pointer (Python/ctypes integer) in order to initialize."
 
28
    def __init__(self, layer_ptr, ds):
 
29
        """
 
30
        Initializes on an OGR C pointer to the Layer and the `DataSource` object
 
31
        that owns this layer.  The `DataSource` object is required so that a 
 
32
        reference to it is kept with this Layer.  This prevents garbage 
 
33
        collection of the `DataSource` while this Layer is still active.
 
34
        """
30
35
        self._ptr = None # Initially NULL
31
36
        if not layer_ptr:
32
37
            raise OGRException('Cannot create Layer, invalid pointer given')
33
38
        self._ptr = layer_ptr
 
39
        self._ds = ds
34
40
        self._ldefn = get_layer_defn(self._ptr)
35
41
        # Does the Layer support random reading?
36
42
        self._random_read = self.test_capability('RandomRead')