[PATCH 1/3] Inicia o menu recebendo CPF como parametro

camponez en eduardoelias.com camponez en eduardoelias.com
Vie Mar 20 13:52:12 UTC 2015


From: Eduardo Elias <camponez em gmail.com>

---
 src/menu.py | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/menu.py b/src/menu.py
index 094285f..f5ef2d6 100644
--- a/src/menu.py
+++ b/src/menu.py
@@ -78,7 +78,7 @@ def Salvar(UI, contrib):
     contrib.save()
 
 def menu(UI, contrib):
-    m = [ 
+    m = [
         "Sair",
         "Salvar",
         u"Declaração",
@@ -106,11 +106,12 @@ def menu(UI, contrib):
         else:
             f[r](UI, contrib)
 
-def main():
+def main(cpf):
     ret = False
     UI = baseui.BaseUI()
     while ret == False:
-        cpf = UI.get_string("Digite seu CPF: ")
+        if not cpf:
+            cpf = UI.get_string("Digite seu CPF: ")
         try:
             contrib = contribuinte.Contribuinte(cpf)
             ret = menu(UI, contrib)
@@ -118,6 +119,7 @@ def main():
             print "CPF invalido"
 
 if __name__ == '__main__':
-    main()
+    cpf = sys.argv[1] if len(sys.argv) > 1 else None
+    main(cpf)
 
 # vim:tabstop=4:expandtab:smartindent
-- 
2.3.3.377.gdac1145



Más información sobre la lista de distribución Softwares-impostos