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

Thadeu Lima de Souza Cascardo cascardo en cascardo.info
Vie Mar 20 17:12:46 UTC 2015


On Fri, Mar 20, 2015 at 10:52:12AM -0300, camponez en eduardoelias.com wrote:
> From: Eduardo Elias <camponez en gmail.com>
> 

Eu gosto desse! :-)

Vou olhar os demais e aplicar durante o final de semana.

Cascardo.

> ---
>  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
> 
> _______________________________________________
> Softwares-impostos mailing list
> Softwares-impostos en fsfla.org
> http://www.fsfla.org/cgi-bin/mailman/listinfo/softwares-impostos
------------ próxima parte ------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://www.fsfla.org/pipermail/softwares-impostos/attachments/20150320/a59eef7f/attachment.pgp>


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