remove uneeded file
On Mon, Dec 13, 2010 at 03:03:20PM -0600, Sebastian Spaeth wrote: > > > ...From where is the "Repository" object used? > > Please delete the Respository clas (repository.py) for now. I am sorry > it sneaked it (I blame my horrible jet leg on it). I would like to > introduce it in a later topic, but not at this time. Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
parent
40dcab7134
commit
667dd30afe
@ -1,67 +0,0 @@
|
|||||||
# Repository - abstract Repository class that returns the correct
|
|
||||||
# Repository type instance based on 'account' and 'reqtype', e.g.
|
|
||||||
# a ImapRepository instance
|
|
||||||
|
|
||||||
# Copyright (C) 2010 Sebastian Spaeth
|
|
||||||
#
|
|
||||||
# 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
|
|
||||||
from offlineimap.repository.IMAP import IMAPRepository, MappedIMAPRepository
|
|
||||||
from offlineimap.repository.Gmail import GmailRepository
|
|
||||||
from offlineimap.repository.Maildir import MaildirRepository
|
|
||||||
from offlineimap.repository.LocalStatus import LocalStatusRepository
|
|
||||||
|
|
||||||
class Repository(object):
|
|
||||||
"""Abstract class that returns the correct Repository type
|
|
||||||
instance based on 'account' and 'reqtype', e.g. a
|
|
||||||
class:`ImapRepository` instance."""
|
|
||||||
|
|
||||||
def __new__(cls, account, reqtype):
|
|
||||||
"""
|
|
||||||
:param account: :class:`Account`
|
|
||||||
:param regtype: 'remote', 'local', or 'status'"""
|
|
||||||
|
|
||||||
if reqtype == 'remote':
|
|
||||||
name = account.getconf('remoterepository')
|
|
||||||
# We don't support Maildirs on the remote side.
|
|
||||||
typemap = {'IMAP': IMAPRepository,
|
|
||||||
'Gmail': GmailRepository}
|
|
||||||
|
|
||||||
elif reqtype == 'local':
|
|
||||||
name = account.getconf('localrepository')
|
|
||||||
typemap = {'IMAP': MappedIMAPRepository,
|
|
||||||
'Maildir': MaildirRepository}
|
|
||||||
|
|
||||||
elif reqtype == 'status':
|
|
||||||
# create and return a LocalStatusRepository
|
|
||||||
name = account.getconf('localrepository')
|
|
||||||
return LocalStatusRepository(name, account)
|
|
||||||
|
|
||||||
else:
|
|
||||||
raise ValueError, "Request type %s not supported" % reqtype
|
|
||||||
|
|
||||||
config = account.getconfig()
|
|
||||||
repostype = config.get('Repository ' + name, 'type').strip()
|
|
||||||
return typemap[repostype](name, account)
|
|
||||||
|
|
||||||
def __init__(self, account, reqtype):
|
|
||||||
"""Load the correct Repository type and return that. The
|
|
||||||
__init__ of the corresponding Repository class will be
|
|
||||||
executed instead of this stub
|
|
||||||
|
|
||||||
:param account: :class:`Account`
|
|
||||||
:param regtype: 'remote', 'local', or 'status'
|
|
||||||
"""
|
|
||||||
pass
|
|
Loading…
Reference in New Issue
Block a user