Re: [Zope] (also) ConflictError from Products.Transience.Transience.Increaser

2010-08-04 Thread Maciej Wisniowski
Chris Withers wrote:
 To my knowledge, the request that throws this isn't touching the session 
 or temp_folder, but I guess something is.

 How can I find out what code is actually touch this and so causing this 
 conflict?
 
This might be something with timeslices and buckets that are core 
concepts in Transience.
Take a look at HowTransienceWorks.stx document or at my old post about 
this issue:
http://www.mail-archive.com/zope-...@zope.org/msg22620.html

AFAIR you don't even have to touch session objects in order to make 
transience machinery work.

You may try to incerase session_resolution_seconds (eg. to 300) at your 
zope.conf to get rid of these conflict errors.

-- 
Maciej Wisniowski
___
Zope maillist  -  Zope@zope.org
https://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] (also) ConflictError from Products.Transience.Transience.Increaser

2010-08-04 Thread Maciej Wisniowski
Chris Withers pisze:
 Maciej Wisniowski wrote:
 You may try to incerase session_resolution_seconds (eg. to 300) at 
 your zope.conf to get rid of these conflict errors.

 Is that a root zope.conf setting or does it live in some special section?

It is a root setting in zope.conf.

Example from my zope conf (written with dash):

session-resolution-seconds 300

-- 
Maciej Wisniowski
___
Zope maillist  -  Zope@zope.org
https://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Zope 2.8.4 - ZEO ClientStorage cache problem

2010-04-07 Thread Maciej Wisniowski
Hi!

I have a problem with my instances of Zope 2.8.4: recently they started 
to run slowly. Restarting doesn't help much.
After observing Zope threads with DeadlockDebugger we found that very 
often threads are stuck while trying to access to ZEO cache file.

We have ZEO server and 2 ZEO clients. Each client has 10 threads. 
Example output from DeadlockDebugger (attached at the end of this 
message) shows that a lot of threads is executing self._lock.release() 
in loadEx function. Attached dump is from ZEO Client instance.
I wonder how it is possible that so much threads in this dump are 
releasing lock in the same time? Shouldn't they stay on acquire?


We did more dumps from DeadlockDebugger. Almost every time dump shows 
that there are some threads that are doing something in loadEx, like:
(...)
File /opt/Zope/2.8.4/lib/python/ZEO/ClientStorage.py, line 755, in loadEx
self._lock.release()
  File /opt/Zope/2.8.4/lib/python/ZEO/cache.py, line 194, in load
return o.data, tid, o.version
  File /opt/Zope/2.8.4/lib/python/ZEO/cache.py, line 1010, in access
return Object.fromFile(self.f, key)

Seems to me that access to ZEO cache is a deadlock there, but I don't 
know why. Why it is so often and so slow(?) that I can see it in 
DeadlockDebugger almost every time? I don't remember seeing loadEx on 
output from DeadlockDebugger before.

I've checked disk I/O and it is ok. Event log shows:

2010-04-07T13:48:03 WARNING ZODB.DB DB.open() has 13 open connections 
with a pool_size of 7

which is our bad, as we have 10 threads and too small pool_size=7, but 
I'm not sure if this matters. I wonder that maybe, under heavy load, 
when sometimes all 10 threads are used, Zope has to continuosly create 
and destroy Connection objects and this causes filling/flushing their 
caches - I have no idea if this works that way?

Any ideas what might be wrong, or what can I check?


Threads traceback dump at 2010-04-07 12:08:06

Thread -179496032 (GET /VirtualHostBase/https/(...)/index_html):
  File /opt/Zope/2.8.4/lib/python/ZServer/PubCore/ZServerPublisher.py, 
line 23, in __init__
response=response)
  File 
/opt/Zope/instancje/xyz_app/Products/ZopeProfiler/MonkeyPatcher.py, 
line 35, in __call__
return self._function(*args,**kw)
  File 
/opt/Zope/instancje/xyz_app/Products/ZopeProfiler/ZopeProfiler.py, 
line 357, in _profilePublishModule
request=request, response=response)
  File /opt/Zope/2.8.4/lib/python/ZPublisher/Publish.py, line 386, in 
publish_module
environ, debug, request, response)
  File /opt/Zope/2.8.4/lib/python/ZPublisher/Publish.py, line 187, in 
publish_module_standard
response = publish(request, module_name, after_list, debug=debug)
  File /opt/Zope/2.8.4/lib/python/ZPublisher/Publish.py, line 113, in 
publish
request, bind=1)
  File /opt/Zope/2.8.4/lib/python/ZPublisher/mapply.py, line 88, in mapply
if debug is not None: return debug(object,args,context)
  File /opt/Zope/2.8.4/lib/python/ZPublisher/Publish.py, line 40, in 
call_object
result=apply(object,args) # Type scr to step into published object.
  File 
/opt/Zope/instancje/xyz_app/Products/App/MainController/MainController.py, 
line 248, in index_html
return context.index_html_( *l, **d )
  File /opt/Zope/2.8.4/lib/python/Shared/DC/Scripts/Bindings.py, line 
311, in __call__
return self._bindAndExec(args, kw, None)
  File /opt/Zope/2.8.4/lib/python/Shared/DC/Scripts/Bindings.py, line 
348, in _bindAndExec
return self._exec(bound_data, args, kw)
  File 
/opt/Zope/2.8.4/lib/python/Products/PythonScripts/PythonScript.py, 
line 323, in _exec
result = f(*args, **kw)
  File Script (Python), line 99, in index_html_
  File /opt/Zope/2.8.4/lib/python/Shared/DC/Scripts/Bindings.py, line 
311, in __call__
return self._bindAndExec(args, kw, None)
  File /opt/Zope/2.8.4/lib/python/Shared/DC/Scripts/Bindings.py, line 
348, in _bindAndExec
return self._exec(bound_data, args, kw)
  File 
/opt/Zope/2.8.4/lib/python/Products/PageTemplates/ZopePageTemplate.py, 
line 256, in _exec
result = self.pt_render(extra_context=bound_names)
  File 
/opt/Zope/2.8.4/lib/python/Products/PageTemplates/PageTemplate.py, 
line 104, in pt_render
tal=not source, strictinsert=0)()
  File /opt/Zope/2.8.4/lib/python/TAL/TALInterpreter.py, line 206, in 
__call__
self.interpret(self.program)
  File /opt/Zope/2.8.4/lib/python/TAL/TALInterpreter.py, line 250, in 
interpret
handlers[opcode](self, args)
  File /opt/Zope/2.8.4/lib/python/TAL/TALInterpreter.py, line 609, in 
do_insertStructure_tal
structure = self.engine.evaluateStructure(expr)
  File /opt/Zope/2.8.4/lib/python/Products/PageTemplates/TALES.py, 
line 221, in evaluate
return expression(self)
  File 
/opt/Zope/2.8.4/lib/python/Products/PageTemplates/ZRPythonExpr.py, 
line 47, in __call__
return eval(code, g, {})
  File Python expression v['bodyDefinition']( 
index_html=v['index_html']), line 1, in expression
  File 

Re: [Zope-DB] use of cx_oracle adapter from within python script ?

2007-11-16 Thread Maciej Wisniowski

banaouas pisze:
 In external method, it's not possible to use the database connexion 
created

 in the zmi.
Why? It is possible. I think if you take a look into zope-db archives 
you'll even find some examples, eg:


http://www.nabble.com/Re:-RE-:-How-lunch-SQL-request-from-python-script---t3039608.html

--
Maciej Wisniowski
___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


Re: [Zope-DB] Automatic capture of user ids for auditing

2007-11-07 Thread Maciej Wisniowski
* The idea of extending the DA pass the current ZOPE user seems 
cleaner.

For me, changing DA seems to add 'audit' fields seems nasty. What if you
will have one specific table that doesn't need audit fields (this may
happen when you're using authentication sources that rely on DB and in 
many other cases).


I think that much cleaner might be to create something like
AuditEnabledZSQLMethods that will render to sql that contains necessary
statements and use it instead of ZSQLMethods when necessary.

Above assumes that you'll create a Zope Product that (possibly) inherits
from ZSQLMethods. You may take a look at CCZSQLMethods as they are
example of extending ZSQLMethods.

--
Maciej Wisniowski
___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


Re: [Zope] Weird hangs on zope/plone.

2007-10-09 Thread Maciej Wisniowski
 I set the number of threads:
 zserver-threads 25
 I set:
 pool-size 27
 on zodb_db main
I think you should rather use ZEO than raise number of threads to such a
big value. Also there are some rules about pool-size. I don't remember
exactly but seems to me that it is too small, but
in general I suppose it has nothing to do with your problem...


Situation you're seeing may appear if there is something that blocks
all your threads, like all threads are waiting for RDBMS response...


 How can i run some kind of debug on zope (debug-mode on dont log
 anything more) to check this next time happen?
Use DeadlockDebugger and if this doesn't help try:
http://www.zopelabs.com/cookbook/1073504990

-- 
Maciej Wisniowski
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Weird hangs on zope/plone.

2007-10-09 Thread Maciej Wisniowski
 When i google it i find a post somewhere saying about increase the
 number of threads and the number of the pool, but nothing about this
 limitation! :(
What kind of limitation? Instead of raising number of threads on one
zope instance you should just use few Zope instances with smaller number
of threads. AFAIK it's more effective.

 I will test DeadlockDebugger, but the main problem is only happen in
 the morning (around 8:00am-10:00am.
So install deadlockdebugger and look at it's output between 8:00-10:00.
It may be safely used on production instances.

Also check if some external resources like LDAP are not restarted/backed
up or sth. like that at this time, or before (eg. there is a backup at
night that causes 'something' wrong for connections from your zope and
your users start working since 8:00 - thats when you see 'hangup').

-- 
Maciej Wisniowski
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] How to upgrade Python in older Zope?

2007-09-11 Thread Maciej Wisniowski
 I desperately need support for large filesystem so the data.fs file can 
 exceed 2 GB.
Have you tried to simply pack ZODB? I'm not sure how it goes in Zope 2.5
but in more recent releases, under Control Panel/Database Management
there is a Pack button. Pack should remove historical entries from ZODB
and make it smaller.

Of course create a backup before ;)

-- 
Maciej Wisniowski
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope-DB] case insensitive ZSQL queries

2007-09-06 Thread Maciej Wisniowski

 thanks -- it now works like a charm
   
AFAIR 'ilike' in postgres doesn't properly support
i18n characters, so be carefull with that.

-- 
Maciej Wisniowski
___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


Re: [Zope] UTF encoding problem w/ ZPT's (No, not the usual :)

2007-08-30 Thread Maciej Wisniowski

 As for subversion, I took great care to make sure everything was utf-8
 on the FS, during development, and I know Subersion uses utf-8
 internally, so I'm not sure what it would change it to.  Once checked
 back out, it still looks like utf-8 ... I'm saying all this based on the
 assumption that the string - unicode difference might come from the
 encoding of the PT itself?
   
Which Zope version do you have and are you sure your
versions are same in both environments?

-- 
Maciej Wisniowski
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Can t start Zope

2007-08-28 Thread Maciej Wisniowski
 try: result = render_blocks(self._v_blocks, md)
 Unauthorized: You are not allowed to access 'admin' in this context
 
 Any ideas?
This is not connected with previous error, but seems that your
Zope worked before (-08-20T15:12:21). If so then what chages
did you do? ;)

As Andreas said previous error is possibly due to
broken installation. Check if you have AccessControl.Role
and if so, then check if your python/site-packages doesn't
contain another one eg. from Zope3.

-- 
Maciej Wisniowski
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope-DB] updating fields in a zsql method programmatically

2007-08-27 Thread Maciej Wisniowski
 changed_field1 = a new computed value
 field1 = changed_field1
 
 #create a new record with form field results for field2  field3, and a
 computed value for field1
 context.insertNew()
Obvious things are sometimes hardest to find ;)

Try:

field1 = changed_field1
context.insertNew(field1=field1)

or even:

context.insertNew(field1='something', field2=other_variable)

It is more clear than getting values from context I think.

-- 
Maciej Wisniowski
___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


Re: [Zope-DB] updating fields in a zsql method programmatically

2007-08-27 Thread Maciej Wisniowski
onsombal napisał(a):
 I tried the techniques you suggested and it results in the same error --
 KeyError: 'form.submitted'
You didn't tell about this kind of error before.
Post a full traceback, please.
I suppose that error is somewhere else...

-- 
Maciej Wisniowski
___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


Re: [Zope-DB] Reference DTML-sqlvar in ZPT?

2007-07-30 Thread Maciej Wisniowski

 I guess my questions are confusing since I am new to Zope. The dtml-sqlvar
 is already defined; the results from the Z SQL Method are already
 presented; I just want to remind the user of what they passed to the Z
 SQL Method.
You can't get sql query parameters from it's results. It's like calling
a function. You pass some parameters to it and get results...

 In other words, I only want to print what they selected from a drop-down
 list and passed to the Z SQL Method. I just want to print an already
 defined variable. The problem is: how to print a dtml-sqlvar in ZPT? I
 tried
I think you're looking at this from the wrong side ;)

When you submit a form that contains your select list, then you have
chosen option at REQUEST object. You may get this with:
context.REQUEST.get('name-of-your-parameter')
and pass it into PageTemplate with results.

For example (may be buggy):

Your form with selection list (PageTemplate):
form action=results.html
select name=my_item
option value=1blablabal1/option
option value=2blablabal2/option
/select
/form


results.html (ScriptPython):
my_item = context.REQUEST.get('my_item')
results = context.mySQL(my_item=my_item)
return context.resultPageTemplate(my_item=my_item, results=results)


resultPageTemplate (PageTemplate):
div tal:define=myitem python: options.get('my_item', 0);
 results python: options.get('results', 0)
You've chosen: span tal:replace=my_item/span

div tal:repeat=item results tal:content=item/name/div
/div

-- 
Maciej Wisniowski
___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


Re: [Zope] Conflict errors

2007-07-27 Thread Maciej Wisniowski
 Could anyone suggest whats happening here that cause this error.
Look at list archives.

You may try to incerase session-resolution-seconds to 300 in your
instances zope.conf and see if there is less of these errors.

BTW. Zope-DB is about Zope and relational databases only.

-- 
Maciej Wisniowski
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope-DB] Re: [Zope] Conflict errors

2007-07-27 Thread Maciej Wisniowski
 Could anyone suggest whats happening here that cause this error.
Look at list archives.

You may try to incerase session-resolution-seconds to 300 in your
instances zope.conf and see if there is less of these errors.

BTW. Zope-DB is about Zope and relational databases only.

-- 
Maciej Wisniowski
___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


Re: [Zope] Extracting all files from Zope DB

2007-07-26 Thread Maciej Wisniowski
 In order to migrate from Zope to ... (I don't know yet), we are trying to 
 extract all the information located inside the Zope database.
What do you mean by information? Code?

 I've found the FTP interface to the Zope database, I can browse inside the 
 subfolder but, I can see any files !? 
 If I post a new file via the web page, a folder is created (I see it via FTP) 
 but the folder is empty ?!
What do you mean by 'post a new file via web page'? What is 'web page'?
Your application? ZMI? (Zope Management Interface)? How do you 'post' a
file?

 Could you please tell me if there is a way to do that ?
 Could you please give me some hints ?
Zope database is object database, what means it stores objects, not
files, so you shouldn't expect files to be there. These are all objects.
Even 'File' is instance of class 'File'.
Some of these objects have methods that allow them to 'answer' to FTP
requests, and you can see them in your FTP client. If some objects are
not 'FTP enabled' you will not be able to use them via FTP.

Take a look at group archives. AFAIR there were similiar questions
some time ago.

-- 
Maciej Wisniowski
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Site Error page

2007-07-22 Thread Maciej Wisniowski
 BlankIs there any way to update the Zope's error page that appears during any 
 Site error with a different content?
 Any help is appreciated in advance.
Change standard_error_message object (located at root folder - visible
via ZMI)

-- 
Maciej Wisniowski
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] UnicodeDecodeError in Zope 2.10.4 (upgrade from 2.8.4)

2007-07-17 Thread Maciej Wisniowski
I've upgraded my installation from Zope2.8.4 to Zope 2.10.4
(by copying data.fs, Products/ etc.). I have publisher encoding
and management_page_charset set to utf-8. Also system
default encoding is utf-8.

Zope 2.10 is said to have better Unicode support with
UnicodeEncodeConflictResolver. It is but unfortunatelly in
some cases this is not enough. Seems that
code that is 'protected' by Resolver is not the only code
that may be affected by non unicode strings.
Simple example is with 'structure' keyword.

eg:
This works (resolver resolves conflict):
em tal:content=python: 'żółć'template id/em.

This doesn't work:
em tal:content=structure python: 'żółć'template id/em.

Also if you have Folder instance and set it's Title
to the string that contains some i18n characters
you're not able to even add page template
inside it.

Error traceback in both cases is same:

Error Type: UnicodeDecodeError
Error Value: 'ascii' codec can't decode byte 0xc5 in position 200:
ordinal not in range(128)

Traceback (innermost last):
Module ZPublisher.Publish, line 119, in publish
Module ZPublisher.mapply, line 88, in mapply
Module ZPublisher.Publish, line 42, in call_object
Module Shared.DC.Scripts.Bindings, line 313, in __call__
Module Shared.DC.Scripts.Bindings, line 350, in _bindAndExec
Module Products.PageTemplates.PageTemplateFile, line 129, in _exec
Module Products.PageTemplates.PageTemplate, line 89, in pt_render
Module zope.pagetemplate.pagetemplate, line 117, in pt_render
Module zope.tal.talinterpreter, line 271, in __call__
Module zope.tal.talinterpreter, line 346, in interpret
Module zope.tal.talinterpreter, line 534, in do_optTag_tal
Module zope.tal.talinterpreter, line 516, in no_tag
Module zope.tal.talinterpreter, line 346, in interpret
Module zope.tal.talinterpreter, line 754, in do_insertStructure_tal
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc5 in position
200: ordinal not in range(128)

problem is with:
  text = unicode(structure)
at
Module zope.tal.talinterpreter, line 754, in do_insertStructure_tal

sitecustomize.py with setdefaultencoding('utf-8') solves this
but it is not nice solution. I wonder whether this should be
submitted as a bug, or maybe there is different solution that
I've missed?

For the record: one more thing that was wrong
for me during migration was 'expand' attribute of ZPT
that in case of few ZPT objects was set to true in
2.10.4 while oryginally in 2.8.4 it was false.
This caused that tales expressions disappeared
from ZPTs under 2.10.4. I've written a script that
explicitly set expand=0 to all ZPT instances in
Zope 2.8.4 and then, after migration, everything is OK.

-- 
Maciej Wisniowski
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] UnicodeDecodeError in Zope 2.10.4 (upgrade from 2.8.4)

2007-07-17 Thread Maciej Wisniowski


 Did you read

 http://www.zope.org/Products/Zope/2.10.4/Zope-2.10.4-released
Yes.

 The migration code should auto-detect ISO-8859-15 and UTF-8
 encoded page templates. For other encodings you must set
 the environment variable ZPT_PREFERRED_ENCODING.
 The migration code applies to ZopePageTemplate instances only.
I have utf-8 encoded ZPTs so I didn't used ZPT_PREFERRED_ENCODING

 When you download ZPT content through FTP or WebDAV the
 content is converted using the output_encoding property of
 the corresponding ZopePageTemplate instance.
So far I didn't even try ftp or webdav with 2.10.4. The problems are with
TTW.

 The encoding of a rendered ZPT (through HTTP) is determined through
 charset= within the content-type HTTP response header
 etc/zope.conf: default-zpublisher-encoding
 default: iso-8859-15
default-zpublisher-encoding is set to utf-8

 In order to deal with UnicodeDecodeErrors in a reasonable way,
 we added a configurable Unicode conflict resolver.
As I said before resolver is not even called when using 'structure' keyword.

-- 
Maciej Wisniowski
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] UnicodeDecodeError in Zope 2.10.4 (upgrade from 2.8.4)

2007-07-17 Thread Maciej Wisniowski

 If the documented hints don't work, please submit a bugreport
 with a reproducable testcase in form of a unittest.
Bug submitted with tests attached at:
http://www.zope.org/Collectors/Zope/2339

-- 
Maciej Wisniowski
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] UnicodeDecodeError in Zope 2.10.4 (upgrade from 2.8.4)

2007-07-17 Thread Maciej Wisniowski

 Both
 em tal:content=python: 'żółć'template id/em.
 and
 em tal:content=structure python: 'żółć'template id/em
 is like playing with fire. Don't do it.

 What you've got there is unicode characters written down without any
 encoding information.
This is legacy code from zope 2.8.4 that I have to
deal with during migration. All new code is supposed to use
u'' strings.
In fact, above is only an example but in real case we
have properties set for folders, eg. 'title' that
contains national characters.

You can easily check it yourself if you want.
Just create a Folder and set it's 'title' property
to one that contains some unicode characters.
You'll not be even able to add ZPT object into
that folder I think (at last it is not possible for me).


 It will work if you set the internal ZPT encoding to be the same as it
 was entered into the template which I can see is not ASCII which is
 what your system defaults to.
What do you mean by internal ZPT encoding? Docs says:
Starting Zope 2.10.2 the ZPT implementation uses unicode as internal
representation
so there should be no encoding at this level, I think.


 This is internally what happens:
  x=\xc5
  unicode(x)
 Traceback (most recent call last):
   File stdin, line 1, in module
 UnicodeDecodeError: 'ascii' codec can't decode byte 0xc5 in position
 0: ordinal not in range(128)
  import sys; sys.getdefaultencoding()
 'ascii'
I already realized same thing and used sitecustomize.py
with sys.setdefaultencoding('utf-8') as a quick fix. This works
but is not nice solution. I rather expected Zope 2.10 resolver to
deal with this.

-- 
Maciej Wisniowski
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Problem w/ ZMySQLDA

2007-07-16 Thread Maciej Wisniowski



 Furthermore, mytop shows the user is hanging:
  30 mysqluser   localhost mrtableclo   473  Sleep

 What should I do next to troubleshoot this?
Try deadlockdebugger to see what is happening

-- 
Maciej Wisniowski
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Logon process

2007-07-06 Thread Maciej Wisniowski

 Hi, Maciej!
 The same problem as with CookieCrumbler or ExUserFolder: I don't understand
 the process to setup the product in order to use it
 
 Do you know any url o similar about how to setup and use PAS?
docs/ folder in PAS product :)

I don't remember exaclty how PAS looks so following
description is from memory and for older PAS version
that I've used some time ago but should be suitable
in general:

You have to crate a folder you want to be secured.
Then you should set View permission for authenticated users
only (or something like that). This is typical Zope security
machinery.

Then you add PAS object into secured folder - this
will create new 'acl_users' object.

In 'acl_users' you need to add two plugins from the list:
1. Cookie (don't remember the name)
2. ZODB UserFolder

Then you have to Activate added plugins (you'll find activation
at properties or at 'plugins' object).

Thats all. Now, at ZODB UserFolder object you may add users
just like with default acl_users.

If you take a look at interfaces.py or docs/ you'll find that
there are few kinds of plugins for extraction, authentication etc.
You may exchange some of them to suit your needs and write your own ones.

-- 
Maciej Wisniowski
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Logon process

2007-07-05 Thread Maciej Wisniowski
 Thanks, I try to use a more easy solution but it's ok
 
 I check this and ExUserFolder but in both cases I don't understand the
 product's setup process
 
 Do you know where I can found a tutorial about how to setup and use Cookie
 Crumbler product?
I think you should rather take a look at PAS - PluggableAuthService and
possibly just write your own plugin. There is Zope-PAS mailing list too.
You may take a look at docs/ and interfaces in this package.
Default PAS plugins include ZODB users storage and cookie
authentication.

-- 
Maciej Wisniowski
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] KeyErrors in Zope using ZEO

2007-07-03 Thread Maciej Wisniowski
 However, I'm still experiencing intermittent KeyErrors with the session
 stuff.  The line of code that always breaks is session =
 REQUEST.SESSION  and it has happened everywhere in my code that I use
 that.  Is there a better way to access the session that I should be
 using?  
I think there is no better way although there are different ways.
Maybe you should think again if you really have to use sessions shared
between zeo clients. If so then you should possibly try Faster (another
session implementation) that is said to be better especially in such
setup with ZEO.

