class BaseSQLObject(SQLObject):
- #@classmethod
+ @classmethod
def by(cls, connection = None, **kw):
try:
return cls.selectBy(connection = connection, **kw)[0]
except IndexError:
raise SQLObjectNotFound, "The object %s with columns %s does not exist" % (cls.__name__, kw)
- by = classmethod(by)
class Curso(BaseSQLObject):
# Clave
# Joins
pruebas = MultipleJoin('Prueba')
- _dir_base = 'intentos'
-
- #@classmethod
+ @classmethod
def getProximoAProbar(cls, connection = None):
try:
- return cls.select(cls.q.inicioPruebas == None, limit=1,
+ return cls.select(cls.q.compila == None, limit=1,
orderBy=cls.q.llegada, connection=connection)[0]
except IndexError:
return None
- getProximoAProbar = classmethod(getProximoAProbar)
def path(self, dir_base):
- import os.path
+ from os.path import join
curso = self.inscripto.curso
entrega = self.entrega
- return os.path.join(dir_base, curso.anio, curso.cuatrimestre,
- curso.curso, '%s.%s' % (entrega.nroEjercicio, entrega.entrega),
- self.inscripto.padron, self.numero)
+ return join(dir_base, '%s.%s' % (curso.anio, curso.cuatrimestre),
+ '%s.%s.%s' % (curso.curso, entrega.nroEjercicio, entrega.entrega),
+ '%s.%s' % (self.inscripto.padron, self.numero))
class Correccion(BaseSQLObject):
# Clave