Skip to content

Commit f3d7555

Browse files
author
Joel Collins
committed
ThingDescription stores APISpec instance as a weakref
1 parent 439d999 commit f3d7555

File tree

1 file changed

+6
-1
lines changed
  • labthings/server/spec

1 file changed

+6
-1
lines changed

labthings/server/spec/td.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from flask import url_for, request
22
from apispec import APISpec
3+
import weakref
34

45
from ..view import View
56

@@ -44,13 +45,17 @@ def find_schema_for_view(view: View):
4445

4546
class ThingDescription:
4647
def __init__(self, apispec: APISpec):
47-
self.apispec = apispec
48+
self._apispec = weakref.ref(apispec)
4849
self.properties = {}
4950
self.actions = {}
5051
self.events = {}
5152
self._links = []
5253
super().__init__()
5354

55+
@property
56+
def apispec(self):
57+
return self._apispec()
58+
5459
@property
5560
def links(self):
5661
td_links = []

0 commit comments

Comments
 (0)