Esempio n. 1
0
	def rm(self, uri, idtype=ID_URI, force=False):
		us = User(self.dburi, self.db)
		ur = Uri(self.dburi, self.db)
		cr = Cred(self.dburi, self.db)
		try:
			uid = ur.get_uid(uri)
		except:
			if force: return
			raise
		try:
			ur.rm_uid(uid, force=force)
		except Error:
			pass
		try:
			cr.rm_uid(uid, force=force)
		except Error:
			pass
		try:
			us.rm(uid, force=force)
		except Error:
			pass
		us.purge()
		ur.purge()
		cr.purge()
		self._reload()
Esempio n. 2
0
	def rm(self, domains, force=False):
		do = Domain(self.dburi, self.db)
		da = Domain_attrs(self.dburi, self.db)
		ur = Uri(self.dburi, self.db)
		cr = Cred(self.dburi, self.db)
		domains = uniq(domains)

		doms = []
		for d in domains:
			try:
				did = do.get_did(d)
			except:
				if not force:
					raise Error (ENODOMAIN, d)
			doms.append((did, d))

		for i, d in doms:
			try:
				ur.rm_did(i, force=force)
			except:
				pass
			try:
				cr.rm_realm(d, force=force)
			except:
				pass
			do.rm(i, d, force=force)

		do.purge()
		ur.purge()
		cr.purge()
		da.purge()
		self._reload()