Re: [Zope-dev] updating homebrew extension of structured text tostandard

2002-07-16 Thread Jochen Knuth

Hi,
Jochen Knuth schrieb:
[...]

if i use re.search in the kbeimage_search_replace function, then Zope 
will crash with signal 11. if i use the deprecated regex and gsub, then 
it works.

Does anyone know a reason for this behaviour?


Ciao,
Jochen


 #!/usr/local/bin/python
 import string
 import re

 def punc_func(exclude):
 punc = r''
 for char in string.punctuation:
 if char not in exclude:
 punc = punc + r'\%s' % char
 return punc

 digits  = string.digits
 letters = string.letters
 literal_punc = punc_func(')
 dbl_quoted_punc = punc_func(\)
 strongem_punc = punc_func('*')
 under_punc = punc_func('_')
 phrase_delimiters = r'\s\.\,\?\/\!\\(\)'


not working:

 def kbeimage_search_replace(text):

 expr = re.compile(r'__([%s%s%s\s]+?)__' % (letters, digits, 
strongem_punc)).search
 r=expr(text)
 if r:
 start, end = r.span(1)
 newtext1='bild:img:'
 newtext=text[:start-2]+newtext1+text[start:end]+' '+text[end+2:]
 return kbeimage_search_replace(newtext)
 else:
 return text


working:

  import ts_regex, regex
  from ts_regex import gsub
  ctag_prefix=\([\0- (]\|^\)
  ctag_suffix=\([\0- ,.:;!?)]\|$\)
  ctag_middl2=[%s][%s]\([^\0- %s][^%s]*[^\0- %s]\|[^%s]\)[%s][%s]
 
  def kbeimage_search_replace(text):
  bild = regex.compile(ctag_prefix+(ctag_middl2 % 
((_,)*8))+ctag_suffix)
  s=gsub(bild, '\\1\\2:img:\\2 \\3',text)
  return s



 def updateKBE(self,path):
 pathobj=self.restrictedTraverse(path)
 resultbases=self.ZopeFind(pathobj, obj_metatypes=['IPRO Knowledge 
Base'],search_sub=1)
 resultlist=[]
 for fid,fobj in resultbases:
 results=self.ZopeFind(fobj, obj_metatypes=['IPRO Knowledge Base Entry'])
 for id,obj in results:
 resultlist.append(id)
 issue = obj.Issue
 newissue = kbeimage_search_replace(issue)
 
obj.propertysheets.properties.manage_changeProperties({'Issue':newissue})
 return resultlist
 
 
--
Jochen Knuth  WebMaster http://www.ipro.de
IPRO GmbH Phone ++49-7152-93330
Steinbeisstr. 6   Fax ++49-7152-933340
71229 LeonbergEMail: [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] Zope 2.4.3 patched Python 2.1.3 @ FreeBSD crashing

2002-07-16 Thread Myroslav Opyr

Hi,

In past times I was advised to apply a patch and increase stack size for 
pthreads of FreeBSD. I did and it helped for Zope 2.5.0   CMF 1.2 + 
PageTemplates.  It was moderately stable situation but it appears to 
crash again. For other site (with other Zope version)...

Zope Version(Zope 2.4.3 (source release, python 2.1, linux2), 
python 2.1.3, freebsd4)
Python Version  2.1.3 (#4, May 15 2002, 17:31:48) [GCC 2.95.3 
20010315 (release) [FreeBSD]]
System Platform freebsd4


If portions (PT) of a web-page are rendered everything is ok. Management 
screens either has no problems. But rendering a compound PT-based page 
makes Zope crash with

assertion STACK_LEVEL() = f-f_stacksize failed: file Python/ceval.c, line 695

on console. What is suggested solution? Increase pthreads stacksize? it 
was THREAD_STACK_SIZE=0x2 as advised...

Thanks,

m.
-- 
Myroslav Opyr
zope.net.ua http://zope.net.ua/ œ Ukrainian Zope Hosting
e-mail: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
cell: +380 50.3174578






___
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: Zope 2.4.3 patched Python 2.1.3 @ FreeBSD crashing

2002-07-16 Thread Jens Vagelpohl

this will probably not help with zope 2.4.3 since that has other 
crash-bugs not covered by the python patch. upgrade to 2.4.4 or 2.5.1 
instead.

jens

On Tuesday, July 16, 2002, at 02:11 , Myroslav Opyr wrote:

 Hi,

 In past times I was advised to apply a patch and increase stack size for 
 pthreads of FreeBSD. I did and it helped for Zope 2.5.0   CMF 1.2 + 
 PageTemplates.  It was moderately stable situation but it appears to 
 crash again. For other site (with other Zope version)...

 Zope Version(Zope 2.4.3 (source release, python 2.1, 
 linux2),python 2.1.3, freebsd4)
 Python Version  2.1.3 (#4, May 15 2002, 17:31:48) [GCC 
 2.95.320010315 (release) [FreeBSD]]
 System Platform freebsd4


 If portions (PT) of a web-page are rendered everything is ok. Management 
 screens either has no problems. But rendering a compound PT-based page 
 makes Zope crash with

 assertion STACK_LEVEL() = f-f_stacksize failed: file Python/ceval.c
 , line 695

 on console. What is suggested solution? Increase pthreads stacksize? it 
 was THREAD_STACK_SIZE=0x2 as advised...

 Thanks,

 m.
 -- Myroslav Opyr
 zope.net.ua http://zope.net.ua/ œ Ukrainian Zope Hosting
 e-mail: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
 cell: +380 50.3174578







___
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] Adding Items to Object Manager and Folders

2002-07-16 Thread Ross Boylan

The Zope Developer's Guide and the API docs (Zope 2.5) present
different stories about how to add things to object managers.  I don't
really follow what the API stuff is doing.  This is a request for
clarification. 

Devguide says do
def addFunction(dispatcher, id):
   Create object and add to self
   p = SomeProduct(id)
   dispatcher.Destination()._setObject(id, p)

This makes sense, though, as commented at
http://www.zope.org//Members/michel/Projects/Interfaces/ObjectManager,
it relies on a private, undocumented method.  addFunction is in outer
scope of a module, and is hooked up wtih various calls in ___init__.py.

On the other hand, the ObjectManager API says to do
self.manage_addProduct['OFSP'].manage_addFolder(id, title).

First, what scope should that be done in?  Second, this seems to
create one product (OFSP) and then add a folder to it, so that it
creates two, nested products.

The API for Folder mentions manage_addFolder as a constructor, but
again the scope is unclear to me.  Presumably it needs to know what to
add it to, but that is not passed in.

Finally, the use of id in two places in the first code snippet (one
apparently associated with the container, the other with the object)
seems like an invitation to trouble.  Why is it done that way?

One reason I want to know this is that I'm considering having a
container that would automatically label (or set id) of its contents
(e.g., 'a' is first, 'b' is second).

Thanks for any light you can shed.



___
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] Restricted Compiler issues on FreeBSD? (Core Dumps...waaa!)

2002-07-16 Thread Jeffrey P Shell

For a while now, Tracker has been core dumping on my with Zope 2.5.1 with
both Python 2.1.2 and 2.1.3 on FreeBSD 4.5 (Intel).  The culprit seems to be
expressions that are heavy on parenthesis.  For example, the following
works:

!--#let val=(init or (type == 'simple'
and (_['sequence-key']
   not in ['requester',
   'supporter',
   'priority',
   'stage'])
 )) and _['sequence-item']--


