Skip to content

Commit

Permalink
some issues in the typescript export 2
Browse files Browse the repository at this point in the history
  • Loading branch information
gfdac committed Jan 25, 2017
1 parent c5e0f2e commit ca0b969
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
10 changes: 9 additions & 1 deletion exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,18 @@ def isNotEmpty(s):

def createPropertyTypeScript(p):
r = ""
# Strings
if p.tipo is not None and p.valor is not None and p.valor is not "" and (
p.tipo.lower() == K_TIPO_STRING.lower() or p.tipo.lower() == K_TIPO_TEXT.lower() or p.tipo.lower() == K_TIPO_VARCHAR.lower()):
r = r + " " + p.name + ": " + converteTipos(p.tipo, K_EXPORTER_TYPESCRIPT) + " = '" + p.valor + "';"
#Numbers
elif p.tipo is not None and p.valor is not None and p.valor is not "" and (
p.tipo.lower() == K_TIPO_NUMBER.lower() or p.tipo.lower() == K_TIPO_FLOAT.lower() or p.tipo.lower() == K_TIPO_INTEGER.lower() or p.tipo.lower() == K_TIPO_DECIMAL.lower()):
r = r + " " + p.name + ": " + converteTipos(p.tipo, K_EXPORTER_TYPESCRIPT) + " = " + p.valor + ";"
# Boolean
elif p.tipo is not None and p.valor is not None and p.valor is not "" and (
p.tipo.lower() == K_TIPO_BOOLEAN.lower()):
r = r + " " + p.name + ": " + converteTipos(p.tipo, K_EXPORTER_TYPESCRIPT) + " = " + p.valor + ";"
elif p.tipo is not None:
r = r + " " + p.name + ": " + converteTipos(p.tipo, K_EXPORTER_TYPESCRIPT) + " = null;"
else:
Expand Down Expand Up @@ -371,8 +377,10 @@ def converteTipos(tipo, exporter):
elif exporter == K_EXPORTER_TYPESCRIPT:
if tipo.lower() == K_TIPO_INTEGER.lower() or tipo.lower() == K_TIPO_FLOAT.lower() or tipo.lower() == K_TIPO_DECIMAL.lower() or tipo.lower() == K_TIPO_NUMBER.lower():
return "number"
if tipo.lower() == K_TIPO_STRING.lower() or tipo.lower() == K_TIPO_VARCHAR.lower() or tipo.lower() == K_TIPO_TEXT.lower():
elif tipo.lower() == K_TIPO_STRING.lower() or tipo.lower() == K_TIPO_VARCHAR.lower() or tipo.lower() == K_TIPO_TEXT.lower():
return "string"
elif tipo.lower() == K_TIPO_BOOLEAN.lower():
return "boolean"
else:
return "Any"
# Todos
Expand Down
14 changes: 8 additions & 6 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
# !/usr/bin/python
# -*- coding: utf-8 -*-


import sys

import exporter as ex

import sys
if sys.version_info[0] < 3:
print (ex.bcolors.FAIL + "*"*90 + ex.bcolors.ENDC)
print (ex.bcolors.WARNING + "Erro. Sua versão do Python é a " + str(sys.version_info[0]) + ", e precisamos do Python 3. Atualize e tente novamente." + ex.bcolors.ENDC)
print (ex.bcolors.FAIL + "*"*90 + ex.bcolors.ENDC)
print(ex.bcolors.FAIL + "*" * 90 + ex.bcolors.ENDC)
print(ex.bcolors.WARNING + "Erro. Sua versão do Python é a " + str(
sys.version_info[0]) + ", e precisamos do Python 3. Atualize e tente novamente." + ex.bcolors.ENDC)
print(ex.bcolors.FAIL + "*" * 90 + ex.bcolors.ENDC)
else:
ex.startAskForModel()

0 comments on commit ca0b969

Please sign in to comment.