Easy spacing fixes, trailing stuff
Remove useless trailing \ Remove trailing spaces Add missing empty lines autopep8 -ir -j2 --select=E301,E302,E502,W291,W293,W391 . Diff quickly checked.
This commit is contained in:
parent
c21d1f7925
commit
7094931c92
231 changed files with 474 additions and 67 deletions
|
|
@ -47,6 +47,7 @@ class Task(object):
|
|||
def __repr__(self):
|
||||
return '<Task (%s,%s)>' % (self.backend, self.capability)
|
||||
|
||||
|
||||
class Member(object):
|
||||
def __init__(self, id, name):
|
||||
self.name = name
|
||||
|
|
@ -63,6 +64,7 @@ class Member(object):
|
|||
name = '%s..' % name[:18]
|
||||
return name
|
||||
|
||||
|
||||
class Event(object):
|
||||
def __init__(self, name, backend):
|
||||
self.my_id = backend.browser.get_userid()
|
||||
|
|
@ -272,6 +274,7 @@ h2. Attendees
|
|||
self.content.content = s
|
||||
self.backend.push_content(self.content, message)
|
||||
|
||||
|
||||
class Boobathon(ReplApplication):
|
||||
APPNAME = 'boobathon'
|
||||
VERSION = '0.f'
|
||||
|
|
|
|||
|
|
@ -145,7 +145,7 @@ class Boobill(ReplApplication):
|
|||
Get the list of bills documents for subscriptions.
|
||||
If no ID given, display bills of all backends
|
||||
"""
|
||||
self.exec_method(id, 'iter_bills')
|
||||
self.exec_method(id, 'iter_bills')
|
||||
|
||||
def do_download(self, line):
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ __all__ = ['Cineoob']
|
|||
ROLE_LIST = ['actor','director','writer','composer','producer']
|
||||
COUNTRY_LIST = ['us','fr','de','jp']
|
||||
|
||||
|
||||
class MovieInfoFormatter(IFormatter):
|
||||
MANDATORY_FIELDS = ('id', 'original_title', 'release_date', 'other_titles', 'duration', 'pitch', 'note', 'roles', 'country')
|
||||
|
||||
|
|
@ -100,6 +101,7 @@ def yearsago(years, from_date=None):
|
|||
return from_date.replace(month=2, day=28,
|
||||
year=from_date.year-years)
|
||||
|
||||
|
||||
def num_years(begin, end=None):
|
||||
if end is None:
|
||||
end = datetime.now()
|
||||
|
|
@ -109,6 +111,7 @@ def num_years(begin, end=None):
|
|||
else:
|
||||
return num_years
|
||||
|
||||
|
||||
class PersonInfoFormatter(IFormatter):
|
||||
MANDATORY_FIELDS = ('id', 'name', 'birth_date', 'birth_place', 'short_biography')
|
||||
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ class FakeConic(object):
|
|||
STATUS_CONNECTED = None
|
||||
STATUS_DISCONNECTED = None
|
||||
CONNECT_FLAG_NONE = None
|
||||
|
||||
def Connection(self):
|
||||
raise NotImplementedError()
|
||||
try:
|
||||
|
|
@ -50,6 +51,7 @@ from logging import debug
|
|||
|
||||
__all__ = ['Masstransit']
|
||||
|
||||
|
||||
class MasstransitHildon():
|
||||
"hildon interface"
|
||||
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ from weboob.capabilities.messages import ICapMessages
|
|||
from .ui.main_window_ui import Ui_MainWindow
|
||||
from .messages_manager import MessagesManager
|
||||
|
||||
|
||||
class MainWindow(QtMainWindow):
|
||||
def __init__(self, config, weboob, parent=None):
|
||||
QtMainWindow.__init__(self, parent)
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ from weboob.tools.misc import to_unicode
|
|||
|
||||
from .ui.messages_manager_ui import Ui_MessagesManager
|
||||
|
||||
|
||||
class MessagesManager(QWidget):
|
||||
def __init__(self, weboob, parent=None):
|
||||
QWidget.__init__(self, parent)
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ from .person import Person
|
|||
from .torrent import Torrent
|
||||
from .subtitle import Subtitle
|
||||
|
||||
|
||||
class MainWindow(QtMainWindow):
|
||||
def __init__(self, config, weboob, parent=None):
|
||||
QtMainWindow.__init__(self, parent)
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ from PyQt4.QtCore import Qt
|
|||
from weboob.applications.qcineoob.ui.minimovie_ui import Ui_MiniMovie
|
||||
from weboob.capabilities.base import empty
|
||||
|
||||
|
||||
class MiniMovie(QFrame):
|
||||
def __init__(self, weboob, backend, movie, parent=None):
|
||||
QFrame.__init__(self, parent)
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ from PyQt4.QtCore import Qt
|
|||
from weboob.applications.qcineoob.ui.miniperson_ui import Ui_MiniPerson
|
||||
from weboob.capabilities.base import empty
|
||||
|
||||
|
||||
class MiniPerson(QFrame):
|
||||
def __init__(self, weboob, backend, person, parent=None):
|
||||
QFrame.__init__(self, parent)
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ from PyQt4.QtGui import QFrame
|
|||
from weboob.applications.qcineoob.ui.minisubtitle_ui import Ui_MiniSubtitle
|
||||
from weboob.capabilities.base import empty
|
||||
|
||||
|
||||
class MiniSubtitle(QFrame):
|
||||
def __init__(self, weboob, backend, subtitle, parent=None):
|
||||
QFrame.__init__(self, parent)
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ from weboob.applications.qcineoob.ui.minitorrent_ui import Ui_MiniTorrent
|
|||
from weboob.applications.weboorrents.weboorrents import sizeof_fmt
|
||||
from weboob.capabilities.base import empty
|
||||
|
||||
|
||||
class MiniTorrent(QFrame):
|
||||
def __init__(self, weboob, backend, torrent, parent=None):
|
||||
QFrame.__init__(self, parent)
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ from weboob.capabilities.base import empty
|
|||
from weboob.applications.suboob.suboob import LANGUAGE_CONV
|
||||
from weboob.applications.cineoob.cineoob import ROLE_LIST
|
||||
|
||||
|
||||
class Movie(QFrame):
|
||||
def __init__(self, movie, backend, parent=None):
|
||||
QFrame.__init__(self, parent)
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ from weboob.applications.qcineoob.ui.person_ui import Ui_Person
|
|||
from weboob.capabilities.base import empty
|
||||
from weboob.applications.cineoob.cineoob import ROLE_LIST
|
||||
|
||||
|
||||
class Person(QFrame):
|
||||
def __init__(self, person, backend, parent=None):
|
||||
QFrame.__init__(self, parent)
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ class QCineoob(QtApplication):
|
|||
CONFIG = {'settings': {'backend': '',
|
||||
}
|
||||
}
|
||||
|
||||
def main(self, argv):
|
||||
self.load_backends([ICapCinema,ICapTorrent,ICapSubtitle])
|
||||
self.load_config()
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ from PyQt4.QtGui import QFrame, QFileDialog
|
|||
from weboob.applications.qcineoob.ui.subtitle_ui import Ui_Subtitle
|
||||
from weboob.capabilities.base import empty
|
||||
|
||||
|
||||
class Subtitle(QFrame):
|
||||
def __init__(self, subtitle, backend, parent=None):
|
||||
QFrame.__init__(self, parent)
|
||||
|
|
@ -77,4 +78,3 @@ class Subtitle(QFrame):
|
|||
print >>sys.stderr, 'Unable to write subtitle file in "%s": %s' % (dest, e)
|
||||
return 1
|
||||
return
|
||||
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ from weboob.applications.qcineoob.ui.torrent_ui import Ui_Torrent
|
|||
from weboob.applications.weboorrents.weboorrents import sizeof_fmt
|
||||
from weboob.capabilities.base import empty
|
||||
|
||||
|
||||
class Torrent(QFrame):
|
||||
def __init__(self, torrent, backend, parent=None):
|
||||
QFrame.__init__(self, parent)
|
||||
|
|
@ -77,4 +78,3 @@ class Torrent(QFrame):
|
|||
print >>sys.stderr, 'Unable to write .torrent in "%s": %s' % (dest, e)
|
||||
return 1
|
||||
return
|
||||
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ from weboob.capabilities.base import NotLoaded, NotAvailable
|
|||
from .ui.main_window_ui import Ui_MainWindow
|
||||
from .query import QueryDialog
|
||||
|
||||
|
||||
class HousingListWidgetItem(QListWidgetItem):
|
||||
def __init__(self, housing, *args, **kwargs):
|
||||
QListWidgetItem.__init__(self, *args, **kwargs)
|
||||
|
|
@ -56,6 +57,7 @@ class HousingListWidgetItem(QListWidgetItem):
|
|||
elif self.background().color() != QColor(0,0,0):
|
||||
self.setBackground(QBrush())
|
||||
|
||||
|
||||
class MainWindow(QtMainWindow):
|
||||
def __init__(self, config, storage, weboob, parent=None):
|
||||
QtMainWindow.__init__(self, parent)
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ from weboob.tools.application.qt import QtDo, HTMLDelegate
|
|||
|
||||
from .ui.query_ui import Ui_QueryDialog
|
||||
|
||||
|
||||
class QueryDialog(QDialog):
|
||||
def __init__(self, weboob, parent=None):
|
||||
QDialog.__init__(self, parent)
|
||||
|
|
@ -43,7 +44,7 @@ class QueryDialog(QDialog):
|
|||
|
||||
if hasattr(self.ui.cityEdit, "setPlaceholderText"):
|
||||
self.ui.cityEdit.setPlaceholderText("Press enter to search city")
|
||||
|
||||
|
||||
def keyPressEvent(self, event):
|
||||
"""
|
||||
Disable handler <Enter> and <Escape> to prevent closing the window.
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ from .ui.thread_message_ui import Ui_ThreadMessage
|
|||
from .ui.profile_ui import Ui_Profile
|
||||
from .ui.notes_ui import Ui_Notes
|
||||
|
||||
|
||||
class ThreadMessage(QFrame):
|
||||
"""
|
||||
This class represents a message in the thread tab.
|
||||
|
|
@ -70,6 +71,7 @@ class ThreadMessage(QFrame):
|
|||
return False
|
||||
return self.message == m.message
|
||||
|
||||
|
||||
class ContactThread(QWidget):
|
||||
"""
|
||||
The thread of the selected contact.
|
||||
|
|
@ -341,6 +343,7 @@ class ContactProfile(QWidget):
|
|||
text += '<br /><font color=#ff0000><i>(Hidden photo)</i></font>'
|
||||
self.ui.photoUrlLabel.setText(text)
|
||||
|
||||
|
||||
class ContactNotes(QWidget):
|
||||
""" Widget for storing notes about a contact """
|
||||
|
||||
|
|
@ -399,6 +402,7 @@ class ContactNotes(QWidget):
|
|||
QMessageBox.critical(self, self.tr('Error while saving notes'),
|
||||
content, QMessageBox.Ok)
|
||||
|
||||
|
||||
class IGroup(object):
|
||||
def __init__(self, weboob, id, name):
|
||||
self.id = id
|
||||
|
|
@ -408,6 +412,7 @@ class IGroup(object):
|
|||
def iter_contacts(self, cb):
|
||||
raise NotImplementedError()
|
||||
|
||||
|
||||
class MetaGroup(IGroup):
|
||||
def iter_contacts(self, cb):
|
||||
if self.id == 'online':
|
||||
|
|
@ -427,6 +432,7 @@ class MetaGroup(IGroup):
|
|||
self.process = None
|
||||
cb(None)
|
||||
|
||||
|
||||
class ContactsWidget(QWidget):
|
||||
def __init__(self, weboob, parent=None):
|
||||
QWidget.__init__(self, parent)
|
||||
|
|
@ -587,5 +593,3 @@ class ContactsWidget(QWidget):
|
|||
content += u'\n%s\n' % to_unicode(backtrace)
|
||||
QMessageBox.critical(self, self.tr('Error while getting contact'),
|
||||
content, QMessageBox.Ok)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ from weboob.tools.application.qt import QtDo, HTMLDelegate
|
|||
|
||||
from .ui.events_ui import Ui_Events
|
||||
|
||||
|
||||
class EventsWidget(QWidget):
|
||||
def __init__(self, weboob, parent=None):
|
||||
QWidget.__init__(self, parent)
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ from .status import AccountsStatus
|
|||
from .contacts import ContactsWidget
|
||||
from .events import EventsWidget
|
||||
|
||||
|
||||
class MainWindow(QtMainWindow):
|
||||
def __init__(self, config, weboob, parent=None):
|
||||
QtMainWindow.__init__(self, parent)
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ from weboob.tools.application.qt import QtApplication
|
|||
|
||||
from .main_window import MainWindow
|
||||
|
||||
|
||||
class QHaveDate(QtApplication):
|
||||
APPNAME = 'qhavedate'
|
||||
VERSION = '0.f'
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ from weboob.capabilities.account import ICapAccount, StatusField
|
|||
from weboob.tools.application.qt import QtDo
|
||||
from weboob.tools.misc import to_unicode
|
||||
|
||||
|
||||
class Account(QFrame):
|
||||
def __init__(self, weboob, backend, parent=None):
|
||||
QFrame.__init__(self, parent)
|
||||
|
|
@ -103,6 +104,7 @@ class Account(QFrame):
|
|||
self.body.setText(u'<b>Unable to connect:</b> %s' % to_unicode(err))
|
||||
self.title.setText(u'<font color=#ff0000>%s</font>' % unicode(self.title.text()))
|
||||
|
||||
|
||||
class AccountsStatus(QScrollArea):
|
||||
def __init__(self, weboob, parent=None):
|
||||
QScrollArea.__init__(self, parent)
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ from weboob.applications.qvideoob.ui.main_window_ui import Ui_MainWindow
|
|||
from .video import Video
|
||||
from .minivideo import MiniVideo
|
||||
|
||||
|
||||
class MainWindow(QtMainWindow):
|
||||
def __init__(self, config, weboob, parent=None):
|
||||
QtMainWindow.__init__(self, parent)
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ from weboob.tools.application.qt import QtDo
|
|||
from weboob.applications.qvideoob.ui.minivideo_ui import Ui_MiniVideo
|
||||
from .video import Video
|
||||
|
||||
|
||||
class MiniVideo(QFrame):
|
||||
def __init__(self, weboob, backend, video, parent=None):
|
||||
QFrame.__init__(self, parent)
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ class QVideoob(QtApplication):
|
|||
'backend': ''
|
||||
}
|
||||
}
|
||||
|
||||
def main(self, argv):
|
||||
self.load_backends(ICapVideo)
|
||||
self.load_config()
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ from PyQt4.phonon import Phonon
|
|||
|
||||
from weboob.applications.qvideoob.ui.video_ui import Ui_Video
|
||||
|
||||
|
||||
class Video(QDialog):
|
||||
def __init__(self, video, parent=None):
|
||||
QDialog.__init__(self, parent)
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ from weboob.tools.misc import to_unicode
|
|||
|
||||
from .ui.main_window_ui import Ui_MainWindow
|
||||
|
||||
|
||||
class MainWindow(QtMainWindow):
|
||||
def __init__(self, config, weboob, parent=None):
|
||||
QtMainWindow.__init__(self, parent)
|
||||
|
|
@ -102,11 +103,11 @@ class MainWindow(QtMainWindow):
|
|||
_id = unicode(self.ui.idEdit.text())
|
||||
if not _id:
|
||||
return
|
||||
|
||||
|
||||
self.ui.loadButton.setEnabled(False)
|
||||
self.ui.loadButton.setText('Loading...')
|
||||
self.ui.contentEdit.setReadOnly(True)
|
||||
|
||||
|
||||
backend = str(self.ui.backendBox.currentText())
|
||||
self.process = QtDo(self.weboob,
|
||||
self._loadedPage,
|
||||
|
|
@ -137,7 +138,7 @@ class MainWindow(QtMainWindow):
|
|||
self.ui.contentEdit.setPlainText(self.content.content)
|
||||
self.setWindowTitle("QWebcontentedit - %s@%s" %(self.content.id,
|
||||
backend.name))
|
||||
self.backend = backend
|
||||
self.backend = backend
|
||||
|
||||
def _errorLoadPage(self, backend, error, backtrace):
|
||||
""" Error callback for loadPage """
|
||||
|
|
@ -203,7 +204,7 @@ class MainWindow(QtMainWindow):
|
|||
|
||||
self.ui.loadHistoryButton.setEnabled(False)
|
||||
self.ui.loadHistoryButton.setText("Loading...")
|
||||
|
||||
|
||||
self.ui.historyTable.clear()
|
||||
self.ui.historyTable.setRowCount(0)
|
||||
|
||||
|
|
@ -212,7 +213,7 @@ class MainWindow(QtMainWindow):
|
|||
"Author",
|
||||
"Summary"])
|
||||
self.ui.historyTable.setColumnWidth(3, 1000)
|
||||
|
||||
|
||||
self.process = QtDo(self.weboob,
|
||||
self._gotRevision,
|
||||
self._errorHistory)
|
||||
|
|
@ -234,13 +235,13 @@ class MainWindow(QtMainWindow):
|
|||
# are not modifiable (they are modifiable by default)
|
||||
item_revision = QTableWidgetItem(revision.id)
|
||||
item_revision.setFlags(Qt.ItemIsEnabled)
|
||||
|
||||
|
||||
item_time = QTableWidgetItem(revision.timestamp.strftime('%Y-%m-%d %H:%M:%S'))
|
||||
item_time.setFlags(Qt.ItemIsEnabled)
|
||||
|
||||
|
||||
item_author = QTableWidgetItem(revision.author)
|
||||
item_author.setFlags(Qt.ItemIsEnabled)
|
||||
|
||||
|
||||
item_summary = QTableWidgetItem(revision.comment)
|
||||
item_summary.setFlags(Qt.ItemIsEnabled)
|
||||
|
||||
|
|
@ -260,6 +261,6 @@ class MainWindow(QtMainWindow):
|
|||
content += '\n%s\n' % to_unicode(backtrace)
|
||||
QMessageBox.critical(self, self.tr('Error while loading history'),
|
||||
content, QMessageBox.Ok)
|
||||
|
||||
|
||||
self.ui.loadHistoryButton.setEnabled(True)
|
||||
self.ui.loadHistoryButton.setText("Reload")
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ class VideoListFormatter(PrettyFormatter):
|
|||
result += u' (%s/%s)' % (obj.rating, obj.rating_max)
|
||||
return result
|
||||
|
||||
|
||||
class Videoob(ReplApplication):
|
||||
APPNAME = 'videoob'
|
||||
VERSION = '0.f'
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ class AccountRegisterError(UserError):
|
|||
Raised when there is an error during registration.
|
||||
"""
|
||||
|
||||
|
||||
class Account(CapBaseObject):
|
||||
"""
|
||||
Describe an account and its properties.
|
||||
|
|
@ -40,6 +41,7 @@ class Account(CapBaseObject):
|
|||
def __init__(self, id=None):
|
||||
CapBaseObject.__init__(self, id)
|
||||
|
||||
|
||||
class StatusField(object):
|
||||
"""
|
||||
Field of an account status.
|
||||
|
|
|
|||
|
|
@ -36,11 +36,13 @@ class AccountNotFound(UserError):
|
|||
def __init__(self, msg='Account not found'):
|
||||
UserError.__init__(self, msg)
|
||||
|
||||
|
||||
class TransferError(UserError):
|
||||
"""
|
||||
A transfer has failed.
|
||||
"""
|
||||
|
||||
|
||||
class Currency(object):
|
||||
CUR_UNKNOWN = 0
|
||||
CUR_EUR = 1
|
||||
|
|
@ -92,6 +94,7 @@ class Recipient(CapBaseObject):
|
|||
def __init__(self):
|
||||
CapBaseObject.__init__(self, 0)
|
||||
|
||||
|
||||
class Account(Recipient, Currency):
|
||||
"""
|
||||
Bank account.
|
||||
|
|
@ -144,6 +147,7 @@ class Transaction(CapBaseObject):
|
|||
return "<Transaction date='%s' label='%s' amount=%s>" % (self.date,
|
||||
label, self.amount)
|
||||
|
||||
|
||||
class Transfer(CapBaseObject):
|
||||
"""
|
||||
Transfer from an account to a recipient.
|
||||
|
|
@ -155,6 +159,7 @@ class Transfer(CapBaseObject):
|
|||
recipient = Field('Recipient', int, long, basestring)
|
||||
reason = StringField('Reason')
|
||||
|
||||
|
||||
class ICapBank(ICapCollection):
|
||||
"""
|
||||
Capability of bank websites to see accounts and transactions.
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ class Detail(CapBaseObject):
|
|||
def __init__(self):
|
||||
CapBaseObject.__init__(self, 0)
|
||||
|
||||
|
||||
class Bill(CapBaseObject):
|
||||
"""
|
||||
Bill.
|
||||
|
|
@ -65,6 +66,7 @@ class Bill(CapBaseObject):
|
|||
def __init__(self):
|
||||
CapBaseObject.__init__(self, 0)
|
||||
|
||||
|
||||
class Subscription(CapBaseObject):
|
||||
"""
|
||||
Subscription to a service.
|
||||
|
|
@ -74,6 +76,7 @@ class Subscription(CapBaseObject):
|
|||
validity = DateField('End validity date of the subscription')
|
||||
renewdate = DateField('Reset date of consumption')
|
||||
|
||||
|
||||
class ICapBill(ICapCollection):
|
||||
def iter_resources(self, objs, split_path):
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ class IssueError(UserError):
|
|||
Raised when there is an error with an issue.
|
||||
"""
|
||||
|
||||
|
||||
class Project(CapBaseObject):
|
||||
"""
|
||||
Represents a project.
|
||||
|
|
@ -101,6 +102,7 @@ class Project(CapBaseObject):
|
|||
return None
|
||||
return None
|
||||
|
||||
|
||||
class User(CapBaseObject):
|
||||
"""
|
||||
User.
|
||||
|
|
@ -114,6 +116,7 @@ class User(CapBaseObject):
|
|||
def __repr__(self):
|
||||
return '<User %r>' % self.name
|
||||
|
||||
|
||||
class Version(CapBaseObject):
|
||||
"""
|
||||
Version of a project.
|
||||
|
|
@ -127,6 +130,7 @@ class Version(CapBaseObject):
|
|||
def __repr__(self):
|
||||
return '<Version %r>' % self.name
|
||||
|
||||
|
||||
class Status(CapBaseObject):
|
||||
"""
|
||||
Status of an issue.
|
||||
|
|
@ -150,6 +154,7 @@ class Status(CapBaseObject):
|
|||
def __repr__(self):
|
||||
return '<Status %r>' % self.name
|
||||
|
||||
|
||||
class Attachment(CapBaseObject):
|
||||
"""
|
||||
Attachment of an issue.
|
||||
|
|
@ -160,6 +165,7 @@ class Attachment(CapBaseObject):
|
|||
def __repr__(self):
|
||||
return '<Attachment %r>' % self.filename
|
||||
|
||||
|
||||
class Change(CapBaseObject):
|
||||
"""
|
||||
A change of an update.
|
||||
|
|
@ -168,6 +174,7 @@ class Change(CapBaseObject):
|
|||
last = StringField('Last value of field')
|
||||
new = StringField('New value of field')
|
||||
|
||||
|
||||
class Update(CapBaseObject):
|
||||
"""
|
||||
Represents an update of an issue.
|
||||
|
|
@ -182,6 +189,7 @@ class Update(CapBaseObject):
|
|||
def __repr__(self):
|
||||
return '<Update %r>' % self.id
|
||||
|
||||
|
||||
class Issue(CapBaseObject):
|
||||
"""
|
||||
Represents an issue.
|
||||
|
|
@ -199,6 +207,7 @@ class Issue(CapBaseObject):
|
|||
version = Field('Target version of this issue', Version)
|
||||
status = Field('Status of this issue', Status)
|
||||
|
||||
|
||||
class Query(CapBaseObject):
|
||||
"""
|
||||
Query to find an issue.
|
||||
|
|
@ -214,6 +223,7 @@ class Query(CapBaseObject):
|
|||
def __init__(self):
|
||||
CapBaseObject.__init__(self, '')
|
||||
|
||||
|
||||
class ICapBugTracker(IBaseCap):
|
||||
"""
|
||||
Bug trackers websites.
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ class ChatMessage(CapBaseObject):
|
|||
if self.date is None:
|
||||
self.date = datetime.datetime.utcnow()
|
||||
|
||||
|
||||
class ICapChat(IBaseCap):
|
||||
"""
|
||||
Websites with a chat system.
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ class Content(CapBaseObject):
|
|||
content = StringField('Body')
|
||||
revision = StringField('ID of revision')
|
||||
|
||||
|
||||
class Revision(CapBaseObject):
|
||||
"""
|
||||
Revision of a change on a content.
|
||||
|
|
@ -42,6 +43,7 @@ class Revision(CapBaseObject):
|
|||
timestamp = DateField('Date of revision')
|
||||
minor = Field('Is this change minor?', bool)
|
||||
|
||||
|
||||
class ICapContent(IBaseCap):
|
||||
def get_content(self, id, revision=None):
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -88,6 +88,7 @@ class Event(CapBaseObject):
|
|||
type = StringField('Type of event')
|
||||
message = StringField('Message of the event')
|
||||
|
||||
|
||||
class ICapDating(IBaseCap):
|
||||
"""
|
||||
Capability for dating websites.
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ class IpLocation(CapBaseObject):
|
|||
CapBaseObject.__init__(self, ipaddr)
|
||||
self.ipaddr = ipaddr
|
||||
|
||||
|
||||
class ICapGeolocIp(IBaseCap):
|
||||
"""
|
||||
Access information about IP addresses database.
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ class HousingPhoto(CapBaseObject):
|
|||
def __repr__(self):
|
||||
return u'<HousingPhoto "%s" data=%do>' % (self.id, len(self.data) if self.data else 0)
|
||||
|
||||
|
||||
class Housing(CapBaseObject):
|
||||
"""
|
||||
Content of a housing.
|
||||
|
|
@ -61,6 +62,7 @@ class Housing(CapBaseObject):
|
|||
photos = Field('List of photos', list)
|
||||
details = Field('Key/values of details', dict)
|
||||
|
||||
|
||||
class Query(CapBaseObject):
|
||||
"""
|
||||
Query to find housings.
|
||||
|
|
@ -79,12 +81,14 @@ class Query(CapBaseObject):
|
|||
def __init__(self):
|
||||
CapBaseObject.__init__(self, '')
|
||||
|
||||
|
||||
class City(CapBaseObject):
|
||||
"""
|
||||
City.
|
||||
"""
|
||||
name = StringField('Name of city')
|
||||
|
||||
|
||||
class ICapHousing(IBaseCap):
|
||||
"""
|
||||
Capability of websites to search housings.
|
||||
|
|
|
|||
|
|
@ -34,12 +34,14 @@ class Book(CapBaseObject):
|
|||
date = DateField('The due date')
|
||||
late = Field('Are you late?', bool)
|
||||
|
||||
|
||||
class Renew(CapBaseObject):
|
||||
"""
|
||||
A renew message.
|
||||
"""
|
||||
message = StringField('Message')
|
||||
|
||||
|
||||
class ICapBook(ICapCollection):
|
||||
"""
|
||||
Library websites.
|
||||
|
|
|
|||
|
|
@ -34,10 +34,12 @@ class _Message(CapBaseObject):
|
|||
""" Base message. """
|
||||
pass
|
||||
|
||||
|
||||
class _Thread(CapBaseObject):
|
||||
""" Base Thread. """
|
||||
pass
|
||||
|
||||
|
||||
class Message(_Message):
|
||||
"""
|
||||
Represents a message read or to send.
|
||||
|
|
@ -131,6 +133,7 @@ class Message(_Message):
|
|||
return '<Message id=%r title=%r date=%r from=%r>' % (
|
||||
self.full_id, self.title, self.date, self.sender)
|
||||
|
||||
|
||||
class Thread(_Thread):
|
||||
"""
|
||||
Thread containing messages.
|
||||
|
|
@ -199,11 +202,13 @@ class ICapMessages(IBaseCap):
|
|||
"""
|
||||
raise NotImplementedError()
|
||||
|
||||
|
||||
class CantSendMessage(UserError):
|
||||
"""
|
||||
Raised when a message can't be send.
|
||||
"""
|
||||
|
||||
|
||||
class ICapMessagesPost(IBaseCap):
|
||||
"""
|
||||
This capability allow user to send a message.
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ class PasteNotFound(UserError):
|
|||
Raised when a paste is not found.
|
||||
"""
|
||||
|
||||
|
||||
class BasePaste(CapBaseObject):
|
||||
"""
|
||||
Represents a pasted text.
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ class Product(CapBaseObject):
|
|||
"""
|
||||
name = StringField('Name of product')
|
||||
|
||||
|
||||
class Shop(CapBaseObject):
|
||||
"""
|
||||
A shop where the price is.
|
||||
|
|
@ -39,6 +40,7 @@ class Shop(CapBaseObject):
|
|||
location = StringField('Location of the shop')
|
||||
info = StringField('Information about the shop')
|
||||
|
||||
|
||||
class Price(CapBaseObject):
|
||||
"""
|
||||
Price.
|
||||
|
|
@ -50,6 +52,7 @@ class Price(CapBaseObject):
|
|||
shop = Field('Shop information', Shop)
|
||||
product = Field('Product', Product)
|
||||
|
||||
|
||||
class ICapPriceComparison(IBaseCap):
|
||||
"""
|
||||
Capability for price comparison websites.
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ class Emission(CapBaseObject):
|
|||
else:
|
||||
return self.title
|
||||
|
||||
|
||||
class Stream(CapBaseObject):
|
||||
"""
|
||||
Stream of a radio.
|
||||
|
|
@ -54,6 +55,7 @@ class Stream(CapBaseObject):
|
|||
def __repr__(self):
|
||||
return self.__unicode__()
|
||||
|
||||
|
||||
class Radio(CapBaseObject):
|
||||
"""
|
||||
Radio object.
|
||||
|
|
@ -63,6 +65,7 @@ class Radio(CapBaseObject):
|
|||
current = Field('Current emission', Emission)
|
||||
streams = Field('List of streams', list)
|
||||
|
||||
|
||||
class ICapRadio(IBaseCap):
|
||||
"""
|
||||
Capability of radio websites.
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ class Station(CapBaseObject):
|
|||
def __repr__(self):
|
||||
return "<Station id=%r name=%r>" % (self.id, self.name)
|
||||
|
||||
|
||||
class Departure(CapBaseObject):
|
||||
"""
|
||||
Describes a departure.
|
||||
|
|
@ -62,6 +63,7 @@ class Departure(CapBaseObject):
|
|||
return u"<Departure id=%r type=%r time=%r departure=%r arrival=%r>" % (
|
||||
self.id, self.type, self.time.strftime('%H:%M'), self.departure_station, self.arrival_station)
|
||||
|
||||
|
||||
class RoadStep(CapBaseObject):
|
||||
"""
|
||||
A step on a roadmap.
|
||||
|
|
@ -73,11 +75,13 @@ class RoadStep(CapBaseObject):
|
|||
arrival = StringField('Arrival station')
|
||||
duration = DeltaField('Duration of this step')
|
||||
|
||||
|
||||
class RoadmapError(UserError):
|
||||
"""
|
||||
Raised when the roadmap is unable to be calculated.
|
||||
"""
|
||||
|
||||
|
||||
class RoadmapFilters(CapBaseObject):
|
||||
"""
|
||||
Filters to get a roadmap.
|
||||
|
|
@ -88,6 +92,7 @@ class RoadmapFilters(CapBaseObject):
|
|||
def __init__(self):
|
||||
CapBaseObject.__init__(self, '')
|
||||
|
||||
|
||||
class ICapTravel(IBaseCap):
|
||||
"""
|
||||
Travel websites.
|
||||
|
|
|
|||
|
|
@ -71,6 +71,7 @@ class Forecast(CapBaseObject):
|
|||
self.high = Temperature(high, unit)
|
||||
self.text = text
|
||||
|
||||
|
||||
class Current(CapBaseObject):
|
||||
"""
|
||||
Current weather.
|
||||
|
|
@ -85,6 +86,7 @@ class Current(CapBaseObject):
|
|||
self.text = text
|
||||
self.temp = Temperature(temp, unit)
|
||||
|
||||
|
||||
class City(CapBaseObject):
|
||||
"""
|
||||
City where to find weather.
|
||||
|
|
@ -95,11 +97,13 @@ class City(CapBaseObject):
|
|||
CapBaseObject.__init__(self, id)
|
||||
self.name = name
|
||||
|
||||
|
||||
class CityNotFound(UserError):
|
||||
"""
|
||||
Raised when a city is not found.
|
||||
"""
|
||||
|
||||
|
||||
class ICapWeather(IBaseCap):
|
||||
"""
|
||||
Capability for weather websites.
|
||||
|
|
|
|||
|
|
@ -43,13 +43,16 @@ class CallErrors(Exception):
|
|||
def __iter__(self):
|
||||
return self.errors.__iter__()
|
||||
|
||||
|
||||
class IResultsCondition(object):
|
||||
def is_valid(self, obj):
|
||||
raise NotImplementedError()
|
||||
|
||||
|
||||
class ResultsConditionError(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class BackendsCall(object):
|
||||
def __init__(self, backends, condition, function, *args, **kwargs):
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ class ModuleLoadError(Exception):
|
|||
Exception.__init__(self, msg)
|
||||
self.module = module_name
|
||||
|
||||
|
||||
class Module(object):
|
||||
def __init__(self, package):
|
||||
self.logger = getLogger('backend')
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ class IScheduler(object):
|
|||
def want_stop(self):
|
||||
raise NotImplementedError()
|
||||
|
||||
|
||||
class RepeatedTimer(_Timer):
|
||||
def run(self):
|
||||
while not self.finished.isSet():
|
||||
|
|
@ -55,6 +56,7 @@ class RepeatedTimer(_Timer):
|
|||
self.finished.wait(self.interval)
|
||||
self.finished.set()
|
||||
|
||||
|
||||
class Scheduler(IScheduler):
|
||||
def __init__(self):
|
||||
self.logger = getLogger('scheduler')
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ class ApplicationStorage(object):
|
|||
if self.storage:
|
||||
return self.storage.save('applications', self.name)
|
||||
|
||||
|
||||
class BaseApplication(object):
|
||||
"""
|
||||
Base application.
|
||||
|
|
|
|||
|
|
@ -50,9 +50,11 @@ class BackendNotGiven(Exception):
|
|||
Exception.__init__(self, 'Please specify a backend to use for this argument (%s@backend_name). '
|
||||
'Availables: %s.' % (id, ', '.join(name for name, backend in backends)))
|
||||
|
||||
|
||||
class BackendNotFound(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class ConsoleApplication(BaseApplication):
|
||||
"""
|
||||
Base application class for CLI applications.
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ __all__ = ['FormattersLoader', 'FormatterLoadError']
|
|||
class FormatterLoadError(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class FormattersLoader(object):
|
||||
BUILTINS = ['htmltable', 'multiline', 'simple', 'table', 'csv', 'webkit', 'json']
|
||||
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ class TableFormatter(IFormatter):
|
|||
table = PrettyTable(list(column_headers))
|
||||
for column_header in column_headers:
|
||||
# API changed in python-prettytable. The try/except is a bad hack to support both versions
|
||||
# Note: two versions are not exactly the same...
|
||||
# Note: two versions are not exactly the same...
|
||||
# (first one: header in center. Second one: left align for header too)
|
||||
try:
|
||||
table.set_field_align(column_header, 'l')
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ PLAYERS = (
|
|||
|
||||
class MediaPlayerNotFound(Exception):
|
||||
def __init__(self):
|
||||
Exception.__init__(self, u'No media player found on this system. Please install one of them: %s.' % \
|
||||
Exception.__init__(self, u'No media player found on this system. Please install one of them: %s.' %
|
||||
', '.join(player[0] for player in PLAYERS))
|
||||
|
||||
|
||||
|
|
@ -75,7 +75,7 @@ class MediaPlayer(object):
|
|||
"""
|
||||
player_names = [player[0] for player in PLAYERS]
|
||||
if not player_name:
|
||||
self.logger.debug(u'No media player given. Using the first available from: %s.' % \
|
||||
self.logger.debug(u'No media player given. Using the first available from: %s.' %
|
||||
', '.join(player_names))
|
||||
player_name = self.guess_player_name()
|
||||
if player_name is None:
|
||||
|
|
|
|||
|
|
@ -221,7 +221,7 @@ class BackendCfg(QDialog):
|
|||
continue
|
||||
|
||||
item = QTreeWidgetItem(None, [instance_name, name])
|
||||
item.setCheckState(0, Qt.Checked if params.get('_enabled', '1').lower() in ('1', 'y', 'true') \
|
||||
item.setCheckState(0, Qt.Checked if params.get('_enabled', '1').lower() in ('1', 'y', 'true')
|
||||
else Qt.Unchecked)
|
||||
|
||||
self.set_icon(item, info)
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ from ..base import BaseApplication
|
|||
|
||||
__all__ = ['QtApplication', 'QtMainWindow', 'QtDo', 'HTMLDelegate']
|
||||
|
||||
|
||||
class QtScheduler(IScheduler):
|
||||
def __init__(self, app):
|
||||
self.app = app
|
||||
|
|
@ -81,6 +82,7 @@ class QtScheduler(IScheduler):
|
|||
def run(self):
|
||||
self.app.exec_()
|
||||
|
||||
|
||||
class QCallbacksManager(QObject):
|
||||
class Request(object):
|
||||
def __init__(self):
|
||||
|
|
@ -132,6 +134,7 @@ class QCallbacksManager(QObject):
|
|||
request.event.wait()
|
||||
return request.answer
|
||||
|
||||
|
||||
class QtApplication(QApplication, BaseApplication):
|
||||
def __init__(self):
|
||||
QApplication.__init__(self, sys.argv)
|
||||
|
|
@ -143,10 +146,12 @@ class QtApplication(QApplication, BaseApplication):
|
|||
def create_weboob(self):
|
||||
return Weboob(scheduler=QtScheduler(self))
|
||||
|
||||
|
||||
class QtMainWindow(QMainWindow):
|
||||
def __init__(self, parent=None):
|
||||
QMainWindow.__init__(self, parent)
|
||||
|
||||
|
||||
class QtDo(QObject):
|
||||
def __init__(self, weboob, cb, eb=None):
|
||||
QObject.__init__(self)
|
||||
|
|
@ -223,6 +228,7 @@ class QtDo(QObject):
|
|||
def thread_eb(self, backend, error, backtrace):
|
||||
self.emit(SIGNAL('eb'), backend, error, backtrace)
|
||||
|
||||
|
||||
class HTMLDelegate(QStyledItemDelegate):
|
||||
def paint(self, painter, option, index):
|
||||
optionV4 = QStyleOptionViewItemV4(option)
|
||||
|
|
@ -260,6 +266,7 @@ class HTMLDelegate(QStyledItemDelegate):
|
|||
|
||||
return QSize(doc.idealWidth(), max(doc.size().height(), optionV4.decorationSize.height()))
|
||||
|
||||
|
||||
class _QtValueStr(QLineEdit):
|
||||
def __init__(self, value):
|
||||
QLineEdit.__init__(self)
|
||||
|
|
@ -277,11 +284,13 @@ class _QtValueStr(QLineEdit):
|
|||
self._value.set(unicode(self.text()))
|
||||
return self._value
|
||||
|
||||
|
||||
class _QtValueBackendPassword(_QtValueStr):
|
||||
def get_value(self):
|
||||
self._value._domain = None
|
||||
return _QtValueStr.get_value(self)
|
||||
|
||||
|
||||
class _QtValueBool(QCheckBox):
|
||||
def __init__(self, value):
|
||||
QCheckBox.__init__(self)
|
||||
|
|
@ -297,6 +306,7 @@ class _QtValueBool(QCheckBox):
|
|||
self._value.set(self.isChecked())
|
||||
return self._value
|
||||
|
||||
|
||||
class _QtValueInt(QSpinBox):
|
||||
def __init__(self, value):
|
||||
QSpinBox.__init__(self)
|
||||
|
|
@ -312,6 +322,7 @@ class _QtValueInt(QSpinBox):
|
|||
self._value.set(self.getValue())
|
||||
return self._value
|
||||
|
||||
|
||||
class _QtValueChoices(QComboBox):
|
||||
def __init__(self, value):
|
||||
QComboBox.__init__(self)
|
||||
|
|
@ -332,6 +343,7 @@ class _QtValueChoices(QComboBox):
|
|||
self._value.set(unicode(self.itemData(self.currentIndex()).toString()))
|
||||
return self._value
|
||||
|
||||
|
||||
def QtValue(value):
|
||||
if isinstance(value, ValueBool):
|
||||
klass = _QtValueBool
|
||||
|
|
|
|||
|
|
@ -70,12 +70,15 @@ __all__ = ['BrowserIncorrectPassword', 'BrowserForbidden', 'BrowserBanned', 'Bro
|
|||
class BrowserIncorrectPassword(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class BrowserForbidden(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class BrowserBanned(BrowserIncorrectPassword):
|
||||
pass
|
||||
|
||||
|
||||
class BrowserPasswordExpired(BrowserIncorrectPassword):
|
||||
pass
|
||||
|
||||
|
|
@ -83,9 +86,11 @@ class BrowserPasswordExpired(BrowserIncorrectPassword):
|
|||
class BrowserUnavailable(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class BrowserHTTPNotFound(BrowserUnavailable):
|
||||
pass
|
||||
|
||||
|
||||
class BrowserHTTPError(BrowserUnavailable):
|
||||
pass
|
||||
|
||||
|
|
@ -113,9 +118,11 @@ class NoHistory(object):
|
|||
def close(self):
|
||||
pass
|
||||
|
||||
|
||||
class BrokenPageError(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class BasePage(object):
|
||||
"""
|
||||
Base page
|
||||
|
|
@ -138,6 +145,7 @@ class BasePage(object):
|
|||
"""
|
||||
pass
|
||||
|
||||
|
||||
def check_location(func):
|
||||
def inner(self, *args, **kwargs):
|
||||
if args and isinstance(args[0], basestring):
|
||||
|
|
@ -152,6 +160,7 @@ def check_location(func):
|
|||
return func(self, *args, **kwargs)
|
||||
return inner
|
||||
|
||||
|
||||
class StandardBrowser(mechanize.Browser):
|
||||
"""
|
||||
Standard Browser.
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ __all__ = ['check_url', 'id2url']
|
|||
from urlparse import urlsplit
|
||||
import re
|
||||
|
||||
|
||||
class check_url(object):
|
||||
"""
|
||||
Checks if the first argument matches the given regular expression (given as str,
|
||||
|
|
|
|||
|
|
@ -50,6 +50,8 @@ def drop_comments(base_element):
|
|||
|
||||
# Replace relative url in link and image with a complete url
|
||||
# Arguments: the html element to clean, and the domain name (with http:// prefix)
|
||||
|
||||
|
||||
def clean_relativ_urls(base_element, domain):
|
||||
for a in base_element.findall('.//a'):
|
||||
if "href" in a.attrib:
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ class BasePasteBackend(ICapPaste):
|
|||
if max_age is False or max_age >= e:
|
||||
return e
|
||||
|
||||
|
||||
def test():
|
||||
class MockPasteBackend(BasePasteBackend):
|
||||
def __init__(self, expirations):
|
||||
|
|
|
|||
|
|
@ -46,10 +46,10 @@ class VirtKeyboard(object):
|
|||
|
||||
self.bands = img.getbands()
|
||||
if isinstance(color, int) and not isinstance(self.bands, str) and len(self.bands) != 1:
|
||||
raise VirtKeyboardError("Color requires %i component but only 1 is provided" \
|
||||
raise VirtKeyboardError("Color requires %i component but only 1 is provided"
|
||||
% len(self.bands))
|
||||
if not isinstance(color, int) and len(color) != len(self.bands):
|
||||
raise VirtKeyboardError("Color requires %i components but %i are provided" \
|
||||
raise VirtKeyboardError("Color requires %i components but %i are provided"
|
||||
% (len(self.bands), len(color)))
|
||||
self.color = color
|
||||
|
||||
|
|
@ -123,7 +123,7 @@ class VirtKeyboard(object):
|
|||
if dirname is None:
|
||||
dirname = tempfile.mkdtemp(prefix='weboob_session_')
|
||||
self.generate_MD5(dirname)
|
||||
raise VirtKeyboardError("Symbol '%s' not found; all symbol hashes are available in %s"\
|
||||
raise VirtKeyboardError("Symbol '%s' not found; all symbol hashes are available in %s"
|
||||
% (s, dirname))
|
||||
|
||||
def generate_MD5(self, dir):
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ class IParser(object):
|
|||
p = re.compile(r'<.*?>')
|
||||
return p.sub(' ', data).strip()
|
||||
|
||||
|
||||
class RawParser(IParser):
|
||||
def parse(self, data, encoding=None):
|
||||
return data.read()
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ from weboob.core import Weboob
|
|||
|
||||
__all__ = ['TestCase', 'BackendTest']
|
||||
|
||||
|
||||
class BackendTest(TestCase):
|
||||
BACKEND = None
|
||||
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ class ValuesDict(OrderedDict):
|
|||
for v in values:
|
||||
self[v.id] = v
|
||||
|
||||
|
||||
class Value(object):
|
||||
"""
|
||||
Value.
|
||||
|
|
@ -116,6 +117,7 @@ class Value(object):
|
|||
"""
|
||||
return self._value
|
||||
|
||||
|
||||
class ValueBackendPassword(Value):
|
||||
_domain = None
|
||||
_callbacks = {}
|
||||
|
|
@ -190,6 +192,7 @@ class ValueBackendPassword(Value):
|
|||
self._stored = False
|
||||
return self._value
|
||||
|
||||
|
||||
class ValueInt(Value):
|
||||
def __init__(self, *args, **kwargs):
|
||||
kwargs['regexp'] = '^\d+$'
|
||||
|
|
@ -198,6 +201,7 @@ class ValueInt(Value):
|
|||
def get(self):
|
||||
return int(self._value)
|
||||
|
||||
|
||||
class ValueFloat(Value):
|
||||
def __init__(self, *args, **kwargs):
|
||||
kwargs['regexp'] = '^[\d\.]+$'
|
||||
|
|
@ -212,6 +216,7 @@ class ValueFloat(Value):
|
|||
def get(self):
|
||||
return float(self._value)
|
||||
|
||||
|
||||
class ValueBool(Value):
|
||||
def __init__(self, *args, **kwargs):
|
||||
kwargs['choices'] = {'y': 'True', 'n': 'False'}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue