This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2013-04-24 06:22:57 1225 DEBUG reddwarf.openstack.common.processutils [-] Result was 2 execute /home/ubuntu/reddwarf/reddwarf/openstack/common/processutils.py:116 | |
2013-04-24 06:22:57 ERROR reddwarf.openstack.common.rpc.amqp [req-a48b8f3b-e313-433a-ac3a-4e8fd1451f92 radmin c8943e673e7a475a8dbce025c80bc3ba] Exception during message handling | |
2013-04-24 06:22:57 1225 TRACE reddwarf.openstack.common.rpc.amqp Traceback (most recent call last): | |
2013-04-24 06:22:57 1225 TRACE reddwarf.openstack.common.rpc.amqp File "/home/ubuntu/reddwarf/reddwarf/openstack/common/rpc/amqp.py", line 277, in _process_data | |
2013-04-24 06:22:57 1225 TRACE reddwarf.openstack.common.rpc.amqp rval = self.proxy.dispatch(ctxt, version, method, **args) | |
2013-04-24 06:22:57 1225 TRACE reddwarf.openstack.common.rpc.amqp File "/home/ubuntu/reddwarf/reddwarf/openstack/common/rpc/dispatcher.py", line 147, in dispatch | |
2013-04-24 06:22:57 1225 TRACE reddwarf.openstack.common.rpc.amqp return getattr(proxyobj, method)(ctxt, **kwargs) | |
2013-04- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DatabaseModelBase(models.ModelBase):¬ | |
_auto_generated_attrs = ['id']¬ | |
_uuid_strategy = utils.generate_uuid¬ | |
¬ | |
@classmethod¬ | |
def create(cls, **values):¬ | |
if 'id' not in values and cls._uuid_strategy is not None:¬ | |
values['id'] = uuid_strategy()¬ | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> class A(object): | |
... _something = 'foo' | |
... | |
>>> class B(A): | |
... _something = 'bar' | |
... @classmethod | |
... def foo(cls): | |
... print cls._something | |
... | |
>>> B.foo() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DatabaseModelBase(models.ModelBase):¬ | |
_auto_generated_attrs = ['id']¬ | |
_uuid_strategy = uuidutils.generate_uuid¬ | |
¬ | |
@classmethod¬ | |
def create(cls, **values):¬ | |
print cls¬ | |
print cls._uuid_strategy | |
print cls._uuid_strategy() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> from reddwarf.db import models | |
>>> models.DatabaseModelBase | |
<class 'reddwarf.db.models.DatabaseModelBase'> | |
>>> models.DatabaseModelBase._uuid_strategy | |
<unbound method DatabaseModelBase.generate_uuid> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
class Foo(object): | |
@classmethod | |
def foo(cls): | |
print "ZOMG" | |
class Bar(object): | |
_foo = time.clock | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from reddwarf.openstack.common import uuidutils¬ | |
class DatabaseModelBase(models.ModelBase):¬ | |
_auto_generated_attrs = ['id']¬ | |
_uuid_strategy = uuidutils.generate_uuid¬ | |
print _uuid_strategy¬ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MF507ZDF8X:reddwarf mbasnigh$ .tox/py27/bin/python | |
Python 2.7.2 (default, Mar 19 2012, 17:26:47) | |
[GCC 4.2.1 Compatible Apple Clang 3.0 (tags/Apple/clang-211.10.1)] on darwin | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> from reddwarf.db import models; models.DatabaseModelBase._uuid_strategy | |
<function generate_uuid at 0x10912dcf8> | |
<unbound method DatabaseModelBase.generate_uuid> | |
>>> from reddwarf.db import models; models.DatabaseModelBase._uuid_strategy() | |
Traceback (most recent call last): | |
File "<stdin>", line 1, in <module> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DatabaseModelBase(models.ModelBase):¬ | |
¬ | |
@classmethod¬ | |
def create(cls, **values):¬ | |
if 'id' not in values:¬ | |
values['id'] = cls.uuid_strategy(**values)¬ | |
if hasattr(cls, 'deleted') and 'deleted' not in values:¬ | |
values['deleted'] = False¬ | |
values['created'] = utils.utcnow()¬ | |
instance = cls(**values).save()¬ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DatabaseModelBase(models.ModelBase):¬ | |
¬ | |
@classmethod¬ | |
def create(cls, **values):¬ | |
values = cls.merge_auto_generated_values(**values)¬ | |
instance = cls(**values).save()¬ | |
if not instance.is_valid():¬ | |
raise exception.InvalidModelError(errors=instance.errors)¬ | |
return instance¬ | |
¬ |