source: geniuswebcore/geniusweb/references/PartyRef.py@ 100

Last change on this file since 100 was 100, checked in by ruud, 19 months ago

python installs also wheel to avoid error messages

File size: 919 bytes
Line 
1from pyson.JsonValue import JsonValue
2from uri.uri import URI
3
4from geniusweb import party
5from geniusweb.references.Reference import Reference
6
7
8class PartyRef (Reference):
9 '''
10 A URI reference to create a new instance of a party on a party factory
11 server. These are used to describe sesion and tournament settings.
12 '''
13
14 def __init__(self, party:URI):
15 # EXTRA: we check that the URI is not completely empty.
16 # This to get similar behaviour as Java
17 if not isinstance(party, URI) or (party.getHost() == None and party.getPath() == None):
18 raise ValueError("expected URI, but got " + repr(party))
19 self._party = party
20
21 @JsonValue()
22 def getURI(self) -> URI:
23 return self._party;
24
25 def __repr__(self) -> str:
26 return "PartyRef[" + str(self._party) + "]"
27
28 def __eq__(self, other):
29 return isinstance(other, self.__class__) and self._party == other._party
30
31 def __hash__(self):
32 return hash(self._party)
Note: See TracBrowser for help on using the repository browser.