Here is how I store my SMTP_PASSWORD
try: #attempt it (exception if not already there)
ent=entity.getEntity("storage/passwords","SMTP_PASSWORD",
namespace=self.getAppName(), owner='smartwall',
sessionKey=cherrypy.session['sessionKey'])
ent['password']= .... clear text password here....
ent['clear_password'] = None
ent['encr_password'] = None
ent['username'] = None
entity.setEntity(ent)
except Exception as e: #create a new one
logger.info("SMTP_PASSWORD does not exist, try creating a new one")
ent = entity.Entity("storage/passwords", "SMTP_PASSWORD",
namespace=self.getAppName(), owner='smartwall')
ent['password'] = ....clear text password here....
ent['name'] = "SMTP_PASSWORD"
entity.setEntity(ent)
... View more