Beispiel #1
0
    def initialize(self):
        # A dictionary of group name/Group instance items
        self.dbm['groups'] = dirdbm.Shelf(os.path.join(self.path, 'groups'))

        # A dictionary of group name/email address
        self.dbm['moderators'] = dirdbm.Shelf(os.path.join(self.path, 'moderators'))

        # A list of group names
        self.dbm['subscriptions'] = []

        # A dictionary of MessageID strings/xref lists
        self.dbm['Message-IDs'] = dirdbm.Shelf(os.path.join(self.path, 'Message-IDs'))
Beispiel #2
0
 def __init__(self, logPath):
     self.db = dirdbm.Shelf(logPath)
     indexs = map(int, self.db.keys())
     if indexs:
         self.currentIndex = max(indexs)
     else:
         self.currentIndex = 0
Beispiel #3
0
    def testRebuildInteraction(self):
        from twisted.persisted import dirdbm
        from twisted.python import rebuild

        s = dirdbm.Shelf('dirdbm.rebuild.test')
        s['key'] = 'value'
        rebuild.rebuild(dirdbm)
Beispiel #4
0
    def __init__(self, mailhost, path):
        self.path = path
        self.mailhost = mailhost

        if not os.path.exists(path):
            os.mkdir(path)

        self.dbm = dirdbm.Shelf(os.path.join(path, "newsshelf"))
        if not len(self.dbm.keys()):
            self.initialize()
Beispiel #5
0
 def setUp(self):
     self.path = FilePath(self.mktemp())
     self.dbm = dirdbm.Shelf(self.path.path)
     self.items = (
         (b"abc", b"foo"),
         (b"/lalal", b"\000\001"),
         (b"\000\012", b"baz"),
         (b"int", 12),
         (b"float", 12.0),
         (b"tuple", (None, 12)),
     )
Beispiel #6
0
    def __init__(self, mailhost, path, sender=None):
        """
        @param mailhost: A C{str} giving the mail exchange host which will
            accept moderation emails from this server.  Must accept emails
            destined for any address specified as a moderator.

        @param sender: A C{str} giving the address which will be used as the
            sender of any moderation email generated by this server.
        """
        self.path = path
        self._mailhost = self.mailhost = mailhost
        self._sender = sender

        if not os.path.exists(path):
            os.mkdir(path)

        self.dbm = dirdbm.Shelf(os.path.join(path, "newsshelf"))
        if not len(self.dbm.keys()):
            self.initialize()
Beispiel #7
0
 def test_rebuildInteraction(self):
     s = dirdbm.Shelf("dirdbm.rebuild.test")
     s[b"key"] = b"value"
     rebuild.rebuild(dirdbm)
Beispiel #8
0
 def setUp(self):
     self.path = self.mktemp()
     self.dbm = dirdbm.Shelf(self.path)
     self.items = (('abc', 'foo'), ('/lalal', '\000\001'), ('\000\012',
                                                            'baz'),
                   ('int', 12), ('float', 12.0), ('tuple', (None, 12)))
Beispiel #9
0
 def test_rebuildInteraction(self):
     s = dirdbm.Shelf('dirdbm.rebuild.test')
     s[b'key'] = b'value'
     rebuild.rebuild(dirdbm)
Beispiel #10
0
 def setUp(self):
     self.path = FilePath(self.mktemp())
     self.dbm = dirdbm.Shelf(self.path.path)
     self.items = ((b'abc', b'foo'), (b'/lalal', b'\000\001'), (b'\000\012', b'baz'),
                   (b'int', 12), (b'float', 12.0), (b'tuple', (None, 12)))