WIP lookup commands

This commit is contained in:
DiG 2022-01-17 12:57:28 +01:00
parent 26a123bb1e
commit 0625b3e414
1 changed files with 16 additions and 2 deletions

View File

@ -123,6 +123,9 @@ def autolog():
# Update data through a record
#user.name = "Brian Jones"
def file_path( muid, format ):
return "%s/%s.%s" % ( FOLDER, muid, format )
def json_path( model, id ):
return "%s/%s.json" % ( FOLDER, Muid(model, id) )
@ -215,10 +218,21 @@ def fields( model, domains ):
stack = []
current_exports = []
def lookup_file( muid, format ):
filename = file_path( muid, format )
# print( field.ttype, field.relation, id, _filename )
if not os.path.exists( filename ):
return { 'file': filename, 'exists': False }
else:
return { 'file': filename, 'exists': True }
def lookup_model( muid ):
eprint( "> Lookup model: %s" % (muid) )
# _stack = []
recursive = False
if ( 'recursive' in opts and opts['recursive'] ): # or ( 'format' in opts and 'json' in opts['format'] ):
recursive = opts['recursive']
eprint( "> Recursive: %s" % (recursive) )
_tree = {}
# _ctree = _tree
model, id = muid.split( '/' )
@ -267,7 +281,7 @@ def lookup_model( muid ):
return _tree
def lookup_recs( model, domains ):
eprint( "> Lookup recursif: %s %s" % (model,domains) )
eprint( "> Lookup many: %s %s" % (model,domains) )
if model in MODEL_IGNORE:
eprint( 'IGNORED' )
return