Mercurial > hg > MPIWGWeb
comparison MPIWGStaff.py @ 188:16d55695f1c8
fix updating staff entries through "Update personal homepages". (creating new entries doesn't work)
author | casties |
---|---|
date | Fri, 14 Jun 2013 17:36:09 +0200 |
parents | 71c2d76f09b5 |
children | cc5198541af8 |
comparison
equal
deleted
inserted
replaced
187:71c2d76f09b5 | 188:16d55695f1c8 |
---|---|
18 import email | 18 import email |
19 import re | 19 import re |
20 | 20 |
21 from Products.ZDBInterface.ZDBInterfaceFolder import ZDBInterfaceFolder | 21 from Products.ZDBInterface.ZDBInterfaceFolder import ZDBInterfaceFolder |
22 | 22 |
23 from SrvTxtUtils import getInt, unicodify, utf8ify | 23 from SrvTxtUtils import getInt, unicodify, utf8ify, sqlName |
24 import MPIWGHelper | 24 import MPIWGHelper |
25 | 25 |
26 # | 26 # |
27 # compatibility | 27 # compatibility |
28 # TODO: should be removed when done | 28 # TODO: should be removed when done |
585 | 585 |
586 | 586 |
587 #REQUEST.response.redirect(self.REQUEST['HTTP_REFERER']) | 587 #REQUEST.response.redirect(self.REQUEST['HTTP_REFERER']) |
588 | 588 |
589 | 589 |
590 def changeData(self,changeSet): | 590 security.declareProtected('View management screens','changeData') |
591 def changeData(self, changeSet): | |
591 """changes the data in the database, changeset expects field --> value.""" | 592 """changes the data in the database, changeset expects field --> value.""" |
593 fields = [] | |
594 values = [] | |
592 for field in changeSet.keys(): | 595 for field in changeSet.keys(): |
593 if hasattr(self.content, field): | 596 if hasattr(self.content, field): |
594 logging.debug("Changing: %s"%field) | 597 logging.debug("Changing: %s"%field) |
595 results = self.folder.executeZSQL("update personal_www set "+field+" = %s where key = %s", [changeSet.get(field),self.getKey().encode('utf-8')]); | 598 fields.append('"'+sqlName(field)+'" = %s') |
596 logging.debug(results) | 599 values.append(changeSet.get(field)) |
597 | 600 |
601 if len(fields) == 0: | |
602 return | |
603 | |
604 query = "update personal_www set " + ', '.join(fields) + " where key = %s" | |
605 values.append(self.getKey().encode('utf-8')) | |
606 results = self.folder.executeZSQL(query, values) | |
607 logging.debug(results) | |
608 | |
598 self.refresh_content() | 609 self.refresh_content() |
599 | 610 |
600 | 611 |
601 security.declareProtected('View management screens','changeAdditionalData') | 612 security.declareProtected('View management screens','changeAdditionalData') |
602 def changeAdditionalData(self,data): | 613 def changeAdditionalData(self,data): |