-- 
Maciej Wisniowski
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Re: [Zope3-Users] z3c.form 1.3.0, z3c.formui 1.0.1, and z3c.formdemo 1.1.0 released!

2007-06-28 Thread Maciej Wisniowski

 Again for the curious and impatient ...
 ---

 We have added two more demos:

 * An Address Book implements a non-trivial example of an address book,
   including multiple addresses and E-mails. It demonstrates the use of
   sub-forms, writing custom widgets and composite content.
   
This demo is really impressive!

 * An SQL Message demo reimplemnets the simple Hello World! demo only using
   queries to the Gadfly database. The example adds to the original demo by 
   also providing a message overview screen, since the ZMI is not helpful for 
   pure SQL data.
   
Thanks for this one :)

-- 
Maciej Wisniowski
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] A question on pool-size

2007-06-27 Thread Maciej Wisniowski

 The thing that is bugging me is that it seems my configuration is not being
 taken into account. Is there an absolute limit for pool_size?
   
Go to lib/python/ZODB/DB.py file
There is a DB class with __init__ method.
Put some print statements here to display
pool_size and start zope with ./runzope or
./zopectl fg to see your prints.

You may also take a look at 'push' method
of _ConnectionPool in the same file. This is
the place where warning messages came from.
If you look closer then you'll see that there is no
absolute limit for pool_size. Only warnings are printed.

-- 
Maciej Wisniowski
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] how to restore a copied instance.

2007-06-26 Thread Maciej Wisniowski

 hi, i needed to reinstall my zope site on another computer so i
 installed (in debian) plone-site using aptitude ... it automatically
 makes a new instance and starts the server.
Is this the same Zope version that you have on another computer?



 after that i
 stopped the server ... and copied my site (instance folder) from the other 
 computer over this one.


 when i start /etc/init.d/zope2.9 start ... it doesn't complain , but i
 can't open the site. (same instance names, same port number )
What does this mean that you can't open the site? Errors?


 i tryied another aproach ... copied back the default installed
 instance ... and only overwritten the var folder with the data from
 the original site.
You also need Products/ from previous instance and files from
Extensions/ folder


 this way i hoped that Data.fs which contained all my objects ... will
 automatically become visible.

 it doesn't work this way either, it only sees the default objects, i
 can access the site ... but all my objects are not visible.
Check ControlPanel-Product Management if your products are installed
correctly


-- 
Maciej Wisniowski
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] A question on pool-size

2007-06-26 Thread Maciej Wisniowski
Hello

First, which Zope version do you have?

 Sometimes it reported pool-size of 10, and sometimes it reported 7!
 What could this be?
Maybe you're seeing warnings from few storages? but I'm not sure how
this works an I have no idea why you're seeing pool sizes as 7 and 10
if you set this to 20

 Another question: My expect a load of 50 concurrent requests, so I set
 zserver-threads to 25 on both zeo-clients, and a pool-size of 20 (but
 behaving as explained above). Do this conf make any sense? Where should I
 read to get more info about this matter?
I think it is better to use more Zeo clients than bump number of
threads. There were some benchmarks (or sth like that) showing
that bigger number of threads doesn't help too much to performance,
and it may be even worse.

In your setup, if you have 25 threads you should have pool size
bigger than 25 - every thread will possibly use ZODB so it should
have connection to use. In fact connection is created as needed, even if
pool_size is too small. That is why number of connections in your logs
is bigger than pool_size.

-- 
Maciej Wisniowski
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] zope stopped working suddenly

2007-06-18 Thread Maciej Wisniowski

 I tried to change effective-user from the zope.conf.in
 http://zope.conf.in file and saved it as zope.conf, I used the command
  
 effective-user tleis , as stated in the example of that file, but no
 thing changed. if anyone knows why please tell me (just curousity)
Maybe user tleis had no permissions to folders you've created as root.
 I created a new user as Maciej said, and there i tried to create an
 instance, but I got a denied permission message. 
If you tried to override existing instance created
by root then it is correct behaviour I think.

 What I did finally is that I deleted the folders in both /tmp/zope and
 /opt/Zope-2.10 folders, and installed Zope Again and everything is
 working fine right
:)

-- 
Maciej Wisniowski
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope-DB] Using dtml-vars in ZSQL methods?

2007-06-18 Thread Maciej Wisniowski

 I tried to invoke the query method of my adapter (which is named
 dhatabase) with this code:

 
 p = context.REQUEST.get('delete_this')
 if p:
 s = ', '.join([str(x) for x in p])
 t = delete from person where person_id in (%s); % s
 context.dhatabase.query(query_string=t)
 

 ...and got this error: AttributeError: query (full traceback at end of
 message).  What's wrong with my method call?
   
Try:

context.dhatabase().query(query_string=t)

Assuming that 'dhatabase' is your DatabaseConnection object.



 I also have a broader question:  When one is composing dynamic SQL in Python
 scripts, what are the pros and cons of executing them by going directly to
 the database adapter (as suggested above) vs passing it in as the sole
 argument of an empty ZSQL method?  By empty ZQL method I mean something
 like:
I think in this case there is no difference. Both ways may be harmful
unless you're sure that it is not possible to do sql injection.

-- 
Maciej Wisniowski
___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


Re: [Zope-DB] Using dtml-vars in ZSQL methods?

2007-06-18 Thread Maciej Wisniowski

 P.S.  I know that dtml-var... rather than dtml-sqlvar... is an
 unorthodox and apparently undocumented construct to use within a ZSQL
 definition.  But I need it because dtml-sqlvar... malformats the string.
   
What do you mean by 'malformats the string'?
Have you tried dtml-sqltest clause? It may be used to do
'where colname in ' statements.

-- 
Maciej Wisniowski
___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


Re: [Zope] zope stopped working suddenly

2007-06-15 Thread Maciej Wisniowski

 Greetings
 thank you for your help.
 first i want to ask if i should reply to you like what i am doing now,
 or send the message to zope@zope.org mailto:zope@zope.org? I am new
 to mailing lists and don't know the rules.
You should always stay on the list. It is common to just use 'Reply all'
option when replying.

 In my zope/log folder there is no event.log file, just a simple line
 readme.txt file.
 running the zopectl fg displayed the following:

 /** OUTPUT **/
 /tmp/zope/bin/runzope -X debug-mode=on
 2007-06-15 09:33:41 INFO ZServer HTTP server started at Fri Jun 15
 09:33:41 2007
 Hostname: 0.0.0.0 http://0.0.0.0
 Port: 8080
 2007-06-15 09:33:51 INFO Zope Ready to handle requests
 Traceback (most recent call last):
   File /opt/Zope-2.10/lib/python/Zope2/Startup/run.py, line 56, in ?
 run()
   File /opt/Zope-2.10/lib/python/Zope2/Startup/run.py, line 21, in run
 starter.prepare()
   File /opt/Zope-2.10/lib/python/Zope2/Startup/__init__.py, line
 111, in prepare
 self.setupFinalLogging()
   File /opt/Zope-2.10/lib/python/Zope2/Startup/__init__.py, line
 372, in setupFinalLogging
 self.setupConfiguredLoggers()
   File /opt/Zope-2.10/lib/python/Zope2/Startup/__init__.py, line
 254, in setupConfiguredLoggers
 self.cfg.eventlog()
   File
 /opt/Zope-2.10/lib/python/ZConfig/components/logger/factory.py, line
 32, in __call__
 self.instance = self.create()
   File
 /opt/Zope-2.10/lib/python/ZConfig/components/logger/logger.py, line
 42, in create
 handler = handler_factory()
   File
 /opt/Zope-2.10/lib/python/ZConfig/components/logger/factory.py, line
 32, in __call__
 self.instance = self.create()
   File
 /opt/Zope-2.10/lib/python/ZConfig/components/logger/handlers.py,
 line 69, in create
 logger = self.create_loghandler()
   File
 /opt/Zope-2.10/lib/python/ZConfig/components/logger/handlers.py,
 line 87, in create_loghandler
 handler = loghandler.FileHandler(path)
   File /opt/Zope-
 2.10/lib/python/ZConfig/components/logger/loghandler.py, line 34, in
 __init__
 StreamHandler.__init__(self, open(filename, mode))
 IOError: [Errno 13] Permission denied: '/tmp/zope/log/event.log'
 /** END **/
So seems  that you have incorrect permissions
set for /tmp/zope/log/event.log and
you need to change them or start zope as different user.
BTW you've chosen strange place (/tmp) to install your zope ;)

-- 
Maciej Wisniowski



___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] zope stopped working suddenly

2007-06-15 Thread Maciej Wisniowski

   File /opt/Zope-2.10/lib/python/Zope2/Startup/__init__.py, line
 234, in dropPrivileges
 return dropPrivileges(self.cfg)
   File /opt/Zope-2.10/lib/python/Zope2/Startup/__init__.py, line
 403, in dropPrivileges
 raise ZConfig.ConfigurationError(msg)
 ZConfig.ConfigurationError: A user was not specified to setuid to; fix
 this to start as root (change the effective-user directive in zope.conf)
 /** END **/
You have answer above. To run as root you have
to change effective-user at zope.conf file


 When everything was ok in the past I was able to run zope through
 ./zopectl start (as a root)
 but now the stop command displays that  the daemon manager is not open.
Strange that it worked. In general I think you shouldn't
run zope as root.

-- 
Maciej Wisniowski
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] a warning message before performing an action

2007-06-14 Thread Maciej Wisniowski
 I have a web page with some buttons (form action=...) to perform some
 action (by calling a python script). However, some actions (like
 'delete' a picture for example) I would like to warn user before
 performing it. I recall from php how to pop up a window (or a drop
 down in Mac OSX) with a warning message prompting a 'Yes' or 'No'
 confirmation and I was wondering how would I do it with Zope, with an
 example if possible.
If you've opened pop up window with php then in fact it had to be
JavaScript. Possibly you're looking form something like:

if (confirm(Do you really want to remove this picture))
return true
return false

which may be used with onsubmit event of form object. Of course
this is javascript code not python.

-- 
Maciej Wisniowski
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] zope stopped working suddenly

2007-06-13 Thread Maciej Wisniowski
 Greetings
 First , I am glad to join you at this list. I installed Zope on Fedora Core
 6, and started to learn how to use it. for a few days i was able to access
 the management interface (ZMI) through http://127.0.0.1:8080 after starting
 zope through .../zopectl start. but as a sudden I found myself unable to
 enter to the ZMI anymore. The browser displays  an error as if zope is not
 started at all.
 I am a newbie in both Linux and Zope, so please can anyone pass me some
 tips
 on how to check what is causing the problem and how to solve it?
 I searched the internet for two weeks now, but there is no hint about the
 problem!!
Possibly your Zope doesn't start because of some errors.
Take a look at log/event.log to see if there are any errors at the
end of this file.

Also try to run: .../zopectl fg
This command starts zope but stays attached to the console and displays
startup errors etc.

If you find any errors post full traceback here.

-- 
Maciej Wisniowski

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Re: Zope 2.7 - sporadic service hangup

2007-06-05 Thread Maciej Wisniowski
   In the trace.log (after turning this on) we can see entries for
 the last requests that completes and three requests that begins,
 but never finish (see below).
This is typical behaviour when all your threads are busy. Zope
accepts requests and AFAIR they're even written into z2.log but
doesn't serve them because all it's threads are busy.

Solution is to use DeadlockDebugger to see what your threads are doing
while Zope seems to be 'hang'.

-- 
Maciej Wisniowski
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Re: [Zope-DB] blobs and dtml-sqlvar

2007-06-02 Thread Maciej Wisniowski
 I'm using MySQLDBA, and I've got a Z SQL Method like this:

 select * from myTable where someValue=dtml-sqlvar myValue type=string

 The issue being that 'myValue' is actually a Hex value in a Blob
 column. The only types possible for dtml-sqlvar seem to be string and
 int (as far as I can tell).

 I noticed that when I use 'type=string' the value is always placed in
 inverted commas (and so MySQL thinks it is a string and rejects
 it) and when I put 'type=int' the Hex value is rejected by Zope.

 Is it possible that MySQLDBA can not handle blobs / Hex values at all?
 I'm confused that dtml-sqlvar only sees 2 types of data.
