Mods Attached Re: [Zope] Making ZClasses Inherit Subobjects from
Bases
Ross Patterson
rossp@ppc.ucsc.edu
Fri, 8 Feb 2002 17:02:28 -0800 (PST)
This is a MIME-formatted message. If you see this text it means that your
E-mail software does not support MIME-formatted messages.
--=_ppc-20722-1013216549-0001-2
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Well, I ended up fixing the problem in my product, then I decided I
wanted a way to do the same thing through the ZClass Subobjects
management tab. So I made some changes to ZClasses/ObjectManager.py
and ZClasses/dtml/subobjects.dtml and viola! It works beautifully.
Now my question is this, should I submit these as patches at all? If
so, having never done so before, how do I go about it? Following is
the original message, and attached are the modified files.
---original message---
If I create a ZClass, ZC1, that subclasses ZClasses: ObjectManager and
then create another, ZC2, that subclasses ZC1. As long as I don't
save changes in the subobjects tab of ZC2, it will inherit the
subobjects settings from ZC1. But as soon as I do save any changes,
there is then no way to unset the subobjects and return it to the
inherited subobjects.
I think the way to do this would be to write a python method of my
python base ZClass that calls the delClassAttr method from
ZClasses.ZClass. But I can't seem to get this to work. Below are my
python files:
{snip}
-----------------------------------------------------------------
| Ross Patterson rossp@cats.ucsc.edu |
| Programmer/Analyst (831)459-2792 |
| Physical Planning & Construction Fax:(831)423-7436 |
| UC Santa Cruz http:www2.ucsc.edu/ppc |
-----------------------------------------------------------------
--=_ppc-20722-1013216549-0001-2
Content-Type: text/plain; charset=us-ascii; name="ObjectManager.py"
Content-Transfer-Encoding: base64
Content-ID: <Pine.LNX.4.40.0202081702210.17020@ppc.ucsc.edu>
Content-Description: ZClasses.ObjectManager
Content-Disposition: attachment; filename="ObjectManager.py"
IyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMj
IyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjDQojDQojIENvcHly
aWdodCAoYykgMjAwMSBab3BlIENvcnBvcmF0aW9uIGFuZCBDb250cmlidXRv
cnMuIEFsbCBSaWdodHM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F9t
ZXRhX3R5cGVzDQoNCmNsYXNzIFpPYmplY3RNYW5hZ2VyOg0KICAgICIiIk1p
eC1pbiBmb3IgT2JqZWN0IE1hbmFnZW1lbnQNCiAgICAiIiINCg0KICAgIF96
Y2xhc3NfPU9iamVjdE1hbmFnZXINCg0KICAgIHByb3BlcnR5c2hlZXRzPVpP
YmplY3RNYW5hZ2VyUHJvcGVydHlTaGVldHMoKQ0KDQogICAgbWFuYWdlX29w
dGlvbnM9KA0KICAgICAgICB7J2xhYmVsJzogJ1N1Ym9iamVjdHMnLCAnYWN0
aW9uJyA6J3Byb3BlcnR5c2hlZXRzL3N1Ym9iamVjdHMvbWFuYWdlJ30sDQog
ICAgICAgICkNCg==
--=_ppc-20722-1013216549-0001-2
Content-Type: text/plain; charset=us-ascii; name="subobjects.dtml"
Content-Transfer-Encoding: base64
Content-ID: <Pine.LNX.4.40.0202081702211.17020@ppc.ucsc.edu>
Content-Description: subobjects.dtml
Content-Disposition: attachment; filename="subobjects.dtml"
PGR0bWwtdmFyIG1hbmFnZV9wYWdlX2hlYWRlcj4NCjxkdG1sLXdpdGggIl8o
bWFuYWdlbWVudF92aWV3PSdTdWJvYmplY3RzJykiPg0KPGR0bWwtdmFyIG1h
bmFnZV90YWJzPg0KPC9kdG1sLXdpdGg+DQoNCjxmb3JtIGFjdGlvbj0ibWFu
YWdlX2VkaXQiIG1ldGhvZD0icG9zdCI+DQo8dGFibGUgY2VsbHNwYWNpbmc9
IjAiIGNlbGxwYWRkaW5nPSIyIiBib3JkZXI9IjAiPg0KICA8dHI+DQogICAg
PHRkIGFsaWduPSJsZWZ0IiB2YWxpZ249InRvcCI+DQogICAgPGRpdiBjbGFz
cz0iZm9ybS1sYWJlbCI+DQogICAgDQogICAgPC9kaXY+DQogICAgPC90ZD4N
CiAgICA8dGQgYWxpZ249ImxlZnQiIHZhbGlnbj0idG9wIj4NCiAgICA8aW5w
dXQgdHlwZT0idGV4dCIgbmFtZT0iaWQiIHNpemU9IjQwIiA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GVjdGVkIj5zZWxlY3RlZDwvZHRtbC1pZj4NCiAgICAgICAgICA+
PGR0bWwtdmFyIG5hbWU+PC9vcHRpb24+DQogICAgICAgPC9kdG1sLWluPg0K
ICAgICAgPC9kdG1sLXdpdGg+DQogICAgPC9zZWxlY3Q+DQogICAgPC9kaXY+
DQogIDwvdGQ+DQo8L3RyPg0KPHRyPjx0ZCBjb2xzcGFuPTI+DQogIDxkaXYg
Y2xhc3M9ImZvcm0tbGFiZWwiPg0KICBPYmplY3RzIHNob3VsZCBhcHBlYXIg
aW4gZm9sZGVyIGxpc3RzPw0KICAgIDxpbnB1dCB0eXBlPWNoZWNrYm94IG5h
bWU9aXNGb2xkZXJpc2ggdmFsdWU9IlkiDQogICAgICA8ZHRtbC1pZiBpc0Zv
bGRlcmlzaD5DSEVDS0VEPC9kdG1sLWlmPg0KICAgID4NCiAgPC9kaXY+DQog
IDwvdGQ+DQo8L3RyPg0KPHRyPg0KICA8dGQgYWxpZ249ImxlZnQiIHZhbGln
bj0idG9wIiBjb2xzcGFuPSIyIj4NCiAgPGRpdiBjbGFzcz0iZm9ybS1lbGVt
ZW50Ij4NCiAgPGlucHV0IGNsYXNzPSJmb3JtLWVsZW1lbnQiIHR5cGU9InN1
Ym1pdCIgbmFtZT0ic3VibWl0IiANCiAgIHZhbHVlPSJTYXZlIENoYW5nZXMi
IC8+DQogIDwvZGl2Pg0KICA8L3RkPg0KPC90cj4NCjwvdGFibGU+DQo8L2Zv
cm0+DQoNCjxkdG1sLXZhciBtYW5hZ2VfcGFnZV9mb290ZXI+DQoNCg==
--=_ppc-20722-1013216549-0001-2
Content-Type: text/plain; charset=us-ascii; name="ObjectManager.py.diff"
Content-Transfer-Encoding: base64
Content-ID: <Pine.LNX.4.40.0202081702212.17020@ppc.ucsc.edu>
Content-Description: diff ObjectManager.py ObjectManager.py.bak > ObjectManager.py.diff
Content-Disposition: attachment; filename="ObjectManager.py.diff"
MjgsMzFjMjgNCjwgCWlmIHNlbGYuaW5oZ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pbHRlcigNCj4gICAgICAgICAgICAg
bGFtYmRhIGQsIG09bWV0YV90eXBlczogZFsnbmFtZSddIGluIG0sDQo+ICAg
ICAgICAgICAgIHNlbGYucG9zc2libGVfbWV0YV90eXBlcygpDQo+ICAgICAg
ICAgICAgICkpDQo1Miw1OWQ0NA0KPCANCjwgICAgIGRlZiBpbmhlcml0U3Vi
b2JqZWN0cyhzZWxmKToNCjwgCXRyeToNCjwgCSAgICBzZWxmLmdldENsYXNz
QXR0cignbWV0YV90eXBlcycpDQo8IAlleGNlcHQgS2V5RXJyb3I6DQo8IAkg
ICAgcmV0dXJuIG5vdCAwDQo8IAllbHNlOg0KPCAJICAgIHJldHVybiBub3Qg
MQ0K
--=_ppc-20722-1013216549-0001-2
Content-Type: text/plain; charset=us-ascii; name="subobjects.dtml.diff"
Content-Transfer-Encoding: base64
Content-ID: <Pine.LNX.4.40.0202081702213.17020@ppc.ucsc.edu>
Content-Description: diff subobjects.dtml subobjects.dtml.bak > subobjects.dtml.diff
Content-Disposition: attachment; filename="subobjects.dtml.diff"
MjAsMjhkMTkNCjwgPHRyPjx0ZCBjb2xzcGFuPTI+DQo8ICAgPGRpdiBjbGFz
cz0iZm9ybS1sYWJlbCI+DQo8ICAgICA8aW5wdXQgdHlwZT1yYWRpbyBuYW1l
PWluaGVyaXQgdmFsdWU9IlkiDQo8IAk8ZHRtbC1pZiBpbmhlcml0U3Vib2Jq
ZWN0cz5DSEVDS0VEPC9kdG1sLWlmPg0KPCAgICAgPg0KPCAgICAgSW5oZXJp
dCBzdWJvYmplY3RzIGZyb20gYmFzZXMNCjwgICA8L2Rpdj4NCjwgICA8L3Rk
Pg0KPCA8L3RyPg0KMzIsMzRkMjINCjwgICAgIDxpbnB1dCB0eXBlPXJhZGlv
IG5hbWU9aW5oZXJpdCB2YWx1ZT0iIg0KPCAJPGR0bWwtdW5sZXNzIGluaGVy
aXRTdWJvYmplY3RzPkNIRUNLRUQ8L2R0bWwtdW5sZXNzPg0KPCAgICAgPg0K
--=_ppc-20722-1013216549-0001-2--