source: geniuswebcore/geniusweb/references/ProfileRef.py@ 73

Last change on this file since 73 was 73, checked in by Bart Vastenhouw, 3 years ago

Fix for IssueValue hashcode.

File size: 1.0 KB
Line 
1from pyson.JsonGetter import JsonGetter
2from pyson.JsonValue import JsonValue
3from uri.uri import URI # type: ignore
4
5from geniusweb.references.Reference import Reference
6
7
8class ProfileRef (Reference):
9 '''
10 A URI reference to get a copy of a profile. This usually is a "ws://"
11 (websocket) URI, allowing users (parties) to get notifications if the profile
12 is changed.
13 <p>
14 In debugging scenarios, this is usually a "file://" URI, in which case the
15 profile is assumed to be static during the run. Parties that support
16 debugging eg with the simplerunner should support the file: protocol.
17 '''
18
19 def __init__(self, uri:URI):
20 if uri == None:
21 raise ValueError("profile=null")
22 self._profile = uri
23
24 @JsonValue()
25 def getURI(self) -> URI :
26 return self._profile
27
28 def __repr__(self):
29 return "ProfileRef[" + str(self._profile) + "]"
30
31 def __eq__(self, other):
32 return isinstance(other, self.__class__) and \
33 self._profile==other._profile
34
35 def __hash__(self):
36 '''
37 support for using this in dict etc
38 '''
39 return hash(str(self._profile))
Note: See TracBrowser for help on using the repository browser.