equal
deleted
inserted
replaced
204 |
204 |
205 def _subscribe_boxes(self): |
205 def _subscribe_boxes(self): |
206 """Writes all created mailboxes to the subscriptions file.""" |
206 """Writes all created mailboxes to the subscriptions file.""" |
207 if not self._boxes: |
207 if not self._boxes: |
208 return |
208 return |
209 subscriptions = open('subscriptions', 'w') |
209 with open('subscriptions', 'w') as subscriptions: |
210 subscriptions.write('\n'.join(self._boxes)) |
210 subscriptions.write('\n'.join(self._boxes)) |
211 subscriptions.write('\n') |
211 subscriptions.write('\n') |
212 subscriptions.flush() |
|
213 subscriptions.close() |
|
214 os.chown('subscriptions', self._user.uid, self._user.gid) |
212 os.chown('subscriptions', self._user.uid, self._user.gid) |
215 os.chmod('subscriptions', self.__class__.FILE_MODE) |
213 os.chmod('subscriptions', self.__class__.FILE_MODE) |
216 del self._boxes[:] |
214 del self._boxes[:] |
217 |
215 |
218 def _add_boxes(self, mailboxes, subscribe): |
216 def _add_boxes(self, mailboxes, subscribe): |