[Zope-dev] ZMailIn patch (index 'date' as DateTime object)

2001-11-09 Thread Jean Jordaan

Hi Andy  all

There I was, trying to select last week's mail messages from
the ZMailInCatalog, when I realized that the 'date' index was
a simple string. 

Here's a patch, adding a property 'datetime', which can be 
used as an index of type DateTime. 

Anything I'm missing here? In particular, I'm not sure I
understand what 'sortableDate' is meant for. It's a string 
like this::

  str('%04d%02d%02d%02d%02d%02d' % (dateTuple[0],dateTuple[1],
  dateTuple[2],dateTuple[3],dateTuple[4],dateTuple[5]))

But it's still a string, and can't be used in comparisons 
with DateTimes. Why not just use 'datetime', also sortable?

Regards,
Jean Jordaan

[jean@blommie ZMailIn]$ diff -u ./ZMailMessage.py ./ZMailMessage_hacked.py 
--- ./ZMailMessage.py  Tue Mar  6 12:33:03 2001
+++ ./ZMailMessage_hacked.pyFri Nov  9 11:42:32 2001
@@ -61,6 +61,9 @@
 self.subject = subject
 self.date = date
 self.sortableDate = self._convertToSortableDate(date)
+# njj: index the date as a date.
+import DateTime
+self.datetime = DateTime.DateTime(date) 
 self.to = to
 self.sender = sender
 self.replyto = replyto


___
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] unrestrictedTraverse unable to access the root object

2001-11-09 Thread Johan Carlsson [Torped]

Hi all,
The collector seems to still be offline?

I just realized that the unrestrictedTraverse returns self
for the empty-string url: ''
I did expect it to return the root object because the empty-string
is equal to the path tuple ('',).

Is there any reason for the current behaviour?
Does anybody know any bad things that might happen if I
change this behaviour?

Best Regards,
Johan Carlsson


___
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] ZMailIn patch (index 'date' as DateTime object)

2001-11-09 Thread Jean Jordaan

Hi Steve

 Jean Jordaan wrote:
 
  But it's still a string, and can't be used in comparisons 
  with DateTimes. Why not just use 'datetime', also sortable?
 
 DateTime objects are huge.

Hmm, OK, I'll keep that in mind .. For sorting my mails, though, I'll
stick with the DateTimes. 

It would be cool if ZMailIn was more flexible as to which catalog it
uses and what properties are indexed, without requiring one to hack the
source .. I'll see if I can think of a way to make it so. 

Thanks for the answer,
Jean

___
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] Zope and python namespaces

2001-11-09 Thread Roch'e Compaan

I wrote an external method that uses Graphite, Sping and PIL to
generate charts, but I ran into some namespace problems.  Execution
of the external method fails because there is a clash in the namespace
between PIL and Zope.  PIL has a module ImageFile and Zope does as
well.  Even if I insert PIL's path explicitly as the first entry in
the path, Zope's ImageFile is still being used.

How can I resolve this and what is the best strategy to avoid namespace
problems here?

Roché


___
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] Transaction environment in threaded zope-product

2001-11-09 Thread Christian Theune

Hi.

I have a zope product, that uses threads, to control programs
running outside zope and doing some async stuff.

What I found is, that i can't do changes from the self-started
thread (ChrisW: that's the problem... ;) ).

But how do I get into a transaction do be able to change things on
persistent objects?

get_transaction().begin() doesn't work, and I don't find any
documentation to get started from ...

plz help me

Christian

-- 
Christian Theune - [EMAIL PROTECTED]
gocept gmbh  co.kg - schalaunische strasse 6 - 06366 koethen/anhalt
tel.+49 3496 3099112 - fax.+49 3496 3099118 mob. - 0178 48 33 981

reduce(lambda x,y:x+y,[chr(ord(x)^42) for x in 'zS^BED\nX_FOY\x0b'])

___
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] Transaction environment in threaded zope-product

2001-11-09 Thread Chris Withers

Christian Theune wrote:
 
 I have a zope product, that uses threads, to control programs
 running outside zope and doing some async stuff.

You do realise that's pointing a loaded gun at your own head?

 get_transaction().begin() doesn't work, and I don't find any
 documentation to get started from ...

Maybe you're looking for get_transaction().commit()?

But, to be able to see the results in another thread, that thread would probabyl
need to do get_transaction().begin().

Just so you're aware, I think you're wandering through a minefield with this
one...

Chris

___
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] Debugging help wanted for really weird ZClass problem

2001-11-09 Thread Matt Behrens

Got the traceback again today.  Here it is:

Traceback (innermost last):
   File /export/home/b14741/Zope_Dev/lib/python/ZPublisher/Publish.py, 
line 223, in publish_module
   File /export/home/b14741/Zope_Dev/lib/python/ZPublisher/Publish.py, 
line 187, in publish
   File /export/home/b14741/Zope_Dev/lib/python/Zope/__init__.py, line 
226, in zpublisher_exception_hook
 (Object: DevRequest_factory)
   File /export/home/b14741/Zope_Dev/lib/python/ZPublisher/Publish.py, 
line 171, in publish
   File /export/home/b14741/Zope_Dev/lib/python/ZPublisher/mapply.py, 
line 160, in mapply
 (Object: DevRequest_add)
   File /export/home/b14741/Zope_Dev/lib/python/ZPublisher/Publish.py, 
line 112, in call_object
 (Object: DevRequest_add)
   File /export/home/b14741/Zope_Dev/lib/python/OFS/DTMLMethod.py, line 
195, in __call__
 (Object: DevRequest_add)
   File 
/export/home/b14741/Zope_Dev/lib/python/DocumentTemplate/DT_String.py, 
line 546, in __call__
 (Object: DevRequest_add)
   File 
