~ubuntu-branches/ubuntu/trusty/heat/trusty

« back to all changes in this revision

Viewing changes to heat/db/sqlalchemy/mutable.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short, Chuck Short, Adam Gandelman
  • Date: 2013-09-08 21:51:19 UTC
  • mfrom: (1.1.4)
  • Revision ID: package-import@ubuntu.com-20130908215119-r939tu4aumqgdrkx
Tags: 2013.2~b3-0ubuntu1
[ Chuck Short ]
* New upstream release.
* debian/control: Add python-netaddr as build-dep.
* debian/heat-common.install: Remove heat-boto and associated man-page
* debian/heat-common.install: Remove heat-cfn and associated man-page
* debian/heat-common.install: Remove heat-watch and associated man-page
* debian/patches/fix-sqlalchemy-0.8.patch: Dropped

[ Adam Gandelman ]
* debian/patches/default-kombu.patch: Dropped.
* debian/patches/default-sqlite.patch: Refreshed.
* debian/*.install, rules: Install heat.conf.sample as common
  config file in heat-common. Drop other per-package configs, they
  are no longer used.
* debian/rules: Clean pbr .egg from build dir if it exists.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# vim: tabstop=4 shiftwidth=4 softtabstop=4
 
2
#
 
3
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
 
4
#    not use this file except in compliance with the License. You may obtain
 
5
#    a copy of the License at
 
6
#
 
7
#         http://www.apache.org/licenses/LICENSE-2.0
 
8
#
 
9
#    Unless required by applicable law or agreed to in writing, software
 
10
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 
11
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 
12
#    License for the specific language governing permissions and limitations
 
13
#    under the License.
 
14
#
 
15
# The MIT License
 
16
#
 
17
# ext/mutable.py
 
18
# Copyright (C) 2005-2013 the SQLAlchemy authors
 
19
# and contributors <see AUTHORS file>
 
20
#
 
21
# This module is part of SQLAlchemy and is released under
 
22
# the MIT License: http://www.opensource.org/lic enses/mit-license.php
 
23
"""
 
24
Submitted on behalf of a third-party: sqlalchemy
 
25
"""
 
26
from sqlalchemy.ext.mutable import Mutable
 
27
 
 
28
 
 
29
class MutableDict(Mutable, dict):
 
30
    """A dictionary type that implements :class:`.Mutable`.
 
31
 
 
32
    .. versionadded:: 0.8
 
33
 
 
34
    """
 
35
 
 
36
    def __setitem__(self, key, value):
 
37
        """Detect dictionary set events and emit change events."""
 
38
        dict.__setitem__(self, key, value)
 
39
        self.changed()
 
40
 
 
41
    def __delitem__(self, key):
 
42
        """Detect dictionary del events and emit change events."""
 
43
        dict.__delitem__(self, key)
 
44
        self.changed()
 
45
 
 
46
    def clear(self):
 
47
        dict.clear(self)
 
48
        self.changed()
 
49
 
 
50
    @classmethod
 
51
    def coerce(cls, key, value):
 
52
        """Convert plain dictionary to MutableDict."""
 
53
        if not isinstance(value, MutableDict):
 
54
            if isinstance(value, dict):
 
55
                return MutableDict(value)
 
56
            return Mutable.coerce(key, value)
 
57
        else:
 
58
            return value
 
59
 
 
60
    def __getstate__(self):
 
61
        return dict(self)
 
62
 
 
63
    def __setstate__(self, state):
 
64
        self.update(state)