But it core dumps when changed to:

!--#let val=((init or (type == 'simple'
and (_['sequence-key']
   not in ['requester',
   'supporter',
   'priority',
   'stage'])
 )) and _['sequence-item'])--


Don't ask me what this expression does - I just kept whittling at it until
the crashes stopped.  Then I went and found quite a few others.  I made a
lot of fixes by turning complex expressions into many smaller ones inside a
single 'let' tag.

Does anyone know other possible fixes for this issue?  Is there some Python
stack size setting I can set at compile time?  I have some other code that
has not survived the move to Zope 2.5.x/Python 2.1.x/FreeBSD.

FWIW, the Python 2.1.2 used was from the BSD Ports, while the 2.1.3 was
compiled by hand.

-- 
Jeffrey P Shell 
www.cuemedia.com




___
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] Restricted Compiler issues on FreeBSD? (Core Dumps...waaa!)

2002-07-16 Thread Jens Vagelpohl

have you read about the python crash-bug stemming from tiny thread 
stack sizes on freebsd and applied the patch? the mailing list 
archives should tell you what to do.

jens


On Tuesday, July 16, 2002, at 09:43 , Jeffrey P Shell wrote:

 For a while now, Tracker has been core dumping on my with Zope 2.5.1 
 with
 both Python 2.1.2 and 2.1.3 on FreeBSD 4.5 (Intel).  The culprit 
 seems to be
 expressions that are heavy on parenthesis.  For example, the following
 works:

 !--#let val=(init or (type == 'simple'
 and (_['sequence-key']
not in ['requester',
'supporter',
'priority',
'stage'])
  )) and _['sequence-item']--


 But it core dumps when changed to:

 !--#let val=((init or (type == 'simple'
 and (_['sequence-key']
not in ['requester',
'supporter',
'priority',
'stage'])
  )) and _['sequence-item'])--


 Don't ask me what this expression does - I just kept whittling at it 
 until
 the crashes stopped.  Then I went and found quite a few others.  I 
 made a
 lot of fixes by turning complex expressions into many smaller ones 
 inside a
 single 'let' tag.

 Does anyone know other possible fixes for this issue?  Is there some 
 Python
 stack size setting I can set at compile time?  I have some other 
 code that
 has not survived the move to Zope 2.5.x/Python 2.1.x/FreeBSD.

 FWIW, the Python 2.1.2 used was from the BSD Ports, while the 2.1.3 was
 compiled by hand.

 --
 Jeffrey P Shell
 www.cuemedia.com




 ___
 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 )



Re: [Zope-dev] Restricted Compiler issues on FreeBSD? (Core Dumps...waaa!)

2002-07-16 Thread jeffrey


Jens Vagelpohl writes:

 have you read about the python crash-bug stemming from tiny thread 
 stack sizes on freebsd and applied the patch? the mailing list 
 archives should tell you what to do.


Ahh, thanks!  I think I found the right patch and all.  Won't get to find
out if it all works until tomorrow.  (After the keynote of course ;)
Hopefully this nails the issue.  It's been beating me up for a while
now (primarily with older code, strangely enough).

--
JPS


___
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 )