/export/home/b14741/Zope_Dev/lib/python/DocumentTemplate/DT_With.py, 
line 133, in render
 (Object: DevRequest.createInObjectManager(REQUEST['id'], REQUEST))
   File 
/export/home/b14741/Zope_Dev/lib/python/DocumentTemplate/DT_Util.py, 
line 231, in eval
 (Object: DevRequest.createInObjectManager(REQUEST['id'], REQUEST))
 (Info: REQUEST)
   File string, line 2, in f
 (Object: guarded_getitem)
NameError: global name 'DevRequest' is not defined

In this case, DevRequest is my ZClass.

 DevRequest_addForm

dtml-var manage_page_header
dtml-var expr=manage_form_title(this(), _, form_title='Add Development 
Request')

form action=DevRequest_add method=post
  table
   trth align=leftId/thtdinput name=id size=35/td/tr
   trth align=leftTitle/thtdinput name=title 
size=35/td/tr
   trth align=leftText/thtdtextarea name=text cols=35 
rows=6/textarea/td/tr
   trtd/tdtdinput type=submit value= Add /td/tr
  /table
  input name=date type=hidden value=dtml-ZopeTime;
/form

dtml-var manage_page_footer

 DevRequest_add

dtml-with DevRequest.createInObjectManager(REQUEST['id'], REQUEST)
  dtml-call propertysheets.metadata.manage_editProperties(REQUEST)
/dtml-with

dtml-if DestinationURL
  dtml-call RESPONSE.redirect(DestinationURL+'/manage_workspace')
dtml-else
  dtml-call RESPONSE.redirect(URL2+'/manage_workspace')
/dtml-if



I have a complete backup of my Zope install now that has the 
nonfunctional ZClass.  Can anyone help, suggest some steps to take, etc.?

-- 
Matt Behrens [EMAIL PROTECTED]
System Analyst, Baker Furniture


___
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] pdf - Files not viewable

2001-11-09 Thread Tim McLaughlin

This used to work, and I'm vexed as to why it doesn't now.  When PDFs
are uploaded as file objects and then viewed, on IE 5.0+ with Acrobat
Reader, they appear as blank when Acrobat Reader pops up to read them. 
I get no errors on the stupid log, and generally haven't any idea what
the deal is since this used to work.  Did something change in 2.4 that
could have caused File objects to function badly?

Thanks,
Tim
-- 
Tim McLaughlin
iterationZERO - www.iterationzero.com
703.481.2233

___
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] Transaction environment in threaded zope-product

2001-11-09 Thread Dieter Maurer

Christian Theune writes:
  I have a zope product, that uses threads, to control programs
  running outside zope and doing some async stuff.
  
  What I found is, that i can't do changes from the self-started
  thread (ChrisW: that's the problem... ;) ).
  
  But how do I get into a transaction do be able to change things on
  persistent objects?
You need a ZODB connection in order to be able to change objects
in the ZODB.

You get one (in your new thread!) by 

from Zope import app

root= app() # the ZODB root object but without 'RequestContainer'

You can now build a new REQUEST object and use BaseRequest.traverse
to reach the object you want (identified by an URL).

Before you change anything, you need to begin a transaction
and finally either commit or abort it.


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] Zope and python namespaces

2001-11-09 Thread Dieter Maurer

Roch'e Compaan writes:
  I wrote an external method that uses Graphite, Sping and PIL to
  generate charts, but I ran into some namespace problems.  Execution
  of the external method fails because there is a clash in the namespace
  between PIL and Zope.  PIL has a module ImageFile and Zope does as
  well.  Even  if I insert PIL's path explicitly as the first entry in
  the path, Zope's ImageFile is still being used.
  
  How can I resolve this and what is the best strategy to avoid namespace
  problems here?
Use Pythons package feature, i.e. use

import PIL

PIL.ImageFile


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] Catalog Problem

2001-11-09 Thread Chris Withers

Try re-indexing all your catalogued content...

Chris

Eric Brun wrote:
 
 I update my Zope 2.3.x to 2.4.2
 and I have some probleme with my ZCatalog
 
 here the traceback :
 
 --
 2001-11-09T18:00:34 ERROR(200) UnKeywordIndex Attempt to unindex nonexistent
 document id -254566349
 Traceback (most recent call last):
   File /data/Zope/lib/python/Products/PTKBase/PortalContent.py, line 523,
 in index_object
 self.getPortal().getCatalog().catalog_object(self, urllib.unquote('/' +
 PortalContent.absolute_url(self,1)))
   File /data/Zope/lib/python/Products/ZCatalog/ZCatalog.py, line 554, in
 catalog_object
 self._catalog.catalogObject(obj, uid, None,idxs)
   File /data/Zope/lib/python/Products/ZCatalog/Catalog.py, line 439, in
 catalogObject
 blah = x.index_object(index, object, threshold)
   File /data/Zope/lib/python/Products/PluginIndexes/PathIndex/PathIndex.py,
 line 189, in index_object
 self.insertEntry( comps[i],documentId,i)
   File /data/Zope/lib/python/Products/PluginIndexes/PathIndex/PathIndex.py,
 line 164, in insertEntry
 self._index[comp][level].insert(id)
   File /data/Zope/lib/python/ZODB/Connection.py, line 535, in setstate
 raise ConflictError(`oid`, `object.__class__`)
 ConflictError: ('\\x00\\x00\\x00\\x00\\x00\\x100\\x9f', 'extension class
 BTrees.IIBTree.IISet at 40246630')
 
 Somebody understand this traceback ?
 
 What's happen ? and How can I correct it ?
 
 Thanks
 
 --
 Eric Brun
 Mission TIC
 Savoie Technolac
 France
 E-mail : [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 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 )