Last change
on this file since 96 was 96, checked in by Bart Vastenhouw, 2 years ago |
Fixed small issues in domaineditor.
|
File size:
919 bytes
|
Line | |
---|
1 | from pyson.JsonValue import JsonValue
|
---|
2 | from uri.uri import URI
|
---|
3 |
|
---|
4 | from geniusweb import party
|
---|
5 | from geniusweb.references.Reference import Reference
|
---|
6 |
|
---|
7 |
|
---|
8 | class 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.