l.r.i.p.IPoll(Interface) : interface documentation

Part of lp.registry.interfaces.poll View In Hierarchy

A poll for a given proposition in a team.
Int id Undocumented
Int team Undocumented
PollNameField name A short unique name, beginning with a lower-case letter or number, and containing only letters, numbers, dots, hyphens, or plus signs.
TextLine title Undocumented
Datetime dateopens Undocumented
Datetime datecloses Undocumented
Text proposition Undocumented
Choice type Undocumented
Bool allowspoilt Allow users to leave the ballot blank (i.e. cast a vote for "None of the above")
Choice secrecy Undocumented
Method saneDates Ensure the poll's dates are sane.
Method isOpen Return True if this Poll is still open.
Method isClosed Return True if this Poll is already closed.
Method isNotYetOpened Return True if this Poll is not yet opened.
Method closesIn Return a timedelta object of the interval between now and the date
Method opensIn Return a timedelta object of the interval between now and the date
Method newOption Create a new PollOption for this poll.
Method getActiveOptions Return all PollOptions of this poll that are active.
Method getAllOptions Return all Options of this poll.
Method personVoted Return True if :person has already voted in this poll.
Method getVotesByPerson Return the votes of the given person in this poll.
Method getTotalVotes Return the total number of votes this poll had.
Method getWinners Return the options which won this poll.
Method removeOption Remove the given option from this poll.
Method getOptionByName Return the PollOption by the given name.
Method storeSimpleVote Store and return the vote of a given person in a this poll.
Method storeCondorcetVote Store and return the votes of a given person in this poll.
Method getPairwiseMatrix Return the pairwise matrix for this poll.
id =
Undocumented
team =
Undocumented
name =
A short unique name, beginning with a lower-case letter or number, and containing only letters, numbers, dots, hyphens, or plus signs.
title =
Undocumented
dateopens =
Undocumented
datecloses =
Undocumented
proposition =
Undocumented
type =
Undocumented
allowspoilt =
Allow users to leave the ballot blank (i.e. cast a vote for "None of the above")
secrecy =
Undocumented
@invariant
def saneDates(poll):
Ensure the poll's dates are sane.

A poll's end date must be after its start date and its start date must be at least 12h from now.

def isOpen(when=None):
Return True if this Poll is still open.

The optional :when argument is used only by our tests, to test if the poll is/was/will be open at a specific date.

def isClosed(when=None):
Return True if this Poll is already closed.

The optional :when argument is used only by our tests, to test if the poll is/was/will be closed at a specific date.

def isNotYetOpened(when=None):
Return True if this Poll is not yet opened.

The optional :when argument is used only by our tests, to test if the poll is/was/will be not-yet-opened at a specific date.

def closesIn():
Return a timedelta object of the interval between now and the date when this poll closes.
def opensIn():
Return a timedelta object of the interval between now and the date when this poll opens.
def newOption(name, title=None, active=True):
Create a new PollOption for this poll.

If title is None it'll be the same as name.

def getActiveOptions():
Return all PollOptions of this poll that are active.
def getAllOptions():
Return all Options of this poll.
def personVoted(person):
Return True if :person has already voted in this poll.
def getVotesByPerson(person):
Return the votes of the given person in this poll.

The return value will always be a list of Vote objects. That's for consistency because on simple polls there'll be always a single vote, but for condorcet poll, there'll always be a list.

def getTotalVotes():
Return the total number of votes this poll had.

This must be used only on closed polls.

def getWinners():
Return the options which won this poll.

This should be used only on closed polls.

def removeOption(option, when=None):
Remove the given option from this poll.

A ValueError is raised if the given option doesn't belong to this poll. This method can be used only on polls that are not yet opened. The optional :when argument is used only by our tests, to test if the poll is/was/will be not-yet-opened at a specific date.

def getOptionByName(name):
Return the PollOption by the given name.
def storeSimpleVote(person, option, when=None):
Store and return the vote of a given person in a this poll.

This method can be used only if this poll is still open and if this is a Simple-style poll.

Unknown Field: optionThe choosen option.
Unknown Field: whenOptional argument used only by our tests, to test if the poll is/was/will be open at a specific date.
def storeCondorcetVote(person, options, when=None):
Store and return the votes of a given person in this poll.

This method can be used only if this poll is still open and if this is a Condorcet-style poll.

Unknown Field: optionsA dictionary, where the options are the keys and the preferences of each option are the values.
Unknown Field: whenOptional argument used only by our tests, to test if the poll is/was/will be open at a specific date.
def getPairwiseMatrix():
Return the pairwise matrix for this poll.

This method is only available for condorcet-style polls. See http://www.electionmethods.org/CondorcetEx.htm for an example of a pairwise matrix.

API Documentation for Launchpad, generated by pydoctor at 2019-04-24 00:00:10.