From 961ab76d307967f2ed921f865fc79eefe789d480 Mon Sep 17 00:00:00 2001 From: Tom Hunger Date: Mon, 12 Jan 2015 18:21:13 +0000 Subject: [PATCH] Clean up comments for claim code model. --- sirius/models/hardware.py | 29 ++++------------------------- 1 file changed, 4 insertions(+), 25 deletions(-) diff --git a/sirius/models/hardware.py b/sirius/models/hardware.py index a1903f4..f4a1754 100644 --- a/sirius/models/hardware.py +++ b/sirius/models/hardware.py @@ -38,7 +38,6 @@ class Printer(db.Model): return 'Printer {}, xor: {}, owner: {}'.format( self.device_address, self.hardware_xor, self.owner_id) - @classmethod def phone_home(cls, device_address): """This gets called every time the in-memory machinery thinks it has @@ -75,30 +74,9 @@ class Printer(db.Model): class ClaimCode(db.Model): - """Printer and claim codes are joined over the hardware xor. There are - several possible orders of creating the DB entries (dependent on - whether the user claims a device before it calls home or the other - way round). - - a. - 1. printer calls home with xor A - 2. claim code created with xor A code B - b. - 1. claim code created with xor A code B - 2. printer calls home with xor A - c. - 1. claim code created with xor A code B - 2. claim code created with xor A code C - 3. printer calls home with xor A - - The join is "loose" i.e. in general the order doesn't matter - unless a printer is claimed twice. In That case the newest claim - code has to be used (case c). - - Note also that claim codes are meant to be temporary. I.e. once a - printer has been claimed the claim code becomes irrelevant and - only the printer ownership counts. We don't enforce a valid time - window for claim codes though. + """Printer and claim codes are joined over the hardware xor. Claim + codes are meant to have a temporary life time though we're not + treating them like this for now. """ id = db.Column(db.Integer, primary_key=True) created = db.Column(db.DateTime, default=datetime.datetime.utcnow) @@ -109,6 +87,7 @@ class ClaimCode(db.Model): def __repr__(self): return ''.format(self.hardware_xor, self.claim_code) + class DeviceLog(db.Model): """The device log Recorde state changes in the bridge and connected devices. We may selectively expose some of these to the user. -- 2.47.3