[Zope3-dev] Path used in test.py for Zope 3 and individual packages.
Hi, I was experimenting with creating some eggs [1] . When I tried to run tests of zope.configuration (Individual package) I got some test failures, this is due to a path problem: Failure in test checkDuplicate (zope.configuration.config.ConfigurationContext) Failed doctest test for zope.configuration.config.ConfigurationContext.checkDuplicate File src/zope/configuration/config.py, line 256, in checkDuplicate -- File src/zope/configuration/config.py, line 278, in zope.configuration.config.ConfigurationContext.checkDuplicate Failed example: try: c.checkDuplicate(d + os.path.normpath('/bar.zcml')) except ConfigurationError, e: str(e).endswith(bar.zcml' included more than once) Expected: True Got nothing Failure in test path (zope.configuration.config.ConfigurationContext) Failed doctest test for zope.configuration.config.ConfigurationContext.path File src/zope/configuration/config.py, line 212, in path -- File src/zope/configuration/config.py, line 227, in zope.configuration.config.ConfigurationContext.path Failed example: c.path(y/z) == d + os.path.normpath(/y/z) Expected: 1 Got: False -- File src/zope/configuration/config.py, line 229, in zope.configuration.config.ConfigurationContext.path Failed example: c.path(y/./z) == d + os.path.normpath(/y/z) Expected: 1 Got: False -- File src/zope/configuration/config.py, line 231, in zope.configuration.config.ConfigurationContext.path Failed example: c.path(y/../z) == d + os.path.normpath(/z) Expected: 1 Got: False In test.py of Zope3 we insert abosolute path at the beginning of path. But for individual packages we use relative path. Here is relevant code from test.py of Zope 3: here = os.path.abspath(os.path.dirname(sys.argv[0])) src = os.path.join(here, 'src') sys.path.insert(0, src) And from test.py of an individual package: src = os.path.join(os.path.split(sys.argv[0])[0], 'src') sys.path.insert(0, src) So, can I change the all the invidual pacakge's test.py to insert absolute path? or only the test.py file of zope.configuration (test.py is not yet added) Regards, Baiju M [1] ftp://ftp.berlios.de/pub/zissue/z3/ ___ Zope3-dev mailing list Zope3-dev@zope.org Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com
[Zope3-dev] Re: Path used in test.py for Zope 3 and individual packages.
On 10/21/06, Baiju M [EMAIL PROTECTED] wrote: [1] ftp://ftp.berlios.de/pub/zissue/z3/ Sorry, this is a temporary location, will be removed soon. Regards, Baiju M ___ Zope3-dev mailing list Zope3-dev@zope.org Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com
[Zope3-dev] Zope Configuration Processing and Side Effects
At: http://dev.zope.org/Zope3/ZopeConfigurationProcessingAndSideEffects I've written an informational proposal stating the goal for eliminating side effects, other than import, during the first phase of configuration processing and generally minimizing first phase processing. This will lead toward refactoring most existing configuration directives. I don't expect this to be controversial, but comments are welcome. Jim -- Jim Fulton mailto:[EMAIL PROTECTED]Python Powered! CTO (540) 361-1714 http://www.python.org Zope Corporationhttp://www.zope.com http://www.zope.org ___ Zope3-dev mailing list Zope3-dev@zope.org Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com
Re: [Zope3-dev] Zope Configuration Processing and Side Effects
On 10/21/06, Jim Fulton [EMAIL PROTECTED] wrote: At: http://dev.zope.org/Zope3/ZopeConfigurationProcessingAndSideEffects I have added this page to new wiki: http://zope3.zwiki.org/ZopeConfigurationProcessingAndSideEffects Also updated the index, http://zope3.zwiki.org/Zope3Proposals Let's use new wiki now onwards. Sooner or later this will be wiki.zope.org We have to make current wiki read only very soon. Faassen, it is difficult to manually synchronise two wikis, so please announce the new wiki, so that other developers can add new content there. Regards, Baiju M ___ Zope3-dev mailing list Zope3-dev@zope.org Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com
[Zope3-dev] IFolder and IAdding
There's a really useful method add in IAdding. As the novice zope3 developer I am I would like that method in IFolder (as well). Is there a good reason why IFolder or IWriteContainer doesn't have an add method? It's possible to add content to an IFolder through the IWriteContainer API, but I'd rather use an add method that chooses an appropriate ID for the object. IAdding has some methods that seem to be about menus. Is this because IAdding should be used together with browser:addMenuItem that also does some menu stuff? Is IAdding only supposed to be used when dealing with /@@+/somevieworfactory? I'd like to add stuff to the folder without using @@+ in the url. I want to use a formlib add form and I have a view called addEvent: browser:page for=zope.app.folder.interfaces.IFolder name=addEvent class=.eventforms.EventAddForm permission=zope.ManageContent / Submitting the form fails though. formlib (AddFormBase) assumes that the context/folder provides IAdding and has an add method. So I can't use for=IFolder. And I can only use IAdding when having /@@+/ in the url. I guess I can make an adapter from IFolder to IAdding, but then I have to implement those menu methods that neither me or the folder care about. So what's the deal with IFolder and IAdding? Why doesn't IFolder have an add method? When should IAdding be used? Can formlib only be used with folders that are adapted to IAdding? Why does IAdding contain menu stuff? How do I use formlib without @@+? Tim ___ Zope3-dev mailing list Zope3-dev@zope.org Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com
Re: [Zope3-dev] IFolder and IAdding
I want to use a formlib add form and I have a view called addEvent: browser:page for=zope.app.folder.interfaces.IFolder name=addEvent class=.eventforms.EventAddForm permission=zope.ManageContent / I changed the class argument to be a new class called AddEvent: from zope.app.container.browser.adding import Adding class EventAddForm(AddForm): ... class AddEvent: def __init(self, context, request): self.context = context self.request = request def __call__(self): adding = Adding(self.context, self.request) return EventAddForm(adding, self.request)() This actually worked, but I don't think I'm very fond of the solution. I still have all those questions I had in the previous mail :) Tim ___ Zope3-dev mailing list Zope3-dev@zope.org Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com
[Zope3-dev] formlib configuration
What is the recommended way to redirect to some page after a formlib form is submitted or cancelled? Is it perhaps to override the action method? I don't find any directives for formlib. Are there any? I think redirection is a common task and to me it would make sense to have configuration directives for that. formlib:addform for=zope.app.folder.interfaces.IFolder name=addEvent schema=mypackage.interfaces.IEvent class=mypackage.browser.forms.EventAddForm action_success=/index.html action_cancel=/index.html / Something like this perhaps? If class is missing a form is created automatically without any code. There should probably be a factory there as well then. If the form is submitted and correctly validated, the user will be redirected to /index.html. Is this stupid or is it just that noone else stepped up and developped it yet? Are people using something else other than formlib? By looking at svn.zope.org I see it's a year since someone commited something. Is it really that bug free? :) Tim ___ Zope3-dev mailing list Zope3-dev@zope.org Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com
[Zope3-dev] Hashing issues
GreetingsI hash some objects and it works fine when I set and get them. However, when I move the Data.fs to a different server on a separate machine running exactly the same code, the hashes don't match.Here's the code: (I tried the paste bin, but it was done at the moment)class JournalContainer(btree.BTreeContainer): Container of Journals implements(interfaces.IJournalContainer ) def __init__(self): super(JournalContainer, self).__init__() self._index = persistent.dict.PersistentDict() def add(self, journal, person, section): chooser = INameChooser(self) name = chooser.chooseName('',journal) self[name] = journal personHash = hash(IKeyReference(person, None)) sectionHash = hash(IKeyReference(section, None)) self._index[(personHash, sectionHash)] = journal def getJournal(self, person, section): import pdb;pdb.set_trace() personHash = hash(IKeyReference(person, None)) sectionHash = hash(IKeyReference(section, None)) return self._index.get((personHash, sectionHash), None) def remove(self, person, section): del self[self.getJournal(person, section).__name__] personHash = hash(IKeyReference(person, None)) sectionHash = hash(IKeyReference(section, None)) del self._index[(personHash, sectionHash)]What are we doing wrong/What is causing the problem? How should we go about fixing this.Thank you very much.-Eldar Omuraliev ___ Zope3-dev mailing list Zope3-dev@zope.org Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com
Re: [Zope3-dev] Hashing issues
Could you check whether one server is 32-bit, the other 64-bit? (And Python being compiled in 32-bit on one machine and 64-bit the other.) I had some trouble with the hash function in this setup lately. Christian Eldar Omuraliev wrote: Greetings I hash some objects and it works fine when I set and get them. However, when I move the Data.fs to a different server on a separate machine running exactly the same code, the hashes don't match. Here's the code: (I tried the paste bin, but it was done at the moment) class JournalContainer(btree.BTreeContainer): Container of Journals implements(interfaces.IJournalContainer) def __init__(self): super(JournalContainer, self).__init__() self._index = persistent.dict.PersistentDict() def add(self, journal, person, section): chooser = INameChooser(self) name = chooser.chooseName('',journal) self[name] = journal personHash = hash(IKeyReference(person, None)) sectionHash = hash(IKeyReference(section, None)) self._index[(personHash, sectionHash)] = journal def getJournal(self, person, section): import pdb;pdb.set_trace() personHash = hash(IKeyReference(person, None)) sectionHash = hash(IKeyReference(section, None)) return self._index.get((personHash, sectionHash), None) def remove(self, person, section): del self[self.getJournal(person, section).__name__] personHash = hash(IKeyReference(person, None)) sectionHash = hash(IKeyReference(section, None)) del self._index[(personHash, sectionHash)] What are we doing wrong/What is causing the problem? How should we go about fixing this. Thank you very much. -Eldar Omuraliev ___ Zope3-dev mailing list Zope3-dev@zope.org Unsub: http://mail.zope.org/mailman/options/zope3-dev/ct%40gocept.com -- gocept gmbh co. kg - forsterstraße 29 - 06112 halle/saale - germany www.gocept.com - [EMAIL PROTECTED] - phone +49 345 122 9889 7 - fax +49 345 122 9889 1 - zope and plone consulting and development signature.asc Description: OpenPGP digital signature ___ Zope3-dev mailing list Zope3-dev@zope.org Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com
[Zope3-dev] Re: Zope Configuration Processing and Side Effects
Baiju M wrote: I have added this page to new wiki: http://zope3.zwiki.org/ZopeConfigurationProcessingAndSideEffects Also updated the index, http://zope3.zwiki.org/Zope3Proposals Thank you, Baiju. Let's use new wiki now onwards. Sooner or later this will be wiki.zope.org We have to make current wiki read only very soon. How do you feel about this folks ? I'd like to make the old zope 3 wiki read-only and activate the subscriptions on the new one. A small but good step forward from the present situation of two identical writable wikis. ___ Zope3-dev mailing list Zope3-dev@zope.org Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com
Re: [Zope3-dev] Re: Zope Configuration Processing and Side Effects
Simon Michael wrote: Baiju M wrote: Let's use new wiki now onwards. Sooner or later this will be wiki.zope.org We have to make current wiki read only very soon. How do you feel about this folks ? I'd like to make the old zope 3 wiki read-only and activate the subscriptions on the new one. +1 -- Benji York Senior Software Engineer Zope Corporation ___ Zope3-dev mailing list Zope3-dev@zope.org Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com
Re: [Zope3-dev] zope.i18n dependency in zope.configuration
On 10/21/06, Baiju M [EMAIL PROTECTED] wrote: I was looking at zope.configuration source, zope.i18n is given as a dependency in DEPENDENCIES.cfg, but it is not imported anywhere in that package. So, can I remove 'zope.i18n' line from DEPENDENCIES.cfg file? It looks like zope.i18n can go, but the simpler zope.i18nmessageid needs to be added (done on the trunk). Maintenance branches should be checked for similar updates. Thanks! -Fred -- Fred L. Drake, Jr.fdrake at gmail.com Every sin is the result of a collaboration. --Lucius Annaeus Seneca ___ Zope3-dev mailing list Zope3-dev@zope.org Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com
Re: [Zope3-dev] Re: Zope Configuration Processing and Side Effects
On 10/21/06, Simon Michael [EMAIL PROTECTED] wrote: How do you feel about this folks ? I'd like to make the old zope 3 wiki read-only and activate the subscriptions on the new one. A small but good step forward from the present situation of two identical writable wikis. The new wiki is much nicer to work with; thanks, Simon! -Fred -- Fred L. Drake, Jr.fdrake at gmail.com Every sin is the result of a collaboration. --Lucius Annaeus Seneca ___ Zope3-dev mailing list Zope3-dev@zope.org Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com
Re: [Zope3-dev] Zope Configuration Processing and Side Effects
On 10/21/06, Jim Fulton [EMAIL PROTECTED] wrote: At: http://dev.zope.org/Zope3/ZopeConfigurationProcessingAndSideEffects I've written an informational proposal 'IsInformational' is a new wiki badge? I have added this to: http://zope3.zwiki.org/IsInformational under http://zope3.zwiki.org/WikiBadge Regards, Baiju M ___ Zope3-dev mailing list Zope3-dev@zope.org Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com
Re: [Zope3-dev] zope.i18n dependency in zope.configuration
On 10/22/06, Fred Drake [EMAIL PROTECTED] wrote: On 10/21/06, Baiju M [EMAIL PROTECTED] wrote: I was looking at zope.configuration source, zope.i18n is given as a dependency in DEPENDENCIES.cfg, but it is not imported anywhere in that package. So, can I remove 'zope.i18n' line from DEPENDENCIES.cfg file? It looks like zope.i18n can go, but the simpler zope.i18nmessageid needs to be added (done on the trunk). Maintenance branches should be checked for similar updates. So any module imported should be added as a dependency. Then, what about modules imported in test files (*.txt or test*.py files) ? Regards, Baiju M ___ Zope3-dev mailing list Zope3-dev@zope.org Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com