erikg / Revelation
Revelation is a password manager for the GNOME desktop, released under the GNU GPL license. It stores all your accounts and passwords in a single, secure place, and gives you access to it through a user-friendly graphical interface.
| commit 212: | c335973efe9f |
| parent 211: | cff0e6f7ef34 |
| branch: | default |
Changed (Δ5.0 KB):
ChangeLog (11 lines added, 0 lines removed)
NEWS (10 lines added, 0 lines removed)
TODO (1 lines added, 2 lines removed)
src/lib/datahandler/Makefile.am (1 lines added, 0 lines removed)
src/lib/datahandler/__init__.py (2 lines added, 0 lines removed)
src/lib/datahandler/text.py (79 lines added, 0 lines removed)
src/lib/dialog.py (2 lines added, 1 lines removed)
test/Makefile.am (2 lines added, 0 lines removed)
test/datahandler_text.py (89 lines added, 0 lines removed)
1 |
1 |
Revelation changelog |
2 |
2 |
|
3 |
---------------[ xxxx-xx-xx : 0.4.0 ]--------------- |
|
4 |
||
5 |
2005-02-02 Erik Grinaker <erikg@codepoet.no> |
|
6 |
||
7 |
* set default button of "overwrite file?" dialog to Cancel |
|
8 |
||
9 |
* use STOCK_OVERWRITE instead of STOCK_OK for overwrite dialog |
|
10 |
||
11 |
* added plain text datahandler |
|
12 |
||
13 |
||
3 |
14 |
---------------[ 2005-02-01 : 0.4.0-pre2 ]--------------- |
4 |
15 |
|
5 |
16 |
2005-02-01 Erik Grinaker <erikg@codepoet.no> |
1 |
2005-02-01: Revelation 0.4.0-pre2 |
|
2 |
================================= |
|
3 |
||
4 |
New features: |
|
5 |
- added export to plain text |
|
6 |
||
7 |
Bugfixes: |
|
8 |
- set default button for overwrite dialog to cancel |
|
9 |
||
10 |
||
1 |
11 |
2005-02-01: Revelation 0.4.0-pre2 |
2 |
12 |
================================= |
3 |
13 |
1 |
|
|
1 |
0.4.x: |
|
2 |
2 |
- string cleanups |
3 |
3 |
- don't use modal dialogs unless absolutely necessary |
4 |
4 |
- password strength check - build python-crack as part of revelation |
5 |
5 |
- add import/export of PasswordSafe files |
6 |
6 |
- add import/export of GPasMan files |
7 |
7 |
- add import/export of zsafe files |
8 |
- add export to clear-text (normal ASCII text) |
|
9 |
8 |
- option for autolocking the file after a period of inactivity |
10 |
9 |
- sorting of the tree |
11 |
10 |
- update documentation |
Up to file-list src/lib/datahandler/Makefile.am:
| … | … | @@ -6,5 +6,6 @@ datahandler_DATA = \ |
6 |
6 |
gpass.py \ |
7 |
7 |
netrc.py \ |
8 |
8 |
rvl.py \ |
9 |
text.py \ |
|
9 |
10 |
xhtml.py |
10 |
11 |
Up to file-list src/lib/datahandler/__init__.py:
| … | … | @@ -28,12 +28,14 @@ from fpm import FPM |
28 |
28 |
from gpass import GPass |
29 |
29 |
from netrc import NetRC |
30 |
30 |
from rvl import RevelationXML, Revelation |
31 |
from text import PlainText |
|
31 |
32 |
from xhtml import XHTML |
32 |
33 |
|
33 |
34 |
HANDLERS = [ |
34 |
35 |
FPM, |
35 |
36 |
GPass, |
36 |
37 |
NetRC, |
38 |
PlainText, |
|
37 |
39 |
Revelation, |
38 |
40 |
XHTML, |
39 |
41 |
RevelationXML |
Up to file-list src/lib/datahandler/text.py:
1 |
# |
|
2 |
# Revelation 0.4.0 - a password manager for GNOME 2 |
|
3 |
# http://oss.codepoet.no/revelation/ |
|
4 |
# $Id$ |
|
5 |
# |
|
6 |
# Module for handling plain text files |
|
7 |
# |
|
8 |
# |
|
9 |
# Copyright (c) 2003-2005 Erik Grinaker |
|
10 |
# |
|
11 |
# This program is free software; you can redistribute it and/or |
|
12 |
# modify it under the terms of the GNU General Public License |
|
13 |
# as published by the Free Software Foundation; either version 2 |
|
14 |
# of the License, or (at your option) any later version. |
|
15 |
# |
|
16 |
# This program is distributed in the hope that it will be useful, |
|
17 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
18 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
19 |
# GNU General Public License for more details. |
|
20 |
# |
|
21 |
# You should have received a copy of the GNU General Public License |
|
22 |
# along with this program; if not, write to the Free Software |
|
23 |
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|
24 |
# |
|
25 |
||
26 |
import base |
|
27 |
from revelation import data, entry |
|
28 |
||
29 |
import time |
|
30 |
||
31 |
||
32 |
class PlainText(base.DataHandler): |
|
33 |
"Data handler for plain text files" |
|
34 |
||
35 |
name = "Plain text" |
|
36 |
importer = False |
|
37 |
exporter = True |
|
38 |
encryption = False |
|
39 |
||
40 |
||
41 |
def export_data(self, entrystore, password = None): |
|
42 |
"Exports data to a plain text file" |
|
43 |
||
44 |
# fetch and sort entries |
|
45 |
entries = [] |
|
46 |
iter = entrystore.iter_nth_child(None, 0) |
|
47 |
||
48 |
while iter is not None: |
|
49 |
e = entrystore.get_entry(iter) |
|
50 |
||
51 |
if type(e) != entry.FolderEntry: |
|
52 |
entries.append(e) |
|
53 |
||
54 |
iter = entrystore.iter_traverse_next(iter) |
|
55 |
||
56 |
entries.sort(lambda x,y: cmp(x.name.lower(), y.name.lower())) |
|
57 |
||
58 |
||
59 |
# generate the text |
|
60 |
text = "" |
|
61 |
||
62 |
for e in entries: |
|
63 |
text += "%s [%s]\n" % ( e.name, e.typename ) |
|
64 |
text += e.description != "" and "%s\n" % e.description or "" |
|
65 |
text += "%s\n" % time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(e.updated)) |
|
66 |
||
67 |
fields = [ field for field in e.fields if field.value != "" ] |
|
68 |
||
69 |
if len(fields) > 0: |
|
70 |
text += "\n" |
|
71 |
maxlen = max([ len(field.name) for field in fields ]) |
|
72 |
||
73 |
for field in fields: |
|
74 |
text += "- " + field.name + ": " + (" " * (maxlen - len(field.name))) + field.value + "\n" |
|
75 |
||
76 |
text += "\n\n" |
|
77 |
||
78 |
return text |
|
79 |
Up to file-list src/lib/dialog.py:
| … | … | @@ -253,7 +253,8 @@ class FileOverwrite(Warning): |
253 |
253 |
Warning.__init__( |
254 |
254 |
self, parent, "Overwrite existing file?", |
255 |
255 |
"The file '%s' already exists - do you wish to replace this file?" % file, |
256 |
( ( gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL ), ( |
|
256 |
( ( gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL ), ( ui.STOCK_OVERWRITE, gtk.RESPONSE_OK ) ), |
|
257 |
gtk.RESPONSE_CANCEL |
|
257 |
258 |
) |
258 |
259 |
|
259 |
260 |
Up to file-list test/Makefile.am:
| … | … | @@ -6,6 +6,7 @@ EXTRA_DIST= \ |
6 |
6 |
datahandler_gpass.py \ |
7 |
7 |
datahandler_netrc.py \ |
8 |
8 |
datahandler_rvl.py \ |
9 |
datahandler_text.py \ |
|
9 |
10 |
datahandler_xhtml.py \ |
10 |
11 |
entry.py \ |
11 |
12 |
io.py \ |
| … | … | @@ -20,6 +21,7 @@ check: |
20 |
21 |
python datahandler_gpass.py -v |
21 |
22 |
python datahandler_netrc.py -v |
22 |
23 |
python datahandler_rvl.py -v |
24 |
python datahandler_text.py -v |
|
23 |
25 |
python datahandler_xhtml.py -v |
24 |
26 |
python entry.py -v |
25 |
27 |
python io.py -v |
Up to file-list test/datahandler_text.py:
1 |
#!/usr/bin/env python |
|
2 |
||
3 |
# |
|
4 |
# Revelation 0.4.0 - a password manager for GNOME 2 |
|
5 |
# http://oss.codepoet.no/revelation/ |
|
6 |
# $Id$ |
|
7 |
# |
|
8 |
# Unit tests for PlainText datahandler module |
|
9 |
# |
|
10 |
# |
|
11 |
# Copyright (c) 2003-2005 Erik Grinaker |
|
12 |
# |
|
13 |
# This program is free software; you can redistribute it and/or |
|
14 |
# modify it under the terms of the GNU General Public License |
|
15 |
# as published by the Free Software Foundation; either version 2 |
|
16 |
# of the License, or (at your option) any later version. |
|
17 |
# |
|
18 |
# This program is distributed in the hope that it will be useful, |
|
19 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
20 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
21 |
# GNU General Public License for more details. |
|
22 |
# |
|
23 |
# You should have received a copy of the GNU General Public License |
|
24 |
# along with this program; if not, write to the Free Software |
|
25 |
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|
26 |
# |
|
27 |
||
28 |
import unittest |
|
29 |
||
30 |
from revelation import data, datahandler, entry |
|
31 |
||
32 |
||
33 |
class PlainText(unittest.TestCase): |
|
34 |
"PlainText" |
|
35 |
||
36 |
def test_attrs(self): |
|
37 |
"PlainText has sane attrs" |
|
38 |
||
39 |
self.assertEquals(datahandler.PlainText.name, "Plain text") |
|
40 |
self.assertEquals(datahandler.PlainText.importer, False) |
|
41 |
self.assertEquals(datahandler.PlainText.exporter, True) |
|
42 |
self.assertEquals(datahandler.PlainText.encryption, False) |
|
43 |
||
44 |
||
45 |
||
46 |
class Plaintext_export_data(unittest.TestCase): |
|
47 |
"PlainText.export_data()" |
|
48 |
||
49 |
def test_data(self): |
|
50 |
"PlainText.export_data() exports data" |
|
51 |
||
52 |
s = data.EntryStore() |
|
53 |
||
54 |
e = entry.GenericEntry() |
|
55 |
e.name = "name" |
|
56 |
e.description = "description" |
|
57 |
e.updated = 1107348151 |
|
58 |
e[entry.HostnameField] = "hostname" |
|
59 |
e[entry.UsernameField] = "username" |
|
60 |
e[entry.PasswordField] = "password" |
|
61 |
s.add_entry(e) |
|
62 |
||
63 |
text = datahandler.PlainText().export_data(s) |
|
64 |
||
65 |
self.assertEquals(e.typename in text, True) |
|
66 |
self.assertEquals("name" in text, True) |
|
67 |
self.assertEquals("description" in text, True) |
|
68 |
self.assertEquals("2005-02-02 13:42:31" in text, True) |
|
69 |
self.assertEquals("hostname" in text, True) |
|
70 |
self.assertEquals("username" in text, True) |
|
71 |
self.assertEquals("password" in text, True) |
|
72 |
||
73 |
||
74 |
def test_folder(self): |
|
75 |
"PlainText.export_data() ignores folders" |
|
76 |
||
77 |
s = data.EntryStore() |
|
78 |
e = entry.FolderEntry() |
|
79 |
e.name = "testfolder" |
|
80 |
s.add_entry(e) |
|
81 |
||
82 |
text = datahandler.PlainText().export_data(s) |
|
83 |
self.assertEquals(text, "") |
|
84 |
||
85 |
||
86 |
||
87 |
if __name__ == "__main__": |
|
88 |
unittest.main() |
|
89 |
