Exemplo n.º 1
0
 def getPropertyValue(self, name, default):
     properties = timemachine.filter(
         Property.objects.filter(ticket=self, name=name))
     if len(properties) == 0:
         return default
     else:
         return properties[:][-1].value
Exemplo n.º 2
0
	def relatedByRelations( self, relationName ):
		relations = timemachine.filter( Relation.objects.filter( relatedTo = self, name__endswith = relationName ) )
		result = collections.OrderedDict()
		for relation in relations:
			if relation.name == relationName:
				result[ relation.ticket.id ] = relation;
			else:
				assert relation.name == "Not " + relationName
				try:
					del result[ relation.ticket.id ]
				except:
					pass
		return result.values()
Exemplo n.º 3
0
 def relations(self, relationName):
     relations = timemachine.filter(
         Relation.objects.filter(ticket=self, name__endswith=relationName))
     result = collections.OrderedDict()
     for relation in relations:
         if relation.name == relationName:
             result[relation.relatedTo.id] = relation
         else:
             assert relation.name == "Not " + relationName
             try:
                 del result[relation.relatedTo.id]
             except:
                 pass
     return sorted(result.values(), key=lambda x: x.order)
Exemplo n.º 4
0
	def getPropertyValue( self, name, default ):
		properties = timemachine.filter( Property.objects.filter( ticket = self, name = name ) )
		if len( properties ) == 0:
			return default
		else:
			return properties[ : ][ -1 ].value
Exemplo n.º 5
0
	def propertiesWithoutDups( self ):
		noDups = collections.OrderedDict()
		for property in timemachine.filter( self.properties.all() ):
			noDups[ property.name ] = property
		return [ p for p in noDups.values() ]
Exemplo n.º 6
0
 def propertiesWithoutDups(self):
     noDups = collections.OrderedDict()
     for property in timemachine.filter(self.properties.all()):
         noDups[property.name] = property
     return [p for p in noDups.values()]