From: Leandro Lucarella Date: Mon, 21 Feb 2005 19:46:37 +0000 (+0000) Subject: Nueva opción para ver atributos de un objeto con el comando ls de sc_dbq. X-Git-Tag: svn_import~96 X-Git-Url: https://git.llucax.com/software/sercom-old.git/commitdiff_plain/3f3ef2946498735ebb3170ab304d84fed9865ce1 Nueva opción para ver atributos de un objeto con el comando ls de sc_dbq. --- diff --git a/src/sc_dbq b/src/sc_dbq index e105f1f..34b0e7b 100755 --- a/src/sc_dbq +++ b/src/sc_dbq @@ -43,6 +43,12 @@ conn = sqlobject.connectionForURI(conf.get('dbo', 'database')) # Argumentos interesantes obj = sys.argv[1] +try: + pos = obj.index('.') + attr = obj[pos+1:] + obj = obj[:pos] +except: + attr = None cmd = sys.argv[2] oid = None args = sys.argv[3:] @@ -62,7 +68,14 @@ try: else: objs = eval(obj).select(connection=conn) for o in objs: - print o + if attr is None: + print o + else: + print o + print attr + ':' + import pprint + attr = eval('o.' + attr) + pprint.pprint(attr) elif cmd in ('rm', 'remove', 'delete', 'del'): if oid is not None: objs = [eval(obj).get(oid, connection=conn)] diff --git a/src/sc_test b/src/sc_test index f9518f1..fad2a06 100755 --- a/src/sc_test +++ b/src/sc_test @@ -112,14 +112,15 @@ while continuar: log.info('Nuevo intento a probar (%s)', intento) # Obtengo paths intento_dir = os.path.join(data_dir, intento.path('intentos')) - entrega_dir = os.path.join(data_dir, intento.path('entregas')) + entrega_dir = os.path.join(data_dir, 'ejercicios', str(intento.entrega.ejercicioID)) + print entrega_dir # Busco makefile makefile = os.path.join(entrega_dir, 'Makefile') if not os.path.exists(makefile): makefile = os.path.join(data_dir, 'Makefile') shutil.copy(makefile, intento_dir) # Compilo - log.debug('A punto de ejecutar el comando: make -f %s', makefile) + log.debug('Ejecutando: make -f %s', makefile) intento.inicioCompila = datetime.datetime.now() make = subprocess.Popen(('make', '-f', makefile), stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=intento_dir)