|
From: <Z3...@us...> - 2010-09-05 17:06:10
|
Revision: 313
http://spd.svn.sourceforge.net/spd/?rev=313&view=rev
Author: Z3po
Date: 2010-09-05 17:06:04 +0000 (Sun, 05 Sep 2010)
Log Message:
-----------
added findPassword function and also possibility to add entries
Modified Paths:
--------------
branches/spd-ng/src/spdCLI.py
branches/spd-ng/src/spdInterface.py
Modified: branches/spd-ng/src/spdCLI.py
===================================================================
--- branches/spd-ng/src/spdCLI.py 2010-09-05 13:05:18 UTC (rev 312)
+++ branches/spd-ng/src/spdCLI.py 2010-09-05 17:06:04 UTC (rev 313)
@@ -12,21 +12,43 @@
"""Print the passwords out of a dictionary.
# passdict: the dictionary full of passwords"""
- if type(passdict).__name__ != 'NoneType':
+ if type(passdict).__name__ != 'NoneType' and len(passdict) != 0:
if self.output == 'normal':
- for key in passdict:
- print key + ':' + passdict[key].value
+ length = 0
+ for key in passdict.keys():
+ if length < len(key):
+ length = len(key)
+ print ""
+ for i in range(0,len(passdict.values()[0])):
+ print "__ID".ljust(length) + ':' + str(passdict["__ID"][i])
+ for key in passdict:
+ if key == '__ID':
+ continue
+ if type(passdict[key][i]).__name__ != 'NoneType':
+ print key.ljust(length) + ': ' + passdict[key][i]
+ else:
+ print key.ljust(length) + ': '
+ print ""
else:
print "No Results found"
# }}}
- def findPasswordsInteractive(): # {{{
+ def findPasswordsInteractive(self): # {{{
"""Create the searchString interactively"""
searchstring = raw_input("Please give your Searchstrings separated by whitespace")
return searchstring
# }}}
-
+
+ def createEntry(self,columns): # {{{
+ Entry = {}
+ print "Adding a new Entry to our passfile"
+ for column in columns:
+ value = raw_input(column + ': ')
+ Entry.update({ column : value })
+ return Entry
+ # }}}
+
# }}}
# EOF
Modified: branches/spd-ng/src/spdInterface.py
===================================================================
--- branches/spd-ng/src/spdInterface.py 2010-09-05 13:05:18 UTC (rev 312)
+++ branches/spd-ng/src/spdInterface.py 2010-09-05 17:06:04 UTC (rev 313)
@@ -47,6 +47,10 @@
self.client.printPasswords(passdict)
# }}}
+ def addEntry(self): # {{{
+ Entry = self.client.createEntry(self.core.getColumns())
+ self.core.addEntry(Entry)
+ # }}}
# }}}
@@ -75,12 +79,12 @@
# dest ="id",
# help ="Show Password by ID")
#
-#parser.add_option( "-a", "--add",
-# action="store_true",
-# dest = "add",
-# default=False,
-# help = "Add an Entry")
-#
+parser.add_option( "-a", "--add",
+ action="store_true",
+ dest = "add",
+ default=False,
+ help = "Add an Entry")
+
#parser.add_option( "--add-collumn",
# metavar="Collumn",
# dest = "addcollumn",
@@ -113,6 +117,10 @@
# }}}
interface = Interface()
+
+if options.add:
+ interface.addEntry()
+
interface.findPasswords(args)
# EOF
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|