Complete FeederComponent tests
- raise NotImplementedError exception for abstracts methods - implement test_handle_tick darcs-hash:20061105195847-86b55-af88958079cd5321808c2540d8c498bf47f60999.gz
This commit is contained in:
@@ -460,7 +460,7 @@ class JCLComponent(Component, object):
|
||||
self.account_class.q.user_jid == base_from_jid
|
||||
and self.account_class.q.name == name)
|
||||
if accounts.count() >= 1:
|
||||
self._send_presence_available(_account[0], show, lang_class)
|
||||
self._send_presence_available(accounts[0], show, lang_class)
|
||||
self.db_disconnect()
|
||||
return 1
|
||||
|
||||
|
||||
30
src/jcl/jabber/error.py
Normal file
30
src/jcl/jabber/error.py
Normal file
@@ -0,0 +1,30 @@
|
||||
##
|
||||
## error.py
|
||||
## Login : David Rousselie <dax@happycoders.org>
|
||||
## Started on Sun Nov 5 20:13:48 2006 David Rousselie
|
||||
## $Id$
|
||||
##
|
||||
## Copyright (C) 2006 David Rousselie
|
||||
## This program is free software; you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published by
|
||||
## the Free Software Foundation; either version 2 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program; if not, write to the Free Software
|
||||
## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
##
|
||||
|
||||
"""Jabber exception classes"""
|
||||
|
||||
__revision__ = "$Id: error.py,v 1.1 2006/11/05 20:13:48 dax Exp $"
|
||||
|
||||
class FieldError(Exception):
|
||||
"""Error raised when error exists on Jabber Data Form fields"""
|
||||
pass
|
||||
|
||||
@@ -53,36 +53,34 @@ class FeederComponent(JCLComponent):
|
||||
self.sender = Sender()
|
||||
self.check_interval = 1
|
||||
|
||||
self.__logger = logging.getLogger("jcl.jabber.JCLComponent")
|
||||
self.__logger = logging.getLogger("jcl.jabber.FeederComponent")
|
||||
|
||||
def handle_tick(self):
|
||||
"""Implement main feed/send behavior"""
|
||||
pass
|
||||
self.db_connect()
|
||||
for acc in self.account_class.select():
|
||||
print "OK"
|
||||
# for data in self.feeder.feed(account):
|
||||
# self.sender.send(account, data)
|
||||
for _account in self.account_class.select(orderBy = "user_jid"):
|
||||
for data in self.feeder.feed(_account):
|
||||
self.sender.send(_account, data)
|
||||
self.db_disconnect()
|
||||
|
||||
|
||||
|
||||
class Feeder(object):
|
||||
"""Abstract feeder class"""
|
||||
def __init__(self):
|
||||
pass
|
||||
def __init__(self, stream = None):
|
||||
self.stream = stream
|
||||
|
||||
def feed(self, account):
|
||||
"""Feed data for given account"""
|
||||
pass
|
||||
raise NotImplementedError
|
||||
|
||||
|
||||
class Sender(object):
|
||||
"""Abstract sender class"""
|
||||
def __init__(self):
|
||||
pass
|
||||
def __init__(self, stream = None):
|
||||
self.stream = stream
|
||||
|
||||
def send(self, to_account, data):
|
||||
"""Send data to given account"""
|
||||
pass
|
||||
raise NotImplementedError
|
||||
|
||||
|
||||
Reference in New Issue
Block a user