changeset 620:d26cf328e8f9

FormCreate: get rid of .has_key, simplify code
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Mon, 25 Mar 2013 16:43:50 +0100
parents d86bd9e634c1
children a8d1eb833705
files data/plugin/macro/FormHeader.py
diffstat 1 files changed, 5 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/data/plugin/macro/FormHeader.py	Mon Mar 25 16:37:11 2013 +0100
+++ b/data/plugin/macro/FormHeader.py	Mon Mar 25 16:43:50 2013 +0100
@@ -20,10 +20,7 @@
         
         self.action = ""
         self.actions = ()
-        self.targetfile = ""
-        self.targetemail = ""
-        self.targetpage = ""
-        
+
         length = len(self._main)
         
         if length > 1:
@@ -31,15 +28,10 @@
             self.actions = self._main
         elif length == 1:
             self.action = self._main[0]
-            
-        if self._attribs.has_key('targetfile'):
-            self.targetfile = self._attribs['targetfile']
-            
-        if self._attribs.has_key('targetemail'):
-            self.targetemail = self._attribs['targetemail']
-            
-        if self._attribs.has_key('targetpage'):
-            self.targetpage = self._attribs['targetpage']
+
+        self.targetfile = self._attribs.get('targetfile', '')
+        self.targetemail = self._attribs.get('targetemail', '')
+        self.targetpage = self._attribs.get('targetpage', '')
         
     def validate(self):
         FormBase.validate(self)