Re: [Zope-dev] ThreadSafeCounter 0.0.1 released
[Erik Enge] | What happens if you run this with ZEO? Will the file be kept «in | sync» with all ZEO Clients? Good point. I don't think so. It could be that it is kept in sync with one Zope instance "being responsible" and the others calling it via XML-RPC. Cheers, Morten ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
[Zope-dev] Introducing ZopePrints.
Hola! Some of us over at ZopeZen.org (URL:http://www.zopezen.org) have been discussing the fenomena that is called ZopePrints. I'll give a brief explanation, and would appretiate feedback as to whether this a good idea or not. A ZopePrint is a document, or maybe a set of documents, which describes a part of, or the complete development process for a Zope application. This could include the whole process from when the customers tell you they want to do project X with you, till you actually finish it and it's up and running in the customers offices. Some points may be: * Problem definition * Problem analysis * Project management (Resource allocation) * Design phase * Zope design * Test phase (Have a looksy at URL:http://www.zopezen.org/SDot/981475769/index_html to check out all the suggestions, and my initial post.) The rationale behind this is that the community at large would benefit from this by having _real_life_ case studies so when their time has come to implement an application in Zope, they don't fall into the same traps and pitfalls we did. Instead of benchmarks, the Zope community would use implementation documents to decide whether Zope is up for the job or not, that's what really helps. I'm quite sure that it will also work as a tool for finding gaps and holes in either Zope or its tools and Products. We would like to start a project going in the Fishbowl which aims at creating the right tools to document a project as described above. Feel free to make suggestions! ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] ThreadSafeCounter 0.0.1 released
Morten W. Petersen wrote: [Erik Enge] | What happens if you run this with ZEO? Will the file be kept in | sync with all ZEO Clients? Good point. I don't think so. It could be that it is kept in sync with one Zope instance "being responsible" and the others calling it via XML-RPC. I'd thought the original point of ThreadSafeCounter was to provide a simple sequential unique values generator, without causing writes to the Data.fs. You could look at using a MountableStorage that doesn't support undo to get a similar benefit. This would also work with ZEO. Take a look in the Core Session Tracking product to see how it is done there. Also, you may find Shane Hathaway's ExternalMount product useful. -- Steve Alexander Software Engineer Cat-Box limited http://www.cat-box.net ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Python Based DataSkins and Propertysheets
Johan Carlsson wrote: Hi, I am trying to figure out ZPatterns and because I rather work with Python Products when with Zclasses I am trying to convert the EmployZ product to Python. So far I got half the way there, the Rack recognizes the DataSkin And on newItem in the Specialist it a new slot gets created and I can see them and their ID. Now the problem is creating a Propertysheet in the DataSkin that gets stored in the Rack. The attributes of a Persistent DataSkin will get stored in the Rack without too much extra work. class EmployX( DataSkin, #VirtualSheets, ): You need to derive EmployX from DataSkin and some Zope persistent class such as SimpleItem. Otherwise, it won't be persistent. -- Steve Alexander Software Engineer Cat-Box limited http://www.cat-box.net ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Python Based DataSkins and Propertysheets
Johan Carlsson wrote: Hi, I am trying to figure out ZPatterns and because I rather work with Python Products when with Zclasses I am trying to convert the EmployZ product to Python. So far I got half the way there, the Rack recognizes the DataSkin And on newItem in the Specialist it a new slot gets created and I can see them and their ID. Now the problem is creating a Propertysheet in the DataSkin that gets stored in the Rack. The attributes of a Persistent DataSkin will get stored in the Rack without too much extra work. class EmployX( DataSkin, #VirtualSheets, ): You need to derive EmployX from DataSkin and some Zope persistent class such as SimpleItem. Otherwise, it won't be persistent. Accualy I dont have to do that. Have a look at Itamar Shtull-Traurings and Heiko Stoermers FlatDatabase: def manage_change(self, REQUEST, RESPONSE): """ Change properties """ for prop in self.database_properties.propertyMap(): name=prop['id'] if REQUEST.has_key(name): if 'w' in prop.get('mode', 'wd'): value=REQUEST.get(name) setattr(self, name, value) RESPONSE.redirect(REQUEST.URL1) But as I noticed the "properties" was saved as attributes not as properties in a propertysheet. That's another way of doing it. It is a bit less transparent. I find it more straightforward to make my classes SimpleItems and PropertyManagers, as it means I can just call manage_changeProperties() without writing extra methods. I can live with that, but I still would like to know if and how to use propertysheets provided by a DataManager inside a Pyhton DataSkin? There are two kinds of PropertySheet in Zope: DAV propertysheets Propertysheets that go with ZClasses There are also Properties for objects that are PropertyManagers, such as DTML Documents. There is an important difference in how these different types of properties work: DAV Propertysheets are independent Persistent objects Propertysheets that go with ZClasses and also PropertyManager propertysheets are stored as attributes in the objects they belong to. Therefore, in ZPatterns, you use AttributeProviders to do stuff with PropertyManager properties and ZClass-style propertysheets. You use SheetProviders to do stuff with DAV Propertysheets. If you're using ZClass-style propertysheets, you need to use DataSkin Attribute Propertysheets, rather than the default Common Instance Propertysheets. In your case, I suggest making your class Persistent, and using PropertyManager properties. The reason to use ZClass-style propertysheets is if you want to easily partition your properties into sets of properties with different permissions. -- Steve Alexander Software Engineer Cat-Box limited http://www.cat-box.net ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] ThreadSafeCounter 0.0.1 released
On Mon, Feb 12, 2001 at 01:31:04AM +0100, Morten W. Petersen wrote: As I've understood it, two threads serving requests have a copy each of the database, and only when changes are committed are they reflected in the database. Therefore, two requests created at the same time could get an identical copy and therefore and identical value. The ZODB will invalidate and force a retry on one of the connections. Chris's code is threadsafe and will result in unique, sequential values. See the ZODB UML documentation for details: http://www.zope.org/Documentation/Developer/Models/ZODB/ -- Martijn Pieters | Software Engineer mailto:[EMAIL PROTECTED] | Digital Creations http://www.digicool.com/ | Creators of Zope http://www.zope.org/ - ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
[Zope-dev] InterbaseStorage, Win32 anyone?
Hi all, I'm trying to get InterbaseStorage working on Win32. I've got all the requisite parts and they all seem to be working OK (well, kinterbasdb and mxDateTime do) outside Zope in plain Python. When I try and import _kinterbasdb.dll, from within Zope I'm getting an error message: Unable to initialize mxDateTime Traceback (innermost last): File "D:\Zope230b2\z2.py", line 565, in ? exec "import "+MODULE in {} File "string", line 1, in ? File "D:\Zope230b2\lib\python\Zope\__init__.py", line 113, in ? m=imp.load_module('Zope.custom_zodb', m[0], m[1], m[2]) File "D:\Zope230b2\custom_zodb.py", line 1, in ? from Products.InterbaseStorage.InterbaseStorage import InterbaseStorage File "D:\Zope230b2\lib\python\Products\InterbaseStorage\InterbaseStorage.py", line 94, in ? import kinterbasdb File "D:\Python\Lib\kinterbasdb.py", line 4, in ? import _kinterbasdb AttributeError: mxDateTimeAPI Obviously (to me), since Zope has it's own DateTime module, kinterbasdb is looking there for something and not finding what it expects. I've tried monkeying with the Python path to resolve it, but even when it's searching in the right place I'm still getting the error, so I'm at a loss. Has anyone else tried this, and did you get any joy? Is anyone else using mxDateTime (I think it's a pre-requisite of mxODBC)? I've seen one other post about the exact same problem, but with no resolution. Anyone got any ideas? Phil [EMAIL PROTECTED] ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] ThreadSafeCounter 0.0.1 released
[Wolfgang Strobl] | Doesn't even install on Windows, because it imports and uses fcntl. | | From the fcntl docs: "Availability: Unix". Well, the download page says "Platform: Generic UNIX-like", doesn't it? -Morten ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Python Based DataSkins and Propertysheets
Steve Alexander wrote: Johan Carlsson wrote: You need to derive EmployX from DataSkin and some Zope persistent class such as SimpleItem. Otherwise, it won't be persistent. Accualy I dont have to do that. Looking more closely at DataSkins.py, I see that class DataSkin derives from Persistent. So, I was wrong -- please ignore what I said about needing to derive from Persistent :-) -- Steve Alexander Software Engineer Cat-Box limited http://www.cat-box.net ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Python Based DataSkins and Propertysheets
But as I noticed the "properties" was saved as attributes not as properties in a propertysheet. That's another way of doing it. It is a bit less transparent. I find it more straightforward to make my classes SimpleItems and PropertyManagers, as it means I can just call manage_changeProperties() without writing extra methods. Ah, I see. But why do I need SimpleItems, isn't PropertyManagers sufficient? There are two kinds of PropertySheet in Zope: DAV propertysheets Propertysheets that go with ZClasses There are also Properties for objects that are PropertyManagers, such as DTML Documents. There is an important difference in how these different types of properties work: DAV Propertysheets are independent Persistent objects Propertysheets that go with ZClasses and also PropertyManager propertysheets are stored as attributes in the objects they belong to. Therefore, in ZPatterns, you use AttributeProviders to do stuff with PropertyManager properties and ZClass-style propertysheets. You use SheetProviders to do stuff with DAV Propertysheets. If you're using ZClass-style propertysheets, you need to use DataSkin Attribute Propertysheets, rather than the default Common Instance Propertysheets. In your case, I suggest making your class Persistent, and using PropertyManager properties. But making it presistent doesn't that lock the objects to be stored in the ZODB? I may want to change storage to SQL later. The reason to use ZClass-style propertysheets is if you want to easily partition your properties into sets of properties with different permissions. Still confused but on a higher level ;-) Johan ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Python Based DataSkins and Propertysheets
You need to derive EmployX from DataSkin and some Zope persistent class such as SimpleItem. Otherwise, it won't be persistent. Accualy I dont have to do that. Looking more closely at DataSkins.py, I see that class DataSkin derives from Persistent. So, I was wrong -- please ignore what I said about needing to derive from Persistent :-) Whoooha! I added PropertyManager to EmployX and it saves properties? Is this correct? - The objects are stored presistently in the Racks storage (BTree). - The attributes (and the propertysheet which is a attribute) are managed by the "PersistentAttributes" attribute provider. (Can I verify this by some kind of inspection?) - If I would create Attribute Providers (with SkinScripts) they could redirect the storage to what ever storage i like. Hm, I realize that I'm still very confused and the only way out of that is "doing stuff" and see what happens. Johanc PS. I uploaded the latest version of EmployX if anybody want to have a look. Its working now and should do basicly the same thing EmployZ does (except minor cahnges). http://www.zope.org/Members/johanc/EmployX ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Python Based DataSkins and Propertysheets
Johan Carlsson wrote: Ah, I see. But why do I need SimpleItems, isn't PropertyManagers sufficient? It makes your class play nicely with Zope. So, it can work with DAV, be copied and pasted, properly work with traversal, work with ZDOM, be Owned, support undo, work with Acquisition, and manage roles. Take a look at the source to lib/python/OFS/SimpleItem.py You can omit some of this if you know for sure in advance that you will be using instances of your class only with Specialists in Racks. However, ZPatterns is set up so you can use the same DataSkin class with instances stored in a Rack or stored as normal Persistent objects in the ZODB. In your case, I suggest making your class Persistent, and using PropertyManager properties. But making it presistent doesn't that lock the objects to be stored in the ZODB? I may want to change storage to SQL later. No it doesn't tie the object to the ZODB if you're using a Specialist. That's the magic of ZPatterns. -- Steve Alexander Software Engineer Cat-Box limited http://www.cat-box.net ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Python Based DataSkins and Propertysheets
Johan Carlsson wrote: Whoooha! I added PropertyManager to EmployX and it saves properties? Is that a question? I'm not sure I can answer that. Is this correct? - The objects are stored presistently in the Racks storage (BTree). With the way a rack is set up by default, yes. You just say in the Rack what class it should store. - The attributes (and the propertysheet which is a attribute) The properties in a propertysheet are stored as attributes. The propertysheet is a view on an instance's data. are managed by the "PersistentAttributes" attribute provider. The PersistentInternalAttributeProvider stores the attributes of an instance in a dict in the Rack. I had a conversation with Phillip Eby on this list a couple of months ago about exactly how PersistentInternalAttributeProviders and PersistentExternalAttributeProviders work. You should be able to find the messages in the list archives. (Can I verify this by some kind of inspection?) You can look through the ZODB from a python interactive prompt, and look inside a Rack's BTree to see how things are laid out. I think there are some HOT TO documents on looking in the ZODB from the python interactive prompt. - If I would create Attribute Providers (with SkinScripts) they could redirect the storage to what ever storage i like. Yes. You may want to set the Rack up differently, that is, so it doesn't store Dataskins persistently, but accesses them based on an id. Look at a Rack's tabs. Hm, I realize that I'm still very confused and the only way out of that is "doing stuff" and see what happens. I guess so :-) There's also reading the source code... which may or may not help clarify things. -- Steve Alexander Software Engineer Cat-Box limited http://www.cat-box.net ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
RE: [Zope-dev] Persistence ( was Thread Safe Counting )
Jon Franz [EMAIL PROTECTED] wrote Ah! this makes more sense, the idea of persistent properties even fits with this idea, though a true write-in-place property might be even better for some applications ;) Two things: * Don't count on storing the hit counter as a separate, "persistence aware" object (i.e., with its own pickle jar) to avoid bloating your Data.fs. Hit counters are by definition high volume, and the space overhead for managing undoable persistence is higher than you might think. * Write-in-place will never be supported by packable/undoable storages (logically impossible); some "packless" storages are already in play (maybe even near release), so the semantics you want may be (soon) readily available by mounting a separate storage. Tres. -- === Tres Seaver[EMAIL PROTECTED] Digital Creations "Zope Dealers" http://www.zope.org ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Introducing ZopePrints.
[Tres Seaver] | Please see: | | http://dev.zope.org/Projects/PTK | | for our work-in-progress. Hey, looks like what I'm after. I can see that it's a work in progress, so if you need any help, give me a shout. It didn't say too much about the project itself, do you have any such information on a page somewhere? Timescales? Goals? ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
[Zope-dev] http headers
Anyone know how I can log or view the http headers that Zope sends when it responds to a http request? Tim McLaughlin ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
RE: [Zope-dev] Greedy except clauses
-Original Message- From: Jeremy Hylton [mailto:[EMAIL PROTECTED]] Sent: Saturday, February 10, 2001 1:49 AM To: Chris Withers Cc: Anthony Baxter; Chris McDonough; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [Zope-dev] Greedy except clauses "CW" == Chris Withers [EMAIL PROTECTED] writes: I am probably a bit idiosyncratic, but I prefer to avoid bare excepts at all costs. I often use "except Exception:", otherwise I add a CW Will that catch string exceptions? eg: raise 'Something bad CW happened' No. CW If not, then it's not much use in Zope, which is unfortunately CW riddled with String exceptions :-S That might be something worth fixing, too. :-) Jeremy I agree. I think this would be a good project for new zope developers to get into the zope code. Would we need an ZopeException class hierarchy? Anthony: can your script be modified to print out the raise statements too wink? Tom Jenkins |xmlIts devIS - Development InfoStructure |all you 703.525.6485 [EMAIL PROTECTED] |need it http://www.devis.com |to be/xml ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] ThreadSafeCounter 0.0.1 released
On Mon, Feb 12, 2001 at 02:27:24PM +, Toby Dickenson wrote: On Mon, 12 Feb 2001 10:27:02 +0100, Martijn Pieters [EMAIL PROTECTED] wrote: The ZODB will invalidate and force a retry on one of the connections. Chris's code is threadsafe and will result in unique, sequential values. ** Unless a transaction gets retried for some other reason, when it will appear to skip a value. To one thread, yes. But not to the whole application. -- Martijn Pieters | Software Engineer mailto:[EMAIL PROTECTED] | Digital Creations http://www.digicool.com/ | Creators of Zope http://www.zope.org/ - ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
RE: [Zope-dev] Greedy except clauses
"TJ" == Tom Jenkins [EMAIL PROTECTED] writes: TJ I agree. I think this would be a good project for new zope TJ developers to get into the zope code. Would we need an TJ ZopeException class hierarchy? IME, it's been a good idea to have a root exception class per subsystem, which all inherit from a single system-wide root, which itself inherits from Exception. That was the motivation for Python's standard exception heirarchy. Greedy excepts have their uses, but IMHO they are limited to `infrastructure wrappers' only. E.g. a CGI wrapper might catch all exceptions so they don't percolate up to the web server, or a command line reader would catch them all so they don't exit the read loop. -Barry ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
[Zope-dev] zpopyda problems with typecasting
Timestamp columns do not seem to be converted to DateTime objects in Zope when used with 2.2.4 and PoPy 1.4.1 and ZPoPyDA 1.0.1. It returns a string object which will not convert to a DateTime without some help. The string returned is this '2001-01-24 21:52:19-05' which does not convert because of the -05 zone at the end. Also note, numerics do not seem to be converted to floats either (they are returned as strings but _.float() successfully). Am I just missing something? Tim ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
[Zope-dev] DateTime Patch
I have concluded that DateTime has bugs in its isCurrent* methods. Basically isCurrentMinute, isCurrentHour, isCurrentDay and isCurrentMonth all would return true at inappropriate times. For instance, isCurrentDay will currently return true if the day number of the date is equal to the current day number regardless of current month or year. The others behave in a similar manner. Attached is a patch for DateTime.py that fixes the above. I am also submitting it to the collector. Enjoy. -- | Casey Duncan | Kaivo, Inc. | [EMAIL PROTECTED] `-- *** DateTime.py.old Mon Feb 12 08:40:23 2001 --- DateTime.py Mon Feb 12 09:40:22 2001 *** *** 1153,1180 that falls within the current month, in the context of this object\'s timezone representation""" t=time() ! return safegmtime(t+_tzoffset(self._tz, t))[1]==self._month def isCurrentDay(self): """Return true if this object represents a date/time that falls within the current day, in the context of this object\'s timezone representation""" t=time() ! return safegmtime(t+_tzoffset(self._tz, t))[2]==self._day def isCurrentHour(self): """Return true if this object represents a date/time that falls within the current hour, in the context of this object\'s timezone representation""" t=time() ! return safegmtime(t+_tzoffset(self._tz, t))[3]==self._hour def isCurrentMinute(self): """Return true if this object represents a date/time that falls within the current minute, in the context of this object\'s timezone representation""" t=time() ! return safegmtime(t+_tzoffset(self._tz, t))[4]==self._minute def earliestTime(self): """Return a new DateTime object that represents the earliest --- 1153,1186 that falls within the current month, in the context of this object\'s timezone representation""" t=time() ! gmt=safegmtime(t+_tzoffset(self._tz, t)) ! return gmt[0]==self._year and gmt[1]==self._month def isCurrentDay(self): """Return true if this object represents a date/time that falls within the current day, in the context of this object\'s timezone representation""" t=time() ! gmt=safegmtime(t+_tzoffset(self._tz, t)) ! return gmt[0]==self._year and gmt[1]==self._month and gmt[2]==self._day ! def isCurrentHour(self): """Return true if this object represents a date/time that falls within the current hour, in the context of this object\'s timezone representation""" t=time() ! gmt=safegmtime(t+_tzoffset(self._tz, t)) ! return gmt[0]==self._year and gmt[1]==self._month and gmt[2]==self._day and gmt[3]==self._hour def isCurrentMinute(self): """Return true if this object represents a date/time that falls within the current minute, in the context of this object\'s timezone representation""" t=time() ! gmt=safegmtime(t+_tzoffset(self._tz, t)) ! return gmt[0]==self._year and gmt[1]==self._month and gmt[2]==self._day and gmt[3]==self._hour and gmt[4]==self._minute ! def earliestTime(self): """Return a new DateTime object that represents the earliest
Re: [Zope-dev] Programmatic way to get the Zope Version
Steve Alexander wrote: Chris Withers wrote: Hi, I was if do something like: if zope_version = 2.3: # balh else: # blah Where do I get the zope_version bti and what format will it be in? You can get it as version_txt from Control_Panel. For example, from DTML: dtml-with Control_Panel dtml-var version_txt /dtml-with However, this won't do you much good, as when you have a version of Zope from CVS, it gets called "(unreleased version)". The way some Products detect the version is to try to import a module that only exists in one version of Zope, or try to look up an attribute that is only in one version of Zope, and then catch the Exception. Ideally, this will be the attribute or module that has changed that made you want to detect the version in the first place. Make your choices based on whether there is an Exception or not. -- Steve Alexander Software Engineer Cat-Box limited http://www.cat-box.net dtml-var SERVER_SOFTWARE should do it. It is an attribute of REQUEST. I'm not sure what this looks like on CVS versions though. -- | Casey Duncan | Kaivo, Inc. | [EMAIL PROTECTED] `-- ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
[Zope-dev] EmployX 0.0.2
I've put up the latest version of my DataSkin as Python Laboration Product I have done 2/3 of my goal, that is to have Plugin/DataSkins. (the next 4/3 will probably be to let a SQL-server take care of the attributes.) If anybody would have a peek it's at: http://www.zope.org/Members/johanc/ZPatterns/EmployX/EmployX-0.0.2.tgz/view Many thanks to Steve. Johan torped johan carlsson birkagatan 9 113 36 stockholm [EMAIL PROTECTED] www.torped.se voice +46-(0)-8-32 31 23 mobil +46-(0)-70-558 25 24 workshop vstmannagatan 67 ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] manage_ methods
Chris Withers writes: Is it true that you have to have the Manager role to use any methods that start with manage_? No. "manage_" methods are mapped to permissions (as are any other methods). You can decide which roles have which permissions. If you like, you can 'Anonymous' (or any other role) grant any permission. Dieter ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] http headers
Another you might consider (though Shane's is great, but required Tkinter, which not everybody (me!) has really easy accesss to... ) is the more browser based, but less flexible: http://www.cyberclip.com/webdebug/ -steve "SA" == Steve Alexander [EMAIL PROTECTED] writes: SA Tim McLaughlin wrote: Anyone know how I can log or view the http headers that Zope sends when it responds to a http request? SA Take a look at tcpwatch: SA http://www.zope.org/Members/hathawsh/tcpwatch SA -- Steve Alexander Software Engineer Cat-Box limited SA http://www.cat-box.net SA ___ Zope-Dev SA maillist - [EMAIL PROTECTED] SA http://lists.zope.org/mailman/listinfo/zope-dev ** No cross SA posts or HTML encoding! ** (Related lists - SA http://lists.zope.org/mailman/listinfo/zope-announce SA http://lists.zope.org/mailman/listinfo/zope ) ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
[Zope-dev] Updates! Refresh, BTreeFolder, and ZDebug products
Gang, BTreeFolder, now at version 0.2, has been updated for Zope 2.3.0, including the managment interface and the fix for a clipboard bug. Come'n get it! http://www.zope.org/Members/hathawsh/BTreeFolder If no one reports any problems, I think we can consider this version "stable" and re-label it version 1.0. ZDebug, now at version 0.2, has also been updated for Zope 2.3.0. It now displays the REQUEST when available. It includes a tweak for LoginManager. Please note that, for security reasons, you *must not* use older versions of ZDebug with Zope 2.3.0 and above. http://www.zope.org/Members/hathawsh/ZDebug But here's the biggest news: the Refresh product, which makes life just a little bit easier for filesystem product developers, now has an auto-refresh feature and the ability to set up dependent products. This means changes to your Python modules are instantly recognized by Zope and development is almost as nice as working with ZClasses. http://www.zope.org/Members/hathawsh/Refresh Note that all of these products now use a slightly different packaging convention. The paths do not include "lib/python/Products". This new convention fits the needs of INSTANCE_HOME users. (see http://www.zope.org/Members/4am/instancehome ) Shane ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] ThreadSafeCounter 0.0.1 released
[Morten W. Petersen] | There's a new product available, which enables unique ids in a given context, | take a look at url:http://www.zope.org/Members/morphex/ThreadSafeCounter. On every view - a call to index_html() - it prints '{}' to stdout. Bug? ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] ThreadSafeCounter 0.0.1 released
[Erik Enge] | On every view - a call to index_html() - it prints '{}' to stdout. Bug? Forget it. My fault. *shame, shame* ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Updates! Refresh, BTreeFolder, and ZDebug products
[Shane Hathaway] | If no one reports any problems No problems so far :). Tried them with Zope 2.2.1. | But here's the biggest news: the Refresh product Excellent! When will this be included in standard Zope distributions? ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
[Zope-dev] ThreadSafeCounter
So the only difference between this and FSCounter is that you implemented the locking I didn't. To cut a long story short the reason i didnt implement locking was Python on Windows doesnt have fnctl (http://velocity.activestate.com/docs/ActivePython/lib/module-fcntl.html), Perl does though If anyone knows of a module to lock and unlock cross platform I would appreciate it. Zope by the way locks in /lib/python/ZODB/lock_file.py, but there is no unlock. Maybe if we added an unlock in here this would provide a global lock and unlock function. I released FSPoll recently and was going to combine the two into one FSCountThing with FSPoll and FSCounter subclassing of it, so maybe we could co-operate on ThreadSafeCounter and FSCounter? Cheers. -- Andy McKay. ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
[Zope-dev] Windows registry?
Anyone tried or got a script to create / delete the windows registry settings for running a zope server as a service. It would make my life a lot easier... If no-one has I could recreate them from observation. Cheers. -- Andy McKay. ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
[Zope-dev] ProxyPass and SiteAccess getting REMOTE_ADDR
Last week I was setting up an Apache VirtualHost to point to a Zope object tree using the ProxyPass directive and SiteAccess to get all the urls right (great stuff!). However, I noticed that the REMOTE_ADDR was always set to the proxy host. This makes sense because Zope just gets the host/port from the socket connection. But I needed the real remote_addr for logging and user admin. Adding 'Header's wouldn't pass the info to Zope. The Zope mail archives mentioned the problem a couple of times without a configuration fix. A simple fix to the proxy module (in proxy_http.c) will create a new header called 'Original-Addr' to contain the client's ip address. Here is a context diff against Apache 1.3.14 that should work even in the new 2.0 servers: *** *** 397,402 --- 397,404 ap_bvputs(f, reqhdrs[i].key, ": ", reqhdrs[i].val, CRLF, NULL); } + ap_bvputs(f, "Original-Addr: ", r-connection-remote_ip, CRLF, NULL); + ap_bputs(CRLF, f); /* send the request data, if any. */ When the request was proxied, the Zope REQUEST will now have a key 'HTTP_ORIGINAL_ADDR' containing the client address. This key is also now a good indication that the http request went to the VirtualHost address. I then made a small change to SiteRoot.py to turn off the url mapping if HTTP_ORIGINAL_ADDR is present. This is a context diff against the SiteRoot.py file shipped with Zope 2.3.0: *** *** 108,113 --- 108,116 if '_SUPPRESS_SITEROOT' in _swallow(request): request.setVirtualRoot(request.steps) return + # only run if passed through ProxyPass + t = request.environ.get('HTTP_ORIGINAL_ADDR',None) + if t == None : return srd = [None, None] for i in (0, 1): srp = ('SiteRootBASE', 'SiteRootPATH')[i] These two patches have worked well and solved several problems. I hope others will find them useful. --Bill Noon Northeast Regional Climate Center Cornell University ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
[Zope-dev] Re: ThreadSafeCounter
[Andy McKay] | I released FSPoll recently and was going to combine the two into one | FSCountThing with FSPoll and FSCounter subclassing of it, so maybe we could | co-operate on ThreadSafeCounter and FSCounter? The ideal solution would be to use an object that lives in the ZODB, I wonder if there is a way to keep the 'object history' empty? That is, keeping the counter 'packed' while retaining 'object history' information on all other objects. In any case, I think it's possible to implement a file-locking module, that locks the file using a .lock extension (writing the pid of the locking process to that file) or something like that.. Which should work on Linux and Windows (and most other OS') Should I toss up a Wiki? Cheers, Morten ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] ThreadSafeCounter 0.0.1 released
[Erik Enge] | Forget it. My fault. *shame, shame* *chuckle* :-) -Morten ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Windows registry?
If I recall correctly, there is a tool for doing this call srvany, part of the resource kit. Mine installed as a service on w2k by default... Chris. On Mon, 12 Feb 2001, Andy McKay wrote: Anyone tried or got a script to create / delete the windows registry settings for running a zope server as a service. It would make my life a lot easier... If no-one has I could recreate them from observation. Cheers. -- Andy McKay. ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope ) -- chris maresca internet systems architect -- www.chrismaresca.com "linux, only up 41 days, because a new electrical circuit was added..." ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )