227 |
self.tables.append(transient_table) |
self.tables.append(transient_table) |
228 |
return transient_table |
return transient_table |
229 |
|
|
230 |
|
def RemoveTable(self, table): |
231 |
|
"""Remove the table from the session. |
232 |
|
|
233 |
|
The table object must be a table object previously returned by |
234 |
|
the AddTable method. If the table is not part of the session |
235 |
|
raise a ValueError. |
236 |
|
""" |
237 |
|
tables = [t for t in self.tables if t is not table] |
238 |
|
if len(tables) == len(self.tables): |
239 |
|
raise ValueError |
240 |
|
self.tables = tables |
241 |
|
|
242 |
def temp_directory(self): |
def temp_directory(self): |
243 |
""" |
""" |
244 |
Return the name of the directory for session specific temporary files |
Return the name of the directory for session specific temporary files |
258 |
self._add_shapestore(store) |
self._add_shapestore(store) |
259 |
return store |
return store |
260 |
|
|
261 |
|
def AddShapeStore(self, shapestore): |
262 |
|
"""Add the shapestore to the session. |
263 |
|
|
264 |
|
The session only holds a weak reference to the shapestore, so it |
265 |
|
will automatically be removed from the session when the last |
266 |
|
reference goes away. |
267 |
|
""" |
268 |
|
self._add_shapestore(shapestore) |
269 |
|
return shapestore |
270 |
|
|
271 |
def TransientDB(self): |
def TransientDB(self): |
272 |
if self.transient_db is None: |
if self.transient_db is None: |
273 |
filename = os.path.join(self.temp_directory(), "transientdb") |
filename = os.path.join(self.temp_directory(), "transientdb") |