~ubuntu-branches/ubuntu/vivid/ceilometer/vivid

« back to all changes in this revision

Viewing changes to ceilometer/storage/sqlalchemy/models.py

  • Committer: Package Import Robot
  • Author(s): James Page, Corey Bryant, James Page
  • Date: 2015-02-19 14:59:07 UTC
  • mfrom: (1.2.3)
  • Revision ID: package-import@ubuntu.com-20150219145907-9jojybdsl64zcn14
Tags: 2015.1~b2-0ubuntu1
[ Corey Bryant ]
* New upstream release.
  - d/control: Align requirements with upstream.
  - d/p/skip-test.patch: Rebased.

[ James Page ]
* d/rules,d/p/skip-gabbi.patch: Skip tests that rely on python-gabbi until
  packaging and MIR is complete.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#
2
 
# Author: John Tran <jhtran@att.com>
3
 
#
4
1
# Licensed under the Apache License, Version 2.0 (the "License"); you may
5
2
# not use this file except in compliance with the License. You may obtain
6
3
# a copy of the License at
19
16
import hashlib
20
17
import json
21
18
 
22
 
from oslo.utils import timeutils
 
19
from oslo_utils import timeutils
23
20
import six
24
21
from sqlalchemy import (Column, Integer, String, ForeignKey, Index,
25
22
                        UniqueConstraint, BigInteger)
41
38
 
42
39
    impl = String
43
40
 
44
 
    def process_bind_param(self, value, dialect):
 
41
    @staticmethod
 
42
    def process_bind_param(value, dialect):
45
43
        if value is not None:
46
44
            value = json.dumps(value)
47
45
        return value
48
46
 
49
 
    def process_result_value(self, value, dialect):
 
47
    @staticmethod
 
48
    def process_result_value(value, dialect):
50
49
        if value is not None:
51
50
            value = json.loads(value)
52
51
        return value
64
63
                                                   asdecimal=True))
65
64
        return self.impl
66
65
 
67
 
    def process_bind_param(self, value, dialect):
 
66
    @staticmethod
 
67
    def process_bind_param(value, dialect):
68
68
        if value is None:
69
69
            return value
70
70
        elif dialect.name == 'mysql':
71
71
            return utils.dt_to_decimal(value)
72
72
        return value
73
73
 
74
 
    def process_result_value(self, value, dialect):
 
74
    @staticmethod
 
75
    def process_result_value(value, dialect):
75
76
        if value is None:
76
77
            return value
77
78
        elif dialect.name == 'mysql':
258
259
    enabled = Column(Boolean)
259
260
    name = Column(Text)
260
261
    type = Column(String(50))
 
262
    severity = Column(String(50))
261
263
    description = Column(Text)
262
264
    timestamp = Column(PreciseTimestamp, default=lambda: timeutils.utcnow())
263
265