Last change
on this file since 94 was 90, checked in by Bart Vastenhouw, 3 years ago |
Refactor to help reusing partiesserver.
|
File size:
997 bytes
|
Rev | Line | |
---|
[90] | 1 | from geniusweb.references.PartyWithParameters import PartyWithParameters
|
---|
| 2 | from geniusweb.references.ProfileRef import ProfileRef
|
---|
| 3 |
|
---|
| 4 |
|
---|
| 5 | class PartyWithProfile:
|
---|
| 6 |
|
---|
| 7 | def __init__(self, party:PartyWithParameters, profile:ProfileRef ) :
|
---|
| 8 | if party == None or profile == None:
|
---|
| 9 | raise ValueError("party and profile must be not None")
|
---|
| 10 |
|
---|
| 11 | self._party = party
|
---|
| 12 | self._profile = profile
|
---|
| 13 |
|
---|
| 14 | def getParty(self)->PartyWithParameters :
|
---|
| 15 | '''
|
---|
| 16 | @return the {@link PartyWithParameters}. never null.
|
---|
| 17 | '''
|
---|
| 18 | return self._party
|
---|
| 19 |
|
---|
| 20 | def getProfile(self)-> ProfileRef:
|
---|
| 21 | '''
|
---|
| 22 | @return the profile setting for this party. Never null.
|
---|
| 23 | '''
|
---|
| 24 | return self._profile
|
---|
| 25 |
|
---|
| 26 | def __hash__(self):
|
---|
| 27 | '''
|
---|
| 28 | support for using this in dict etc
|
---|
| 29 | '''
|
---|
| 30 | return hash((self._party, self._profile))
|
---|
| 31 |
|
---|
| 32 | def __repr__(self)->str:
|
---|
| 33 | return "PartyWithProfile[" + str(self._party) + "," + str(self._profile) + "]"
|
---|
| 34 |
|
---|
| 35 | def __eq__(self, other):
|
---|
| 36 | return isinstance(other, self.__class__) and \
|
---|
| 37 | self._party==other._party and self._profile==other._profile
|
---|
Note:
See
TracBrowser
for help on using the repository browser.