On Sun, 2004-11-07 at 20:00 +0100, Enrique ArizÃÂn wrote: > def respond(self, trans): > # checkings and more checkings. > ... > # resultMapping "interprets" the results. For > example, a client sends > # formIdx=3242 from an HTML ddbb view form. > resultMapping maps 'formIdx' to 'formFK_client_idx', > # 'formFK_document_idx', ... deppending on the > context. > contextInPlace = > self.session().value('ContextStack').pop() > resultMapping = > contextInPlace['resultMapping'] > for oldFieldName in resultMapping:
> self._fields[resultMapping[oldFieldName]]=self._fields.pop(oldFieldName) > trans.application().forward(trans, > contextInPlace['ServletAwareOfResult'] + > self._request.extraURLPath() ) > The idea is that visual code generation is not aware > of the context and meanings of the generated forms, > and just when the client user fills and send a valid > value it is translated in something meaningfull. > My doubt come next. To map field names I'm accessing > the "private" member _fields and so my code depends on > HTTPRequest implementation that can't be considered > good practice. Â Is there any other way to do in an > standard or correct way ? You are correct in that you'd be depending on the HTTPRequest implementation. If you want to avoid this, why not write your mapping like so: req = self.request() for oldFieldName in resultMapping: val = req.field(oldFieldName) req.delField(oldFieldName) req.setField(resultMapping[oldFieldName], val) > If the answer is NO, who I am to email to convince > for the inclussion of an HTTPRequest method like: > def mapFieldNames(self, dicFieldNamesMapping) You'd need to enter a bug on webware's sourceforge project page, and attach a patch. However, my gut feeling is that a "mapFieldNames" method is too specialized and doesn't really belong in Webware. Nor is it necessary, since it can be written using the existing public API as I have shown. peace, Jason ------------------------------------------------------- This SF.Net email is sponsored by: Sybase ASE Linux Express Edition - download now for FREE LinuxWorld Reader's Choice Award Winner for best database on Linux. http://ads.osdn.com/?ad_idU88&alloc_id065&op=click _______________________________________________ Webware-discuss mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/webware-discuss