clean events from device models

This commit is contained in:
Cayo Puigdefabregas 2020-11-11 16:52:02 +01:00
parent cbe6bb7e90
commit 0a7e805f3e
1 changed files with 0 additions and 13 deletions

View File

@ -16,10 +16,8 @@ from sqlalchemy.dialects.postgresql import UUID
from sqlalchemy.ext.declarative import declared_attr from sqlalchemy.ext.declarative import declared_attr
from sqlalchemy.ext.hybrid import hybrid_property from sqlalchemy.ext.hybrid import hybrid_property
from sqlalchemy.orm import ColumnProperty, backref, relationship, validates from sqlalchemy.orm import ColumnProperty, backref, relationship, validates
from sqlalchemy.orm.events import AttributeEvents as Events
from sqlalchemy.util import OrderedSet from sqlalchemy.util import OrderedSet
from sqlalchemy_utils import ColorType from sqlalchemy_utils import ColorType
from sqlalchemy import event
from stdnum import imei, meid from stdnum import imei, meid
from teal.db import CASCADE_DEL, POLYMORPHIC_ID, POLYMORPHIC_ON, ResourceNotFound, URL, \ from teal.db import CASCADE_DEL, POLYMORPHIC_ID, POLYMORPHIC_ON, ResourceNotFound, URL, \
check_lower, check_range, IntEnum check_lower, check_range, IntEnum
@ -675,17 +673,6 @@ class NetworkAdapter(JoinedComponentTableMixin, NetworkMixin, Component):
pass pass
@event.listens_for(NetworkAdapter.parent, Events.set.__name__, propagate=True)
def update_hid(target: NetworkAdapter, device: Device, _, __):
"""Syncs the :attr:`parent.hid` with the parent of the device."""
target.parent = None
if isinstance(device, Component):
if device.parent:
device.parent.add_mac_to_hid()
target.parent = device.parent
class Processor(JoinedComponentTableMixin, Component): class Processor(JoinedComponentTableMixin, Component):
"""The CPU.""" """The CPU."""
speed = Column(Float, check_range('speed', 0.1, 15)) speed = Column(Float, check_range('speed', 0.1, 15))