I have no idea how this works with mysql but in postgres I've used:

ZSQL:
update company
   set logo=dtml-var logo::bytea
 where companyid=dtml-sqlvar companyid type=int

Python Script:
from psycopg2 import Binary
picture = container['logo.gif'].data  # Image object
container.set_logo(companyid=companyid, logo = Binary( obraz ))

Maybe there is something similiar in MySQLDB.

-- 
Maciej Wisniowski
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Zope 2.7 - sporadic service hangup

2007-06-01 Thread Maciej Wisniowski

 Hi,
 we notice two or three times a day some kind of hangup of the zope service. 
 After hangup there is no response requesting urls/manage interface cannot be 
 accessed, too. Restarting the zope service resolves all problems until the 
 next hangup.

 No errors in zope logs! Seems to work everything fine ...

 We use Zope 2.7.5-final, python 2.3.5 on Debian, to access LDAP 
 LDAPUserFolder, ZOracleDA for Oracle Connection.

 I know about problems with ZOracleDA - but not resulting in hangups. What 
 could be the reason? What can I do?
Have you tried DeadlockDebugger to see what are
your threads doing? I'm not sure if this works with Zope 2.7

-- 
Maciej Wisniowski
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope-dev] Re: [Bug] ZODB invalidation processing

2007-05-31 Thread Maciej Wisniowski


 I deleted the created objects and repeated the test:

 2007-05-31 12:46:12 ERROR Zope.ZCatalog uncatalogObject unsuccessfully
 attempted to uncatalog an object with a uid of
 /uniben/campus/students/A923157/study_course/200/ZOO213.
 2007-05-31 12:47:05 INFO Skins.create_level Y617041 started to create
 level 400
 2007-05-31 12:47:14 INFO Skins.create_level A923157 started to create
 level 200
 2007-05-31 12:47:25 INFO Skins.create_level Y617041 finished to create
 level 400
 2007-05-31 12:47:40 INFO Skins.create_level A923157 finished to create
 level 200
 2007-05-31 12:47:58 INFO ZPublisher.Conflict ConflictError at
 /uniben/campus/students/A923157/study_course/create_level: database
 conflict error (oid 0x3647b0, class BTrees._IOBTree.IOBucket, serial
 this txn started with 0x036dfe463486d955 2007-05-31 10:46:12.310958,
 serial currently committed 0x036dfe479a5725cc 2007-05-31
 10:47:36.173536) (3 conflicts (0 unresolved) since startup at Thu May
 31 09:44:24 2007)

 again the txn starttime is that of an older transaction, and it is the
 time of the uncatalog entry.

 If I invoke the create_level only for one student, no conflict-error
 occurs.
I've checked my logs for conflict errors with session machinery. I also had
times earlier than zope startup:

http://mail.zope.org/pipermail/zope-dev/2007-April/029244.html

I don't know why...

Maybe your problem is simply that 'create_level' does
something with Catalog (as Tres Seaver suggested).

If so, then if one transaction changes it
then second transaction raises conflict.

With sessions I had problems with OOBTree not IOBTree.

-- 
Maciej Wisniowski
___
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] Re: [Bug] ZODB invalidation processing

2007-05-31 Thread Maciej Wisniowski
 
 resolve bound method Length._p_resolveConflict of BTrees.Length.Length
 object at 0xb28fff6c
 resolve built-in method _p_resolveConflict of BTrees._OIBTree.OIBucket
 object at 0xb1b81224
 resolve built-in method _p_resolveConflict of BTrees._OIBTree.OIBucket
 object at 0xb1b81224
 resolve built-in method _p_resolveConflict of BTrees._OIBTree.OIBucket
 object at 0xb260c80c
 resolve built-in method _p_resolveConflict of BTrees._OIBTree.OIBucket
 object at 0xb260c614
 resolve bound method Length._p_resolveConflict of BTrees.Length.Length
 object at 0xb2a9146c
 resolve built-in method _p_resolveConflict of BTrees._IOBTree.IOBucket
 object at 0xb1b81224
 
 The last resolve raises an exeption
 
 (Pdb) p sys.exc_info()
 (class ZODB.POSException.BTreesConflictError at 0xb78df0bc,
 BTreesConflictError(-1, 47, 47, 6), traceback object at 0xb1c34dec)
Length, IOBucket and such things seems to me to be related to session
machinery. What timeout and resolution times you have now? Also try if
there are differences when you try to call your methods just after zope
restart and after few different calls to get session objects created.

 How can I invest this further, especially how can I get information
 about the actual object,which is causing the conflict.
http://www.zopelabs.com/cookbook/1054240694
Maybe this will help. Take a look at comments on this page.

-- 
Maciej Wisniowski
___
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )


Re: [Zope] Re: Function reindexObject()

2007-05-31 Thread Maciej Wisniowski

 The import script run very well, I transform each line of the text
 file to a correspondant product as zope2.7. But I want put each new
 product in the same repertory as zope 2.7. So how say to each product
 in my import script where it must be copy.
Why don't you just export object path along
with it's data? use |getPhysicalPath() for example.
Take a look at http://plope.com/Books/2_7Edition/AppendixB.stx#2-396 for
description.
Also consider use of restrictedTraverse to get access to object that you
will
add newly created objects to (during import).

Sth like:
container = self.|restrictedTraverse('/SITES/plone_mySite/repertory1/)
container.invokeFactory

Or something like that.
 My subject is reindexObject because I think it's this function that
 put the new Object (product) in ZMI. I don't know :s
AFAIK reindexObject is used to reindex object in Catalog.
invokeFactory puts new object of the specific type to ZMI.

-- 
Maciej Wisniowski
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Uncaptured python exception

2007-05-31 Thread Maciej Wisniowski
 Var1 = var2
 
 Where var2 is undefined (i.e. has never been assigned anything)
 
 Just silent failure.  No error.
So how do you know there is a failure then?
There is really nothing in event.log and nothing in error_log?

-- 
Maciej Wisniowski
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Function reindexObject()

2007-05-30 Thread Maciej Wisniowski

 I have made some python scripts to export data of some zope2.7 products
 in text file, and I have made some scripts to import theses data to
 rebuild products in zope2.9. Theses scripts run very well.
 
 But my problem is that all product that is rebuilt are in
 /SITES/plone_mySite/
 I want rebuil all product in zope2.9 in the same directory as zope 2.7.
 I have the same structure for zope 2.7 and zope 2.9.
But where is the problem? What are 'products' for you and what do you
mean by rebuild? Where are folders like /SITES/plone_mySite/? Is this
filesystem path or path in your ZODB? What are your scripts? External
methods?

-- 
Maciej Wisniowski
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope-dev] many conflict errors

2007-05-25 Thread Maciej Wisniowski
Perry napisał(a):
 Answering to myself:
 
 we could get rid of the sessionrelated conflict errors, by removing all
 
 session = context.REQUEST.SESSION
 
 from our scripts. But we still have these conflict errors:
 
 how can I find out, what causes these conflicts.
 
 2007-05-25T10:17:50 INFO ZPublisher.Conflict ConflictError at
 /VirtualHostBase/http/uniben.waeup.org:80/uniben/VirtualHostRoot/campus/students/U431409/study_course/create_level:
 
 database conflict error (oid 0x7905e6, class BTrees._IOBTree.IOBucket,
 serial this txn started with 0x036ddc2a44454dee 2007-05-25
 09:14:16.000950, serial currently committed 0x036ddc2c21950377
 2007-05-25 09:16:07.870801) (80 conflicts (10 unresolved) since startup
 at Fri May 25 05:19:08 2007)
Try to change session resolution seconds (Timeout resolution (in seconds))
parameter to a larger value. Possibly you're ecountering same problem as I
had some time ago. With long requests and small session resolution
seconds I had a lot of conflict errors.

I think it is because of way sessions work in zope. Every x
seconds (where x is 'session resolution seconds'), when there is access
to SESSION, session objects are moved in OOBTrees. It is used to handle
session expiration.
Not used session objects are moved to the end of the
'list' and finally removed after Session Timeout is reached. I don't
know how this exactly goes but it is something like that.

When this 'movement' happens during request (session object is moved
when request that is bound to it is still being served) this causes
conflicts. You may look at group archives for my posts month or two
months ago...

It is easy to reproduce these errors.

-- 
Maciej Wisniowski

___
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] many conflict errors

2007-05-25 Thread Maciej Wisniowski
 I set it now to 9600/4800 (Timeout/Resolution) but it seams that it has
 no effect.
Hm... where did you set this? At faster's preferences page in ZMI?
can you verify that these settings are used?
To change timeout/resolution to high values for standard session
implementation in zope.conf I had to patch one of zope core files,
otherwise it was not possible to start zope.

One more thing may be that these errors appears because of large
number of newly created session objects, eg. after zope restart.
I mean that when you restart zope and then run 10 concurrent requests
10 new session objects will be created. This may (and possibly do) cause
conflicts as these are all changes to OOBTree.
When you run these 10 concurrent requests again from the same browsers
(without restarting zope) then objects are already created so only
session resolution may be taken into account I think.

How do you check this? One more thing I wonder about is what number
of threads your zope instance is running?

 I read this already I am also using the faster-session product and
 patched it to use the AppendOnlyDict.
In this case it had no effect for me too.

-- 
Maciej Wisniowski
___
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-DB] Seeking a suitable ZpsycopgDA

2007-05-01 Thread Maciej Wisniowski

 Correction:  What I'm looking for seems to be called ZpsycopgDA, not just
 psycopgDA.  Anyway, I still haven't found it for the environment described
 below.  Pls advise.
It is available at initd.org with psycopg packages (in tar.gz) files.
I think if you simply copy zpsycopgda folder to your zope instance
Products/ this will work (if only you will have correct version).

-- 
Maciej Wisniowski
___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


Re: [Zope] extract page title

2007-04-24 Thread Maciej Wisniowski

 Hi Andreas,

 Thanks - i know the title does not belong in a script tag, i just want
 the text within the title tag appended within the javascript, not the
 tags themselves. Sorry its my explanations for help that are unclear.


I'm not sure if I understand you but...
Where title tag content came from? If this is from typical title_or_id
function then
you may use something like:

title tal:content=here/title_or_id/title 

you may then also do:

img tal:attributes=src python:
'http://domain/xxx/xxx/s?websitename.%s' % (here.title_or_id())
width=1 height=1 alt=

-- 
Maciej Wisniowski
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope-dev] Re: Sessions and long requests = conflicts? Mcdutils?

2007-04-12 Thread Maciej Wisniowski

 I dropped further development on it
 once I evaluated the cost of having session data disappear (or become
 inaccessible) when new memcache servers were added, or old ones removed.
Thanks for clearing that.

 If you are *sharing* mutable session data between multiple long-running
 requests, and expect to have no conflicts, you are in for a
 disappointment:  unless your application can supply resolution logic,
 you *want* conflict errors in such cases.
I'm not sharing session data between requests. I have two disctinct requests
(eg. from different browsers) and I expect them to have it's own session
objects. So if request 1 puts something into it's session I would expect
that it has nothing to second request's session, but this is not always
true
(I think when new timeslice appeared meanwhile). More, it is not even
necessary to change session data! Even just calling self.REQUEST.SESSION
causes conflicts.

Simple test I did is to create external method like:

import time
def testme(self):
print 'testme started'
self.REQUEST.SESSION
time.sleep(5)
print 'testme after sleep'
return 'finished'

and call this manually from two different browsers.
It DOESN'T change session data!
I have Zope 2.9 instance with default setting of 
session resolution seconds == 20. I started
zopectl fg with logger level set to debug. after calling
my external method I see output like below:


#  Default Zope session: I entered localhost:8081/testme from two
browsers ##
2007-04-12 08:09:03 DEBUG txn.-1276576864 new transaction
testme started
2007-04-12 08:09:03 DEBUG txn.-1251398752 new transaction
testme started
testme after sleep
2007-04-12 08:09:08 DEBUG txn.-1276576864 commit Connection at b588ea8c
2007-04-12 08:09:08 DEBUG txn.-1276576864 commit
testme after sleep
2007-04-12 08:09:08 INFO ZPublisher.Conflict ConflictError at /testme:
database conflict error (oid 0x0d, class BTrees._OOBTree.OOBTree, serial
this txn started with 0x036ce3f0fca76611 2007-04-12 06:08:59.215758,
serial currently committed 0x036ce3f122de5f11 2007-04-12
06:09:08.172337) (1 conflicts (0 unresolved) since startup at Thu Apr 12
08:08:51 2007)
2007-04-12 08:09:09 DEBUG txn.-1251398752 abort
2007-04-12 08:09:09 DEBUG txn.-1251398752 new transaction
testme started
testme after sleep
2007-04-12 08:09:14 DEBUG txn.-1251398752 commit Connection at b6307e8c
2007-04-12 08:09:14 DEBUG txn.-1251398752 commit



##
With Faster (Resolution (seconds): 20) and time.sleep(5) in my external
method
I had no conflicts but after changing to time.sleep(25) I get:
##

2007-04-12 08:29:44 DEBUG txn.-1268184160 new transaction
testme started
2007-04-12 08:29:45 DEBUG txn.-1276576864 new transaction
testme started
testme after sleep
2007-04-12 08:30:09 DEBUG txn.-1268184160 commit Connection at b588ea8c
2007-04-12 08:30:09 DEBUG txn.-1268184160 commit
testme after sleep
2007-04-12 08:30:10 INFO ZPublisher.Conflict ConflictError at /testme:
database conflict error (oid 0x2d, class
Products.faster.sessiondata.SessionDataContainer, serial this txn
started with 0x036ce4051fa32844 2007-04-12 06:29:07.415000, serial
currently committed 0x036ce406266df400 2007-04-12 06:30:09.006915) (4
conflicts (0 unresolved) since startup at Thu Apr 12 08:08:51 2007)
2007-04-12 08:30:11 DEBUG txn.-1276576864 abort
2007-04-12 08:30:11 DEBUG txn.-1276576864 new transaction
testme started
testme after sleep
2007-04-12 08:30:36 DEBUG txn.-1276576864 commit Connection at b6307e8c
2007-04-12 08:30:36 DEBUG txn.-1276576864 commit


As you see there is even no change to session data from external method.

 If you believe that 'faster' is raising conflicts due its own internal
 data structures (OOBTree bucket splits), rather than in the
 application-dveined session data, there is a conflict-free alternative
 available:  we found that it was slower than the other, and therefore
 didn't scale as well, even given the possibility of conflicts.
Thanks for that clue.

-- 
Maciej Wisniowski
___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] Re: Sessions and long requests = conflicts? Mcdutils?

2007-04-12 Thread Maciej Wisniowski

 If you believe that 'faster' is raising conflicts due its own internal
 data structures (OOBTree bucket splits), rather than in the
 application-dveined session data, there is a conflict-free alternative
 available:  we found that it was slower than the other, and therefore
 didn't scale as well, even given the possibility of conflicts.

 To enable the conflict-free storage, you need to patch the
 '_BUCKET_TYPE' class-level variable of the storage to use
 'AppendOnlyDict' rather than 'OOBTree'.  E.g.:

   from Products.faster.sessiondata import CBSessionDataContainer
   from Products.faster.appendict import AppendOnlyDict
   CBSessionDataContainer._BUCKET_TYPE = AppendOnlyDict

I've changed to:
 _BUCKET_TYPE = AppendOnlyDict

in sessiondata.py for SessionDataContainer and
CBSessionDataContainer.

Unfortunatelly when I run external method like
below concurrently from 3 different browsers
(Opera, FF, Konqueror) I still get conflict errors.

import time
def testme(self):
print 'testme started'
self.REQUEST.SESSION
time.sleep(50)
print 'testme after sleep'
return 'finished'

Faster 'Resolution secs' is set to 20.
Console output:

2007-04-12 10:31:50 DEBUG txn.-1260708960 new transaction
testme started
2007-04-12 10:31:51 DEBUG txn.-1277494368 new transaction
testme started
2007-04-12 10:31:54 DEBUG txn.-1252316256 new transaction
testme started
testme after sleep
2007-04-12 10:32:40 DEBUG txn.-1260708960 commit Connection at b562e9ac
2007-04-12 10:32:40 DEBUG txn.-1260708960 commit
testme after sleep
2007-04-12 10:32:41 INFO ZPublisher.Conflict ConflictError at /testme:
database conflict error (oid 0x2b, class
Products.faster.sessiondata.SessionDataContainer, serial this txn
started with 0x036ce4767ce55799 2007-04-12 08:22:29.272469, serial
currently committed 0x036ce480ad6d3044 2007-04-12 08:32:40.646840) (3
conflicts (0 unresolved) since startup at Thu Apr 12 10:17:09 2007)
2007-04-12 10:32:41 DEBUG txn.-1277494368 abort
2007-04-12 10:32:41 DEBUG txn.-1277494368 new transaction
testme started
testme after sleep
2007-04-12 10:32:44 INFO ZPublisher.Conflict ConflictError at /testme:
database conflict error (oid 0x2b, class
Products.faster.sessiondata.SessionDataContainer, serial this txn
started with 0x036ce4767ce55799 2007-04-12 08:22:29.272469, serial
currently committed 0x036ce480ad6d3044 2007-04-12 08:32:40.646840) (4
conflicts (0 unresolved) since startup at Thu Apr 12 10:17:09 2007)
2007-04-12 10:32:45 DEBUG txn.-1252316256 abort
2007-04-12 10:32:45 DEBUG txn.-1252316256 new transaction
testme started
testme after sleep
2007-04-12 10:33:31 DEBUG txn.-1277494368 commit Connection at b62a8d8c
2007-04-12 10:33:31 DEBUG txn.-1277494368 commit
testme after sleep
2007-04-12 10:33:35 DEBUG txn.-1252316256 commit Connection at b55b982c
2007-04-12 10:33:35 DEBUG txn.-1252316256 commit

Also after few different tires, eg. with Resolution secs == 300 I
ecountered conflicts with
AppendOnlyDict like:

2007-04-12 10:53:07 INFO ZPublisher.Conflict ConflictError at /testme:
database conflict error (oid 0x4c, class
Products.faster.appendict.AppendOnlyDict, serial this txn started with
0x036ce49409621366 2007-04-12 08:52:02.199166, serial currently
committed 0x036ce49515ed0477 2007-04-12 08:53:05.138871) (9 conflicts (0
unresolved) since startup at Thu Apr 12 10:17:09 2007)

Is there a point in faster where I can put debug message to see that
bucket splits (or something like that) happened?

-- 
Maciej Wisniowski
___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] Sessions and long requests = conflicts? Mcdutils?

2007-04-12 Thread Maciej Wisniowski

 You could keep experimenting with values to reduce the chances of
 conflicts. Perhaps sessions that last for days. With resolution of
 hours. Disabling inband housekeeping.

 Note that a session-timeout-minutes of 0 enables a slightly different
 approach which has a little less active structure.
Yes, setting high values for timeout and session resolution seconds or
disabling session timeout by setting it to '0' reduces rate of conflict.
I tried disabling inband housekeeping but this didn't helped in this
case.


 I don't think session mechanics operates like that at the end of a
 transaction. More generally what is happening is that the second
 transaction is trying to commit data that was changed by an earlier
 transaction after second transaction read that data. In this case the
 data is various bits of the internals that make up sessions and
 transience storage.
Right but I would like to know how exactly this goes, eg. when
I can expect conflicts. So far I'm still not sure when and why conflict
will appear.

Thanks for the answer

-- 
Maciej Wisniowski
___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] Re: Sessions and long requests = conflicts? Mcdutils?

2007-04-12 Thread Maciej Wisniowski
 Did you configure the faster SDC to disable the 'lazy' flag?  That flag
 disables modification of the SDC's linked list until the sesion is
 actually modified, rather than being just accessed as you are doing here.
I tried both, with and without 'lazy' setting.
I used _BUCKET_TYPE = AppendOnlyDict, timeout set to 1200 and timeout
resolution: 20

I did three concurrent requests (from three browsers) twice (first
request was just to initially create session data objects).
With second request, lazy or not, every time I get errors like these
attached below. Function that is called sleeps for 50 seconds and just
gets the access to SESSION object - doesn't put anything into session.
I've added print statements to _p_resolveConflict too
but seems this function is only called once in this situation.
In general tuning up session resolution seconds helps here.

Thanks for your answers I've read about Faster storage and I think
I understand this much more now, although I'm not sure about conflicts
below.

(...)
2007-04-12 21:43:28 DEBUG txn.1090525536 new transaction
testme started
2007-04-12 21:43:29 DEBUG txn.1098918240 new transaction
testme started
2007-04-12 21:43:30 DEBUG txn.1082132832 new transaction
testme started
testme after sleep
2007-04-12 21:44:18 DEBUG txn.1090525536 commit Connection at 2aaab3330110
2007-04-12 21:44:18 DEBUG txn.1090525536 commit
testme after sleep
2007-04-12 21:44:19 INFO ZPublisher.Conflict ConflictError at /testme:
database conflict error (oid 0x2b, class
Products.faster.sessiondata.SessionDataContainer, serial this txn
started with 0x036ce71f217604aa 2007-04-12 19:43:07.842424, serial
currently committed 0x036ce7204e9b7a44 2007-04-12 19:44:18.423594) (21
conflicts (0 unresolved) since startup at Thu Apr 12 19:55:58 2007)
2007-04-12 21:44:20 DEBUG txn.1098918240 abort
2007-04-12 21:44:20 DEBUG txn.1098918240 new transaction
testme started
testme after sleep
2007-04-12 21:44:20 INFO ZPublisher.Conflict ConflictError at /testme:
database conflict error (oid 0x2b, class
Products.faster.sessiondata.SessionDataContainer, serial this txn
started with 0x036ce71f217604aa 2007-04-12 19:43:07.842424, serial
currently committed 0x036ce7204e9b7a44 2007-04-12 19:44:18.423594) (22
conflicts (0 unresolved) since startup at Thu Apr 12 19:55:58 2007)
2007-04-12 21:44:21 DEBUG txn.1082132832 abort
2007-04-12 21:44:21 DEBUG txn.1082132832 new transaction
testme started
testme after sleep
2007-04-12 21:45:10 DEBUG txn.1098918240 commit Connection at 2aaab31052d0
2007-04-12 21:45:10 DEBUG txn.1098918240 commit
testme after sleep
inside of _p_resolveConflict for SessionDataContainer
2007-04-12 21:45:11 DEBUG txn.1082132832 commit Connection at 2aaab1c75710
2007-04-12 21:45:11 DEBUG txn.1082132832 commit
(...)


-- 
Maciej Wisniowski
___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )


Re: [Zope] nested queries and zpt

2007-04-12 Thread Maciej Wisniowski

 url: ServerList?CustomerID=123456

 tal:x repeat=server here/serverlist-sql
 tal:x replace=server/nameservername/tal:x
 tal:x replace=server/IDserver ID number/tal:x
 tal:x replace=structure here/ServerSoftwareListlist of software
 goes here/tal:x
 .../tal:x
 The problem is that the ServerSoftwareList needs the server/ID
 passed to it for the query, which will return the software on file for
 that server... any ideas?
tal:x replace=structure python:
here.ServerSoftwareList(id=server['id'])list of software goes here/tal:x

-- 
Maciej Wisniowski
___
Zope maillist  -  [EMAIL PROTECTED]
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope-dev] Sessions and long requests = conflicts? Mcdutils?

2007-04-11 Thread Maciej Wisniowski
Hi

