Am 06.12.2010 09:48, schrieb nap: > Where the properties dict are used? In fact thay are used nearly every > where in the part of code that manage creating the objects, link them > and look if they are correct. Then in the runnign part, they are not > very useful anymore (unless in the retention part of course). [...] > Yes, because a lot of properties look the same after all. So this is a big sign that logic should be encapsulated into some Properties classes instead of been spread all over the source. > This change would save a lot of code elsewhere, since many test could > be removed and test could be simplified. E.G. item.Item.pythonize() > could be as short as: > > def pythonize(self): > for name, prop in self.__class__.properties.items(): > try: > old_val = getattr(self, name) > new_val = old_val.pythonize() > #print "Changing", old_val, "to", new_val > setattr(self, name, new_val) > except AttributeError , exp: > #print self.get_name(), ' : ', exp > pass # Will be catched at the is_correct momen > > Not really here, because the old_val is a string here (getattr get the > object property, and Sorry, there is an error in this (untested) lines. It should be
new_val = prop.pythonize(old_val) > If it enhance the readability and is still easy to understand (let say > not so hard), it's ok, like Gerhard I'm ok to get this tool :) I'll put it into trak, together with the converted props from config.py and -- if I find time -- a draft properties module. > But if it's a 2 days job and it's easy to test, 0.4 can wait some few > days. Let look at how it look so. Most time consuming will be to find all places, where the properties dict is used and eliminate it there. But since you know your code better, you should make it within two days :-) -- Schönen Gruß - Regards Hartmut Goebel Dipl.-Informatiker (univ.), CISSP, CSSLP Goebel Consult Spezialist für IT-Sicherheit in komplexen Umgebungen http://www.goebel-consult.de Monatliche Kolumne: http://www.cissp-gefluester.de/ Goebel Consult mit Mitglied bei http://www.7-it.de
smime.p7s
Description: S/MIME Cryptographic Signature
------------------------------------------------------------------------------ What happens now with your Lotus Notes apps - do you make another costly upgrade, or settle for being marooned without product support? Time to move off Lotus Notes and onto the cloud with Force.com, apps are easier to build, use, and manage than apps on traditional platforms. Sign up for the Lotus Notes Migration Kit to learn more. http://p.sf.net/sfu/salesforce-d2d
_______________________________________________ Shinken-devel mailing list Shinken-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/shinken-devel