comparison src/memory/memory.py @ 566:9faccd827657

core: sqlite storage constraint fix
author Goffi <goffi@goffi.org>
date Mon, 07 Jan 2013 00:57:50 +0100
parents 4f856dd4c0d0
children ca13633d3b6b
comparison
equal deleted inserted replaced
565:7573897831ee 566:9faccd827657
139 def createProfile(self, profile): 139 def createProfile(self, profile):
140 """Create a new profile 140 """Create a new profile
141 @param profile: profile of the profile""" 141 @param profile: profile of the profile"""
142 #FIXME: must be asynchronous and call the callback once the profile actually exists 142 #FIXME: must be asynchronous and call the callback once the profile actually exists
143 if self.storage.hasProfile(profile): 143 if self.storage.hasProfile(profile):
144 info (_('The profile profile already exists')) 144 info (_('The profile [%s] already exists') % (profile,))
145 return True 145 return True
146 if not self.host.trigger.point("ProfileCreation", profile): 146 if not self.host.trigger.point("ProfileCreation", profile):
147 return False 147 return False
148 self.storage.createProfile(profile) 148 self.storage.createProfile(profile)
149 return False 149 return False
677 677
678 def addServerIdentity(self, category, _type, entity, profile): 678 def addServerIdentity(self, category, _type, entity, profile):
679 """Add an identity discovered from server 679 """Add an identity discovered from server
680 @param feature: string of the feature 680 @param feature: string of the feature
681 @param profile: which profile is using this server ?""" 681 @param profile: which profile is using this server ?"""
682 if not self.server_identities.has_key(profile): 682 if not profile in self.server_identities:
683 self.server_identities[profile] = {} 683 self.server_identities[profile] = {}
684 if not self.server_identities[profile].has_key((category, _type)): 684 if not self.server_identities[profile].has_key((category, _type)):
685 self.server_identities[profile][(category, _type)]=set() 685 self.server_identities[profile][(category, _type)]=set()
686 self.server_identities[profile][(category, _type)].add(entity) 686 self.server_identities[profile][(category, _type)].add(entity)
687 687
688 def getServerServiceEntities(self, category, _type, profile): 688 def getServerServiceEntities(self, category, _type, profile):
689 """Return all available entities for a service""" 689 """Return all available entities for a service"""
690 if self.server_identities.has_key(profile): 690 if profile in self.server_identities:
691 return self.server_identities[profile].get((category, _type), set()) 691 return self.server_identities[profile].get((category, _type), set())
692 else: 692 else:
693 return None 693 return None
694 694
695 def getServerServiceEntity(self, category, _type, profile): 695 def getServerServiceEntity(self, category, _type, profile):