Currently I have some problems with our application (Zope2.8.4)
and with Conflict Errors in sessions.
In general if we have few concurrent requests that are running
sometimes for 3-4 minutes (and they're touching session inside)
I get a lot of conflict errors with Inceraser, OOBTree, Length2 etc.
These are errors like:

serial starded with xxx serial currently commited 

Of course I know that it is best to move such long processes to
something external with Async, lovely.Remotetask or built
in Oracle jobs, but so far I have to deal with this state of
our application (as I'm not the author ot this but rather
something like an zope admin/supporter for this app).

I think that ConflictErrors are caused because of sessions
implementation, especially: timeslices, current bucket etc.
as written in Transience/HowTransienceWorks.stx.
Changing session_resolution_seconds to big value
helps here. By default we had session_resolution_seconds
set to 300.

I wonder how this happens. If I have two requests that at the beginning
modify it's sessions like: session.set('aa', 1), and then call long
running ZSQLMethods then (if meanwhile timeslice has changed because
of too short session_resolution_seconds):

- first request that finishes finds that there is new 'current' bucket
  and moves it's session object and second request's session object to
  new 'current' bucket and commits this

- second request finishes and finds that it's session object is not
  the same as it was at the beginning (because it was moved to 'current'
  bucket)??


Anybody can say if I'm right here?


I also tried Faster product to manage sessions but this behaves in a
similiar way (I mean causes conflict errors in such situation).

I found 'mcdutils' too. Tres Seaver said on zope-dev (a long time ago)
that it is supposed to have no conflict errors:
http://mail.zope.org/pipermail/zope-dev/2006-May/027555.html

Mcdutils:
http://agendaless.com/Members/tseaver/software/mcdutils

There is only 0.1 version. What is it's current state? Seems to
be dead? Can I take a look at this or is this better to not
even touch that?

-- 
Maciej Wisniowski


___
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )


Re: [Zope] [Ann] analyseObjects: analyse live objects

2007-04-10 Thread Maciej Wisniowski

 Hi Dieter,
 
 am I missing something, or the code is not on the web?
I'm able to get the code from here:
http://www.dieter.handshake.de/pyprojects/zope/analyseObjects.py

-- 
Maciej Wisniowski
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] ImportError: No module named cPersistence when creating new instance

2007-04-04 Thread Maciej Wisniowski

 ImportError: No module named cPersistence
Check zope list archives.

-- 
Maciej Wisniowski
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] IOError: [Errno 11] Resource temporarily unavailable for ./zopectl adduser...?

2007-04-03 Thread Maciej Wisniowski


 ZopeXMLConfigurationError: File /opt/Plone-
 2.5/dvplone/Products/Five/skel/site.zcml, line 7.2-7.37
 ZopeXMLConfigurationError: File
 /opt/Plone-2.5/dvplone/Products/Five/configure.zcml, line 12.2-12.32
 ZopeXMLConfigurationError: File /opt/Plone-
 2.5/dvplone/Products/Five/formlib/configure.zcml, line 15.2-18.8
 ConfigurationError: ('Invalid value for', 'factory', ImportError:
 Couldn't import zope.formlib.errors, No module named errors in
 .errors.InvalidErrorView)
Maybe you have Five that is not compatible with your zope version.
Check compatibility table at codespeak.net.

-- 
Maciej Wisniowski
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Making pythonscript changes to formulator fields persistent

2007-04-02 Thread Maciej Wisniowski
 What to do?
 
 I guess some developer has worked hard to prevent me from doing just this at 
 some point, but why? Do I need to write a product  to do it?
 Is anyone at all using this crazy development model where semi trusted 
 users 
 do stuff in the ZMI??? 
 But I digress..
 
 If anyone knows how to solve this I would be less frustrated for a while ;-)
Use ExternalMethod - easy just like python scripts and it's code is
trusted.

-- 
Maciej Wisniowski
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Making pythonscript changes to formulator fields persistent

2007-04-02 Thread Maciej Wisniowski
 I was thinking of that...
 How would you do that? Do you know formulator enough to say?
I don't know your use case good enough. Is this just changing
attributes of formulator fields?

 Put the whole thing in the EM, or something simpler?
 An EM I could just hand off the field object to, to get persisted?
I don't understand what you mean. Field objects already are persistent.
EM gives you no security restrictions in comparision to Script Python.

In general to simply change field.values['required'] to false I'd write
function to traverse through ZODB to find all FormulatorForm objects
and it's fields.

 (I find it a bit cumbersome to develop in EMs, reloading and all, so I tend 
 to 
 avoid it.)
With ExternalMethod you only have to hit save button again to refresh
it.

Simple external method code that you may use to traverse through ZODB:

def checkFolder(self, fld):
for obj_name, obj in fld.objectItems( 'FormulatorForm' ):
# get form fields here etc

for fld_name,fld_obj in fld.objectItems( 'Folder' ):
checkFolder( fld_obj )
for fld_name,fld_obj in fld.objectItems( 'Folder (Ordered)' ):
checkFolder( fld_obj )

I'm not sure about 'FormulatorForm', this may be 'Formulator Form' or
something like that.

-- 
Maciej Wisniowski
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Making pythonscript changes to formulator fields persistent

2007-04-02 Thread Maciej Wisniowski
 EM gives you no security restrictions in comparision to Script Python.
I should rather say that it gives you less restrictions: access to
all python modules etc.

-- 
Maciej Wisniowski
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] ZSQL, call for early beta testers

2007-04-01 Thread Maciej Wisniowski
 It works something like this::
(...)
 If in the folder 'sql/Userstuff' you have a file called
 'select_users.sql' you will the be able to just run:
 
  # select users:
  print SQLUser.select_users()
  # same but first printed the final SQL used
  print SQLUser.select_users(debug__=True)
  # save time for the next call
  print SQLUser.select_users(memcache__=True)
Few questions :)
sql/Userstuff is a filesystem folder or a folder in ZODB?

How does select_users.sql look? is this dtml with parameters
like in ZSQLMethods? Can I just pass parameters like:
SQLUser.select_users(param1='p1', param2='p2')?

Have you compared zsql + memcache performace with eg. CCZSQLMethods
from Dieter Maurer?

 Is anybody interested in a being early beta testers before I release it
 as Open Source? It works quite well here for me but I fear I'm getitng a
 bit home blind based on just my needs. I'm pretty sure it works but some
 early feedback would be appreciated.
I'm interested, although I can't guarantee quick response :)

-- 
Maciej Wisniowski
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] include?

2007-03-28 Thread Maciej Wisniowski
Katie napisał(a):
 We're almost finished getting the new site done completely in zope using css
 and mySql. We have an older portion of the old site done in php thought that
 we don't really want to re-write. We'd like to include it in the dtml
 document page that has all the common elements of every page but I'm at a
 loss of a way to do it other than using an inline frame. Is there a dtml
 include that takes a url string the way the dtml-var tag renders the
 associated file?
There is a product to embed php pages in zope:
http://zope.org/Members/hewei/PHParser

but I don't know if and how this works.

-- 
Maciej Wisniowski
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope-DB] Unified DA for Zope 2 using SQLAlchemy?

2007-03-26 Thread Maciej Wisniowski
 My posting says *nothing* about deprecating something. So __please__
 stop reading between the lines when there is nothing - except whitespaces.
But you said about *replacing* all different zope DAs. So I think
it is not reading between lines.

I agree that this kind of adapter (as additional one) is a nice idea :)

-- 
Maciej Wisniowski
___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


Re: [Zope-DB] Unified DA for Zope 2 using SQLAlchemy?

2007-03-25 Thread Maciej Wisniowski


 Now (in Zope2) we have things like ZOracleDA (DCOracle2), ZPsycopgDA
 etc. that are adapters to these specific databases. They're based on
 Shared/DC/ZRDB/.
 In Zope3 there are also such adapters eg. one using cx_Oracle. They're
 based on Zope3 rdb module.

 What do you mean by 'replacing' them? You want wrapper build for
 z3c.* to be used instead of ZRDB (rdb)?

 You're talking about Zope2 or Zope3 too?

 The subject says Zope 2:-)
A... yes I've missed that :)

So does your proposal is that the only support for RDBMS
in zope 2.x should be via ORM like adapter?
Or this should be something additional to current ZRDB, or
you want to change (simplify?) ZRDB to be similiar to
these z3c wrappers (zope transaction handling, connection pooling etc)?

If you say about going into ORM adapters then few things
I wonder about are calling specific (complicated) queries
and/or stored procedures from databases. How does SQLAlchemy
support this? Another thing, what about speed of ORMs in
comparision to traditional queries with ZSQLMethods?

-- 
Maciej Wisniowski
___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


Re: [Zope] Attribute error

2007-03-23 Thread Maciej Wisniowski

 Hi,
 
 I'm pretty new to Zope; I inherited the system when I started my new job.
 We use it to manage a college web site.  I noticed yesterday that several
 pages in our Student Services section will no longer load.  Every time I
 try, I get this:
 
 Error Type: AttributeError
 Error Value: visible
 
 And I have no idea what it means or how to fix it.  Any suggestions would be
 much appreciated.
You have to start learning about python and zope :)

Take a look at site error log (via ZMI) or at event.log in the
filesystem to see full error traceback.

-- 
Maciej Wisniowski
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] dtml Z SQL doubt

2007-03-22 Thread Maciej Wisniowski

 Hi all,

 I need to insert a row to mysql table if the corresponding  data not
 exist, if it exist i need to update the row.

 Can we do it using a single Z SQL method.
Yes, if your ZSQL will call stored procedure that will handle this logic.
Otherwise, I think you can't (but I might be wrong).

-- 
Maciej Wisniowski
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] open image in a fitted new window

2007-03-22 Thread Maciej Wisniowski

 I was wondering how to once clicking on a image (thumbnail) I would
 get the full-size image in a fitted new window, without buttons,
 address field etc. I can realise how to do it with javascript but I
 don't know, if it's the only way, how to integrate javascript in a
 zpt. A example/tutorial would be very welcome so.
What you're asking for? How to insert javascript code into html page?

-- 
Maciej Wisniowski
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope-DB] DCOracle2 and x86_64

2007-03-22 Thread Maciej Wisniowski
 Maceij -
 You got the following:
 gcc -pthread -shared  ./dco2.o  -L/opt/oracle/client.9/product/lib32/
 -lclntsh -Wl,-rpath,/opt/oracle/client.9/product/lib  -o ./dco2.so
  
 BOTH oracle lib directories should be lib32.  In the above, you have one
 pointing to lib32 and the other one to lib.  Change the MAKE file to
 reflect this.
 Also, make sure that you actually have the 32-bit libs in the lib32.
 The point is this:  the paths should be to the location of the 32-bit
 libs wherever they are, and the paths above should be set to these
 32-bit paths.  Also, LD_LIBRARY_PATH should point to the 32-bit lib
 path.
 Link, and then point your LD_LIBRARY_PATH to the oracle 64-bit lib path.
 This has worked with me without fail with DCOracle2 and other programs
 too that use oracle libs.  I use Solaris.
Thanks for the hints! Currently I can't check this (we've installed 32 bit
systems on our servers in order to avoid segfaults :) ) but I'll try
when it'll be possible.

-- 
Maciej Wisniowski
___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


Re: [Zope-DB] DCOracle2 with a Stored Procedure that Returns REFCURSOR / ORA TIMESTAMP DataType Issue

2007-03-20 Thread Maciej Wisniowski

 This was causing a segmentation fault on a Sun Solaris box.
 On Windows, I got an actual error message.  While fetching, the cursor
 has a field of ora datatype TimeStamp.  This was crashing DCOracle2.  a
 to_char solved the issue.
 I am using DCOracle2 and Oracle 10 on Solaris (and Windows XP).
 Did anyone run into issues of handling TimeStamp oracle data type with
 DCOracle2?
We had problems with segmentation faults on 64 bit systems.
We didn't realized what caused this (except that it was DCOracle2).
Problem appeared only under high load of our servers so it was hard
to debug. On 32 bit systems everything was ok. Is your problem with
TimeStamp related to 64 bit platform or it happens on 32 bit platforms too?

-- 
Maciej Wisniowski
___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


Re: [Zope] Re: losing random session data

2007-03-19 Thread Maciej Wisniowski
 This does the trick:
 
 order = []
 new_order={}
 prev_order=req.SESSION.get('order')
 
 if prev_order != None:
  for orders in prev_order:
for item in orders.keys():
 new_order[item]=orders[item]
order.append(new_order)
new_order ={}
This seems to be hardcore ;) I mean that it should not
be necessary to do such rewrite of all keys and values
for dictionaries or lists taken from session.
I never had to do something like that...

Isn't it working without these assignments? Just:

order=req.SESSION.get('order', []) # if there is no 'order' in session
   # you'll simply get empty list here
new_order = {}
for val in req.form.keys():
new_order[val]=req.form[val]
order.append(new_order)
req.SESSION['order'] = order


BTW. req.SESSION.set(..., ...) method is also persistence aware
(according to zope book)

-- 
Maciej Wisniowski
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] losing random session data

