changeset 624:bdebdc59b057

FormSubmit: get rid of has_key()
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Mon, 25 Mar 2013 17:28:25 +0100
parents 5f499a634857
children f4e63b74b969
files data/plugin/action/submitbase.py data/plugin/action/submitcsv.py data/plugin/action/submitemail.py
diffstat 3 files changed, 7 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/data/plugin/action/submitbase.py	Mon Mar 25 17:20:34 2013 +0100
+++ b/data/plugin/action/submitbase.py	Mon Mar 25 17:28:25 2013 +0100
@@ -65,7 +65,7 @@
         self.targetpage = self.pagename
         self.module = self.__module__.split(".").pop()
         
-        if self.request.form.has_key("actions[]"):
+        if "actions[]" in self.request.form:
             self.actions = copy.copy(self.request.form.get("actions[]"))
         else:
             self.actions.append(self.module)
@@ -73,14 +73,14 @@
         self.fields = self._exclude_metadata(self.request.form)
         
         # file upload is present
-        if request.form.has_key("file"):
+        if "file" in request.form:
             self.attachFile = request.form.get("file__filename__")
             self.attachContent = request.form.get("file")[0]
             self.attachLabel = request.form.get("uploadlabel")[0]
             self.attachLabel = self.attachLabel.encode('utf-8')
             
         # page where all submited data will be stored
-        if request.form.has_key("targetpage"):
+        if "targetpage" in request.form:
             targetpage = request.form.get("targetpage")[0]
             page = Page(self.request, targetpage)
             if page.isStandardPage(False):
@@ -104,7 +104,7 @@
             attachUrl = AttachFile.getAttachUrl(self.targetpage, self.attachFile, self.request)
             attachLink = self.request.getQualifiedURL() + attachUrl
             self.fields[self.attachLabel] = attachLink
-        elif self.request.form.has_key("file"):
+        elif "file" in self.request.form:
             self.fields[self.attachLabel] = ""
             
     def validate(self):
@@ -223,7 +223,7 @@
         labels = []
         values = []                    
         
-        if form.has_key('labels'):
+        if 'labels' in form:
             _labels = form.get('labels')[0].split(";")
             for label in _labels:
                 label = label.encode('utf-8')
--- a/data/plugin/action/submitcsv.py	Mon Mar 25 17:20:34 2013 +0100
+++ b/data/plugin/action/submitcsv.py	Mon Mar 25 17:28:25 2013 +0100
@@ -34,7 +34,7 @@
         self.delimiter = ';'
         self.targetFile = ""
         
-        if(request.form.has_key("targetfile")):
+        if "targetfile" in request.form:
             self.targetFile = request.form.get("targetfile")[0]
         else:
             self.targetFile = u"list.csv"
--- a/data/plugin/action/submitemail.py	Mon Mar 25 17:20:34 2013 +0100
+++ b/data/plugin/action/submitemail.py	Mon Mar 25 17:28:25 2013 +0100
@@ -29,7 +29,7 @@
         self.targetemail = ""
         self.subject = "Moinmoin mail"
         
-        if(request.form.has_key("targetemail")):
+        if "targetemail" in request.form:
             self.targetemail = request.form.get("targetemail")[0]
         
     def build_content(self):