Exemplo n.º 1
0
 def get_current_pad(self):
     """
     The current pad always exists; A new one is created if necessary.
     """
     if self._current_pad_id is None:
         cursor = Pad.iterate(self, 1)
         try:
             self._current_pad = cursor.next()
         except StopIteration:
             self._current_pad = Pad.make(self.get_id())
         self._current_pad_id = self._current_pad.get_id()
         self.save()
     if self._current_pad is None:
         try:
             pad = Pad.lookup(self._current_pad_id, self)
         except PadInvalidId:
             pad = Pad.make(self)
         self._current_pad = pad
         self._current_pad_id = self._current_pad.get_id()
         self.save()
     return self._current_pad
Exemplo n.º 2
0
 def get_all_pads(self, limit=25):
     return list(Pad.iterate(self, limit))