2007-03-18 Thread Maciej Wisniowski
 my data ends up looking like this:
 
 order [{}, {}, {'foo': '1', 'bar': 'a'}, {}, {'foo': '2', 'bar': 'b'},
 {'foo': '6', 'bar': 'z'}, {'foo': '1', 'bar': 'a'}]
What is wrong here? I mean what output is expected?

 I've seen  http://mail.zope.org/pipermail/zope-dev/2006-July/027890.html
 and am aware that related bug existed prior to 2.7.1.
There is 'faster' that is alternative sessioning machinery but I don't know
if it works with 2.7

 I've used sessions without problems before, this is the first time I
 attempt to store variables in containers. What am I doing wrong?
Maybe it is because of req.form assignment. Try to create copy of
its values and append this to 'order' list like:

session = context.REQUEST.SESSION
order = session.get('order', [])
order.append({'foo':req.form['foo'],
  'bar':req.form['bar']})
session.set('order',order)

and see what happens now.

-- 
Maciej Wisniowski
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] accessing the user search using mxODBC adapter

2007-03-14 Thread Maciej Wisniowski

 We're having issues getting a user listing back from a SQL server
 database using the default Plone user search. We have the mxODBC
 adapter all working for login but not for the user search. Does anyone
 have experience of issues here? Is it an issue with the user folder or
 is a ZSQL required?
For me, mxODBC can't be a problem here.
Do you have error tracebacks?

This issue can be better answered on Plone-users
list I think.

-- 
Maciej Wisniowski
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] accessing the user search using mxODBC adapter

2007-03-14 Thread Maciej Wisniowski
 
 No, no error tracebacks at all. Simply that the search for a user
 returns no results. However the user can login fine.
AFAIR in PAS there are plugins that are responsible for listing users
but I have no idea how this works in PlonePAS and if this plugin is used by
'default users search form'. So far you didn't even
tell us if you use PlonePAS and if so what kind of authentication plugin.

I still think this is a Plone related problem/question :)

-- 
Maciej Wisniowski
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] have problem with managing objects within a external product

2007-03-12 Thread Maciej Wisniowski

  
 I found out what my problem is.
 in my code I please baseclass Item before Folder
  class ShpProjectClass(Item, Folder, Persistent, Implicit, CatalogAware):
 when I change the order, it worked normally
  class ShpProjectClass(Folder, Item, Persistent, Implicit, CatalogAware):
 but I don't understand why? could someone explain this to me?
Possibly you'll have to read about multiple
inheritance in python. In fact I think instead of 

class ShpProjectClass(Folder, Item, Persistent, Implicit, CatalogAware):

you may use:

class ShpProjectClass(Folder, CatalogAware):

Item, Persistent and Implicit already are base clases of Folder.

-- 
Maciej Wisniowski
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] 'int' object has no attribute 'objectValues'

2007-03-12 Thread Maciej Wisniowski
 span tal:define=batch here/quotes/objectValues; num python:len(batch)
 p tal:replace=python:here.randomNumber(num) /
 /span
Check what here/quotes is evaluating to. Seems that it is int.

-- 
Maciej Wisniowski
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] No space left on device

2007-03-09 Thread Maciej Wisniowski
 
 Where? I added this line to zopectl and rebooted:
 TMPDIR=/usr/local/zope/tmp
 (usr has plenty of space) but it didn't help.

TMPDIR=/usr/local/zope/tmp
export TMPDIR

also there is df -h command that shows free space
on devices, you may use this to observe how it
changes while importing etc.

-- 
Maciej Wisniowski
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] can not install ZMySQLDA

2007-03-08 Thread Maciej Wisniowski
 Any suggestion?
What is /opt/Plone-2.5.2/zeocluster? Is this zeo server or zeo client in
your installation?
You should copy your ZMySQLDA to Products/ folder of your zope instance
(zeo client). I suppose you've copied this to zeo server.
To see your's instance path go to Control Panel in Zope Management
Interface.

After copying restart Zope and in ZMI go to ControlPanel/Products and
see if your product is there and if it is not broken. You may also check
event.log of your instance if something goes wrong.

-- 
Maciej Wisniowski
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Iteration Over Non-sequence

2007-03-08 Thread Maciej Wisniowski
 but it throws this error which ends with Iteration over non-sequence.
 Well, the folder from which it's supposed to select a
 quote holds nothing but a sequential number
 of page templates (named 1, 2, 3...).
 What am I doing wrong?
Possibly you're reading your error traceback wrong way.
It says about:
Expression: standard:'here/en-us/quotes/?number/macros/quote'

and there is nothing about
global number here/quotes/randomNumber

So check first if you're looking in the right place.

-- 
Maciej Wisniowski
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] can not install ZMySQLDA

2007-03-08 Thread Maciej Wisniowski
Send your emails also to the zope list, please.

There were questions about this recently (not sure if it was here
or on Zope3s list.

Message says that you have to set proper permissions to the .pyton-eggs
folder, so just do it (give write access to everybody or something like
that).

-- 
Maciej Wisniowski

 Hi,
 
 The contorl panel showed as following:
  Zope Version
 (Zope 2.9.6-final, python 2.4.4, linux2)
 Python Version
 2.4.4 (#1, Mar 5 2007, 20:29:49) [GCC 3.4.6 20060404 (Red Hat 3.4.6-3)]
 System Platform
 linux2
 SOFTWARE_HOME
 /opt/Plone-2.5.2/lib/python
 ZOPE_HOME
 /opt/Plone-2.5.2
 INSTANCE_HOME
 /opt/Plone-2.5.2/zeocluster/client1
 CLIENT_HOME
 /opt/Plone-2.5.2/zeocluster/client1/var
 Network Services
 ZServer.HTTPServer.zhttp_server (Port: 8080)
 
 Process Id
 4060 (-1277957200)
 Running For
 14 hours 44 min 36 sec
 
 
 Path of my installed ZMySQLDA is:
 
 client1]# ls -las /opt/Plone-2.5.2/zeocluster/client1/Products/ZMySQLDA
 total 196
 8 drwxr-xr-x   4 plone wheel  4096 Mar  7 22:28 .
 8 drwxrwxr-x  50 plone root   4096 Mar  7 15:01 ..
 8 -rw-r--r--   1 plone wheel   397 Mar  7 15:01 browse.dtml
 8 -rw-r--r--   1 plone wheel  1756 Mar  7 15:01 CHANGES.txt
 8 -rw-r--r--   1 plone wheel  2451 Mar  7 15:01 connectionAdd.dtml
 8 -rw-r--r--   1 plone wheel  1310 Mar  7 15:01 connectionEdit.dtml
 16 -rwxr-xr-x   1 plone wheel  8804 Mar  7 15:01 DABase.py
 12 -rw-r--r--   1 root  root   6643 Mar  7 22:28 DABase.pyc
 12 -rw-r--r--   1 plone wheel  6090 Mar  7 15:01 DA.py
 8 -rw-r--r--   1 plone plone  3169 Mar  7 15:03 DA.pyc
 16 -rw-r--r--   1 plone wheel 11946 Mar  7 15:01 db.py
 16 -rw-r--r--   1 plone plone  8640 Mar  7 15:03 db.pyc
 8 -rw-r--r--   1 plone wheel45 Mar  7 15:01 DEPENDENCIES.txt
 8 drwxr-xr-x   2 plone wheel  4096 Mar  7 15:01 help
 8 drwxr-xr-x   2 plone wheel  4096 Mar  7 15:01 icons
 12 -rw-r--r--   1 plone wheel  4351 Mar  7 15:01 __init__.py
 8 -rw-r--r--   1 plone plone   906 Mar  7 15:03 __init__.pyc
 8 -rw-r--r--   1 plone wheel  1220 Mar  7 15:01 README.txt
 8 -rw-r--r--   1 plone wheel   202 Mar  7 15:01 table_info.dtml
 8 -rw-r--r--   1 plone wheel15 Mar  7 15:01 VERSION.txt
 [EMAIL PROTECTED] client1]#
 
 
 The event.log has an erro :
 
 2007-03-08T13:40:57 ERROR Zope Couldn't install ZMySQLDA
 Traceback (most recent call last):
  File /opt/Plone-2.5.2/lib/python/OFS/Application.py, line 755, in
 install_product
global_dict, global_dict, silly)
  File /opt/Plone-2.5.2/zeocluster/client1/Products/ZMySQLDA/__init__.py,
 line 91, in ?
import DA
  File /opt/Plone-2.5.2/zeocluster/client1/Products/ZMySQLDA/DA.py, line
 92, in ?
from db import DB
  File /opt/Plone-2.5.2/zeocluster/client1/Products/ZMySQLDA/db.py, line
 89, in ?
import _mysql
  File build/bdist.linux-i686/egg/_mysql.py, line 7, in ?
  File build/bdist.linux-i686/egg/_mysql.py, line 4, in __bootstrap__
  File /opt/Plone-2.5.2/Python-2.4.4
 /lib/python2.4/site-packages/setuptools-0.6c5-py2.4.egg/pkg_resources.py,
 line 799, in resource_filename
return get_provider(package_or_requirement).get_resource_filename(
  File /opt/Plone-2.5.2/Python-2.4.4
 /lib/python2.4/site-packages/setuptools-0.6c5-py2.4.egg/pkg_resources.py,
 line 1228, in get_resource_filename
self._extract_resource(manager, self._eager_to_zip(name))
  File /opt/Plone-2.5.2/Python-2.4.4
 /lib/python2.4/site-packages/setuptools-0.6c5-py2.4.egg/pkg_resources.py,
 line 1249, in _extract_resource
real_path = manager.get_cache_path(
  File /opt/Plone-2.5.2/Python-2.4.4
 /lib/python2.4/site-packages/setuptools-0.6c5-py2.4.egg/pkg_resources.py,
 line 880, in get_cache_path
self.extraction_error()
  File /opt/Plone-2.5.2/Python-2.4.4
 /lib/python2.4/site-packages/setuptools-0.6c5-py2.4.egg/pkg_resources.py,
 line 846, in extraction_error
raise err
 ExtractionError: Can't extract file(s) to egg cache
 
 The following error occurred while trying to extract file(s) to the Python
 egg
 cache:
 
  [Errno 13] Permission denied: '/home/zope/.python-eggs'
 
 The Python egg cache directory is currently set to:
 
  /home/zope/.python-eggs
 
 Perhaps your account does not have write access to this directory?  You can
 change the cache directory by setting the PYTHON_EGG_CACHE environment
 
 How can I correct it ? Thanks.
 
 - J
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] can not install ZMySQLDA

2007-03-08 Thread Maciej Wisniowski

 I already change the permission.
 8 drwxrwxrwx   4 zope zope  4096 Mar  7 22:13 .python-eggs

 The result is the same. I completely lost?
And what with /home/zope permissions?

You may also try to set PYTHON_EGG_CACHE variable to a 
different folder. 
I've never had such problems so I can't help too much.
Try to search the web for this problem, you'll possibly
find something.

-- 
Maciej Wisniowski

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Download Large Files in Zope

2007-03-07 Thread Maciej Wisniowski

 Large files aren't store in ZODB but in a shared folder connected with
 LOCALFS. Maybe Zope load a file in zodb before begin the download?
 (Are there other storage product that work only in zope - without plone?)
 Tramline is an Apache add-on but my problem still remain without
 Apache so this product can help me after  I resolved the Zope issue.
I think that if you'll use tramline you'll have no 'Zope issue' anymore.

-- 
Maciej Wisniowski
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Download Large Files in Zope

2007-03-07 Thread Maciej Wisniowski

 Looking LocalFS specs I find the issue:

 This version of LocalFS takes advantanges of Zope 2.7.1
 http://www.zope.org/Members/hewei/zoperpms/zope2.7 's new
 /filestream_iterator/ feature and is believed to server large files
 better than before. However, my initial testing showed that *it still
 doesn't prevent the whole file being loaded into memory*. When I
 opened a URL pointing to a mpg file served by LocalFS, the file was
 loaded into memory and then immediately freeed twice.

 I think that's the problem... load 300Mb into memory Maybe I look
 for other fs products.
AFAIK it uses tempfile for serving such files. This allows
Zope resources to be not blocked while returning big
amounts of data. Although creation of tempfile or something
like that (I'm not sure how this works in details) may still be slow.

In general serving static files is best done by servers like Apache and
I think this shouldn't be done by application server like Zope (possibly
until it has blobs support).

I don't understand why you can't use tramline. It may be connected
with zope easily. It gives you very fast filesystem storage. Even more,
seems for me that it is designed to do exacly what you're asking for.
You say that tramline may help you after resolving zope issues, but I don't
get it... By using tramline you will have no files in Zope (ZODB or LocalFS)
so you will have no problem to eliminate. But maybe I missed something
in your's use case.

-- 
Maciej Wisniowski
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Download Large Files in Zope

2007-03-07 Thread Maciej Wisniowski

 I want to use localfs instead of Apache becouse:
 1) upload is done by web too
