Skip to content

Commit

Permalink
ThingDescription stores APISpec instance as a weakref
Browse files Browse the repository at this point in the history
  • Loading branch information
Joel Collins committed Apr 22, 2020
1 parent 439d999 commit f3d7555
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion labthings/server/spec/td.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from flask import url_for, request
from apispec import APISpec
import weakref

from ..view import View

Expand Down Expand Up @@ -44,13 +45,17 @@ def find_schema_for_view(view: View):

class ThingDescription:
def __init__(self, apispec: APISpec):
self.apispec = apispec
self._apispec = weakref.ref(apispec)
self.properties = {}
self.actions = {}
self.events = {}
self._links = []
super().__init__()

@property
def apispec(self):
return self._apispec()

@property
def links(self):
td_links = []
Expand Down

0 comments on commit f3d7555

Please sign in to comment.