def setPropHook(self, name, value, oldProp = None): # scramble sensitive properties before saving try: if not self.catNode.entries.has_key(self.name): raise Exception(_('%s not found in the config, renaming config ' 'entries while Inspecting is not allowed.')%self.name) entry = self.catNode.entries[self.name] entry[name] = value finally: scrams = [] for entry in self.catNode.entries.values(): for key in entry.keys(): if key in sensitive_properties: val = entry[key] entry[key] = scrm.scramble(val) scrams.append((entry, key, val)) self.catNode.updateConfig() # unscramble sensitive properties for entry, key, val in scrams: entry[key] = val return True
def setPropHook(self, name, value, oldProp=None): # scramble sensitive properties before saving try: if not self.name in self.catNode.entries: raise Exception( _('%s not found in the config, renaming config ' 'entries while Inspecting is not allowed.') % self.name) entry = self.catNode.entries[self.name] entry[name] = value finally: scrams = [] for entry in self.catNode.entries.values(): for key in entry.keys(): if key in sensitive_properties: val = entry[key] entry[key] = scrm.scramble(val) scrams.append((entry, key, val)) self.catNode.updateConfig() # unscramble sensitive properties for entry, key, val in scrams: entry[key] = val return True
def OnLoginCVS(self, event, cvsroot=''): cvsDir = self.list.node.resourcepath # Login can be called from file system folders and cvs folders if isinstance(self.list.node, FSCVSFolderNode): cvsroot = self.list.node.root else: if not cvsroot: if os.environ.has_key('CVSROOT'): cvsroot = os.environ['CVSROOT'] else: cvsroot = '' cvsroot = self.cvsCmdPrompt(cvsroot, cvsDir, help=_('Change the CVSROOT if necessary:')) dlg = wx.TextEntryDialog(self.list, _('Enter cvs password for %s')%cvsroot, 'CVS login', '', style=wx.OK | wx.CANCEL | wx.CENTRE | wx.TE_PASSWORD) try: if dlg.ShowModal() == wx.ID_OK: password = scrm.scramble(dlg.GetValue()) else: return finally: dlg.Destroy() passfile, passwds = self.readCVSPass() passln = cvsroot + ' ' +password + '\n' if passln not in passwds: passfile.write(passln) passfile.close()
def refresh(self): # Important: To keep the explorer list and the inspector in sync, # the reference to self.entries should only be updated # and not reassigned if type(self.entries) == type({}): self.entries.clear() self.entries.update(self.getConfigValue()) # unscramble sensitive properties for item in self.entries.keys(): if type(self.entries[item]) == type({}): dict = self.entries[item] for name in dict.keys(): if name in sensitive_properties: dict[name] = scrm.scramble(dict[name])[2:]
def OnLoginCVS(self, event, cvsroot=''): cvsDir = self.list.node.resourcepath # Login can be called from file system folders and cvs folders if isinstance(self.list.node, FSCVSFolderNode): cvsroot = self.list.node.root else: if not cvsroot: if os.environ.has_key('CVSROOT'): cvsroot = os.environ['CVSROOT'] else: cvsroot = '' cvsroot = self.cvsCmdPrompt(cvsroot, cvsDir, help=_('Change the CVSROOT if necessary:')) dlg = wx.TextEntryDialog(self.list, _('Enter cvs password for %s') % cvsroot, 'CVS login', '', style=wx.OK | wx.CANCEL | wx.CENTRE | wx.TE_PASSWORD) try: if dlg.ShowModal() == wx.ID_OK: password = scrm.scramble(dlg.GetValue()) else: return finally: dlg.Destroy() passfile, passwds = self.readCVSPass() passln = cvsroot + ' ' + password + '\n' if passln not in passwds: passfile.write(passln) passfile.close()