tramline supports uploads and downloads

 2) upload/download operations cause db operation (files names and
 descriptions are stored in sql server)
With tramline: The only thing the appserver sees is a unique identifier
of the uploaded file.
I don't know whether it is a file name, but seems that while
uploading/downloading you
may do some writes into db.

Good luck!

-- 
Maciej Wisniowski
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Download Large Files in Zope

2007-03-07 Thread Maciej Wisniowski

 I don't understand your paste.
 I'll try to describe better my situation

 - server A with Apache(80) and a rewrite rule to Zope(8080)
 - server B with a shared folder storage - *without any webserver*
 - server C with MS SQL Server - *without any webserver* - connected
 with ZODBC
 - firewall that send any incoming connection for www.mydomain.it to
 server A when protocol is http or https
 - in every server is active a ZOPEUSER (local administrator) with the
 same password.

 An incoming request to download will cause:
 - server A ask server C for filename
 - server A ask server B for file (using LocalFS object that stay in
 ZODB linked to server B's shared folder)

 I really can't understand how implement the same process using Apache
 for file storage.
Please stay on zope list too!

I've never used tramline, but after reading
short description on their page seems that you'll have simpler
configuration:
 - server A with Apache(and tramline) and a rewrite rule to Zope(8080)
 - server C with MS SQL Server - *without any webserver* - connected
with ZODBC
 - firewall that send any incoming connection for www.mydomain.it to
server A when protocol is http or https

In general seems that instead of real, large files, app server receives
only small
files that contain only unique identifiers of these real ones. Real
files are handled
by tramline and stored in specific filesystem folders.

When someone requests a file for download, application server sets
special header that
contains unique file identifier and this causes that tramline will
return real, big file to the
browser.

Upload similarly uses headers to allow or disallow uploading.

-- 
Maciej Wisniowski
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] database connection in script

2007-03-07 Thread Maciej Wisniowski
 how to create a database connection in a script python
This is your third (or more) thread about this during few hours!
Ask a specific questions and be patient please.

In general seems that you have no idea how it all works.

So my advice is:
1. Read abour basics of relational database connectivity in zope
2. Go to your portal folder via ZMI and create database
connection to your RDBMS
3. Still in ZMI create ZSQLMethods you need
4. In your product just call these ZSQLMethods via their id's like
result = self.mymethod1()


If this works then you may:
1. Change addform of your product to be able
to select specific database connection from the list
of available connections. Your product won't have
hardcoded connection id.
2. Create ZSQLMethods in your product as typical objects.

Instead of using ZSQLMethods you may use:

context.db_conn_id.db.query('YOUR QUERY HERE')

as Robert Rottermann suggested.

-- 
Maciej Wisniowski
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Download Large Files in Zope

2007-03-07 Thread Maciej Wisniowski

 Sorry, I push the wrong button when I reply

 I'll try your configuration, but
 - where are files stored? (I dont't see server B in your post)
Read http://www.infrae.com/products/tramline
There is description where files are stored

 - it seems I'll lose Zope User Restrictions
Possibly not. This is application server that decides if user
is allowed to upload/download file (by setting proper headers).

-- 
Maciej Wisniowski

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope-DB] form-controllerPythonScript-ZSQL

2007-03-07 Thread Maciej Wisniowski

 zsql:
 how to do it
Have you read 'Relational database connectivity' chapter of Zope Book?

-- 
Maciej Wisniowski
___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


Re: [Zope] Download Large Files in Zope

2007-03-06 Thread Maciej Wisniowski
 I've just installed Zope 2.8 with Apache 2 and I made a download library (a 
 CMS site is too much for me and I can't find a simple download area 
 product, so I've done it!)
What about railorad: http://www.infrae.com/products/railroad

 How can i manage downloads  uploads?
In general it is bad idea to hold and serve large files directly from
ZODB. This should be done by Apache etc.

-- 
Maciej Wisniowski
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Download Large Files in Zope

2007-03-06 Thread Maciej Wisniowski
 What about railorad: http://www.infrae.com/products/railroad
I meant tramline: http://www.infrae.com/products/tramline

-- 
Maciej Wisniowski
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Resizing Images In Page Templates

2007-03-04 Thread Maciej Wisniowski

 Hmm. I have it working on the server from which 
 I am moving to another server. I didn't build the code.
 But it sure does work just fine.
 Sorry. Not nonsense. Anyone else have any ideas?
Ehm... but this code is a nonsense or rather, you made
a mistake when you've written previous e-mail

img src=myimage.jpg/resize /

It is plain html.

something like:

img tal:attributes=src myimage.jpg/resize /

may do something 'dynamic'.

-- 
Maciej Wisniowski

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Re: ImportError: cannot import name base_hasattr

2007-03-04 Thread Maciej Wisniowski
 Take a look at pathes in your traceback:

 /usr/local/www/zope/278/lib/python
 /usr/local/zope/278/lib/python

 /usr/local/zope/instance1/Products

 Why there are two different(!) lib/python/ folders?
 I see the problem! And I know what caused it. So I rebuilt Zope from source 
 and tried again. Unfortunately, I got the same_darn_error, just without the 
 www dir:
In general it still seems to me that you have two
...Products/CMFPlone/utils.py in your system.
Try to search your filesystem for utils.py.

Have you tried debugging via zopectl like
I suggested in previous email?

-- 
Maciej Wisniowski
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Resizing Images In Page Templates

2007-03-04 Thread Maciej Wisniowski

 Hmm. I have it working on the server from which 
 I am moving to another server. I didn't build the code.
 But it sure does work just fine.
 Sorry. Not nonsense. Anyone else have any ideas?
 Ehm... but this code is a nonsense or rather, you made
 a mistake when you've written previous e-mail
 
 img src=myimage.jpg/resize /
OK, I thinked again about this. This may work :)
You may have object with id 'myimage.jpg' with resize
method, and it may be referenced this 'hardcoced' way.


-- 
Maciej Wisniowski
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Re: ImportError: cannot import name base_hasattr

2007-02-28 Thread Maciej Wisniowski
 from Products.CMFPlone.utils import base_hasattr
 ImportError: cannot import name base_hasattr
 
 CMFPlone/utils.py has a class named base_hasattr, so what's the problem?
You might try this (I'm not sure if this works with Zope 2.7):

run /usr/local/zope/instance1/bin/zopectl

on zopectl prompt enter:

zopectl debug

and when you'll see python prompt write:

 import Products.CMFPlone
 print Products.CMFPlone
module 'Products.CMFPlone' from
'/opt/Zope/instancje/Zope296/Products/CMFPlone/__init__.pyc'

and check what path you have there.

-- 
Maciej Wisniowski
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Re: Exporting portal member data to csv

2007-02-27 Thread Maciej Wisniowski

 * Module ZPublisher.Publish, line 115, in publish
 * Module ZPublisher.mapply, line 88, in mapply
 * Module ZPublisher.Publish, line 41, in call_object
 * Module Products.ExternalMethod.ExternalMethod, line 225, in __call__
   __traceback_info__: ((Application at ,), {}, None)
 * Module C:\Program Files\Plone 2\Data\Extensions\export.py, line
   15, in createcsv

What code do you have in export.py, especially what is in line 15?

-- 
Maciej Wisniowski
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Large jumps of memory use increase, and seeking overall understanding of memory use

2007-02-25 Thread Maciej Wisniowski
I've not seen whole thread so sorry if I missed something.

 there were requests for our
 front page and apparently everything that accompanies it in Plone,
 i.e. the Plone scripts.jss, the style sheets, bunch of icon gifs,
 image thumbs the logo.jpg, etc. 
Maybe this is your specific configuration for tests, or something that
you are aware of (if so then sorry for telling you something obvious)
but in general things like css, js, images should be cached and not
served (always) directly by Zope/Plone instance. Properly
set up caching is a incredible performance boost. If you have no
caching then serving all this stuff from zope may also cause bigger RAM
usage as all these objects are read into memory by Zope when they're
'touched'.

-- 
Maciej Wisniowski
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Large jumps of memory use increase, and seeking overall understanding of memory use

2007-02-25 Thread Maciej Wisniowski
 Serving from cache still means they need to be touched at least once to
 get them into the cache, and (in case of normal caching behavior) they
 will be touched again once the cached record expires. 
Yes, right. I tried to write this with 'always':
not served (always) directly by Zope/Plone instance :)

 Caching will not
 make any difference to memory behavior I'd say.
I'm not expert here, so I might be wrong but AFAIK
Zope instance loads 'touched' objects from ZODB into cache.
Each ZODB connection has its own cache, so having object
touched more than once may cause it is loaded to more than one
cache.

The same will possibly be with multiple ZEO clients. External
cache will save them from being touched (sometimes even once).

ZODB connections cache is cleaned sometimes, so it should
flush objects that are old and possibly save some memory then.

I don't know whether amount of memory used because of above is huge
enough to cause described problem. It's just a though.

Feel free to correct me if I'm wrong.

-- 
Maciej Wisniowski



___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Large jumps of memory use increase, and seeking overall understanding of memory use

2007-02-25 Thread Maciej Wisniowski
 Now I will again admit to some overall experience, with even HTTP, so
 correct me if I'm wrong: Without squid, I can either cache objects in
 a Zope memory cache or in browser caches using headers (that's part of
 what CacheFu helps to configure). However, neither of those prevents
 Zope from entirely stopping to get requests for cached content. For
 memory cached content, it will just be served faster and without
 requiring to access the ZODB, but it will look the same in the access
 log, and for browser cached content, everything will still have to be
 loaded every time a browser is opened anew or when a force reload is
 requested.
 
 Once Squid is up, then I do expect to see a lot fewer requests to Zope.
 
 Am I missing something major here?
For me, you're absolutely right.
I didn't mean to stop Zope from getting any requests. I just wonder
if repeadetly touching a big amount of objects (css, js, images)
may cause consuming a big amount of memory.

 P.S. Just so you guys don't think that I am a complete newby, I did
 realize for example that I needed to add some templates by hand to a
 CacheFu rule, to what was being cached by default, to account for the
 Composite Page Plone product I am using (the templates for the
 slots were not being cached and caused significant performance
 issues).
I said sorry if I'm telling something obvious :)

-- 
Maciej Wisniowski
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Large jumps of memory use increase, and seeking overall understanding of memory use

2007-02-25 Thread Maciej Wisniowski
 This is a bit like clutching at straws. You're doctoring the symptoms,
 hoping that some things may not be loaded into memory. It's not a real
 solution. Memory-hungry applications will remain memory-hungry, cached
 or not.
I'm just trying to do something, just like Jean does. You're convincing
us that we have to live with Plone's memory appetite and that only
reasonable optimization is to buy more memory? Sometimes this is not
a solution, but maybe your'e right. I don't know this side of Plone
(yet :) ).

One more thing. There is a setting in zope.conf that says about
cache size. It is used with ZEO setups. Maybe it is worth looking at
how big value it is set to.

-- 
Maciej Wisniowski
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope-DB] How to export data from ZODB to MYSQL

2007-02-25 Thread Maciej Wisniowski
 I am a newbie in Zope. Now I am looking for the ways to export data from ZODB 
 to MYSQL. 
 please do me a favor.
What is your use case? In general there are two possibilities:
1. You want to use standard relational database connectivity mechanisms
like described in zope book (look at relational database connectivity
at http://www.plope.com/Books/2_7Edition/)

2. You want to use MySQL instead of ZODB (alternative storage)

So, what do you want to do?

-- 
Maciej Wisniowski

___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


  1   2   3   >