Re: [Zope] use path function on a python script

2008-10-11 Thread Dieter Maurer
Garito wrote at 2008-10-11 16:39 +0200:
>Did you imagine another way to do what I need to do?

I have not followed intensively "what you need to do".
Thus, what follows may not be adequate.

When I remember right, then a PageTemplate's namespace is passed
on to a "Script (Python)" when this script binds "namespace".
Thus, this way you get access to the variables defined in the template.

A simple path "var/s1/.../sn" is roughly requivalent to

  x = var.restricedTraverse("s1/.../sn")
  if callable(x): x = x() # "callable" may not be available in "Script (Python)"

If the path contains "?var", these must be resolved beforehand.

More complex paths "p1 | p2 | ... pn" are roughly equivalent
to

exc = None
for p in (p1, p2, ... pn):
  try: return path1(p, ...)
  except :
exc = sys.exc_info()
if exc is not None: raise exc[0], exc[1], exc[2]

The most difficult part are for paths where "pn" is not a path
expression but an arbitrary one. In this case, the concrete
TALES implementation will be required for an interpretation.


Along this outline, a function "path(path_expr, variable_binding)"
can be defined which roughly behaves like "path(path_expr)" in
a PageTemplate with the current variable binding expressed
as "variable_binding".

For simple cases, this function could be implemented in untrusted
code. Complex cases will require access to the TALES implementation
and therefore probably trusted code.



-- 
Dieter
___
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] [Off-Topic] KSS ugly? (was: Re: use path function on a python script)

2008-10-11 Thread Dieter Maurer
Garito wrote at 2008-10-11 16:37 +0200:
>In my country, Spain, there are a very high difference between the price it
>cost a tomato when you buy it to the farmer that if you buy it on the store.
>Why? Because of the intermediaries

Sure. But sometimes intermediaries are helpful.

I, e.g., would be unable to buy spanish tomatoes (or strawberries)
in Germany without intermediaries.

>In my opinion KSS is an intermediary who raises the work that the computer
>needs to do to retrieve a response and more if we put the non intrusive
>javascript techniques on the table
>
>Sorry but I love minimalism and KSS is anything but minimalism

Sure, intermediaries have a price -- but often, they also add value.

KSS, e.g., allows you to update individual portlets or menues
without reloading the complete page. This may reduce the work
computers must do. This can be done with other (JS-based) techniques
as well. However in addition, KSS handles the case with/without JS
in a transparent way.
As my colleagues intensively fight (and put much work into it)
with our requirment "must work with and without JS",
I find this quite attractive.



-- 
Dieter
___
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] [Off-Topic] KSS ugly?

2008-10-11 Thread Dieter Maurer
Andreas Jung wrote at 2008-10-11 06:05 -0400:
>On 11.10.2008 2:21 Uhr, Dieter Maurer wrote:
>> Garito wrote at 2008-10-8 14:22 +0200:
>>> I'm agree with you, Tino. Plone has a lot of ugly features (as KSS, for
>>> instance)
>>
>> Why is KSS ugly?
>> Reading the documentation, I found it quite attractive
>
>You know, there is this difference between theory and practise :-)


I know the theory about this and would be interested in the concrete
practise concerning KSS.

Or more precisely: what makes KSS ugly in practise?



-- 
Dieter
___
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] Old zope instance migration to Ubuntu 8.04?

2008-10-11 Thread Mike Elliott
Hi -

I have an old instance of Zope - I'm not sure just how old but at
least four years (maybe six or seven, I don't know) - which has been
running on a server which is now no longer functional.  I'd like to
migrate to a new server running Ubuntu 8.04.1 but the old code doesn't
run anymore.

I have a full backup of the system and would be quite content to get
it running under the current Ubuntu zope distribution on the new
server but would like some advice as to how best to proceed.   Simply
putting the existing zope directory structure on the new machine and
trying to start it up no longer works - presumably due to differences
in Python versions - but I don't actually know that.

 I have a high school field hockey team, an Indian Princess group and
a couple of other groups with Plone sites on the old server and they'd
like to see their stuff again.

Any suggestions as to the best way to handle this?

Cheers --
___
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] howto talk to a zodb while zope is running

2008-10-11 Thread Paul Gevers
Hi,

I maintain several websites where we rely heavily on file-system files
to serve images and movies. We have a user interface in Zope to manage
the files, based on the "external file" product. Users can upload files
via webdav to the filesystem and I am synchronizing Zope by using
inotify (Linux OS kernel tool that triggers on changes on the file
system). At the moment I use a http request to the localhost to tell
Zope that the filesystem has changed, but when a lot of files are
created in a short time the updating is too slow.

Is there a faster way to talk to the zope database than via a http
request while zope is running? I tried to find something useful on the
net, but was buried in too many pages which are not really relevant.

With kind regards,
Paul
___
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] [Off-Topic] KSS ugly?

2008-10-11 Thread Andreas Jung

On 11.10.2008 10:37 Uhr, Garito wrote:

In my country, Spain, there are a very high difference between the price
it cost a tomato when you buy it to the farmer that if you buy it on the
store. Why? Because of the intermediaries

In my opinion KSS is an intermediary who raises the work that the
computer needs to do to retrieve a response and more if we put the non
intrusive javascript techniques on the table

Sorry but I love minimalism and KSS is anything but minimalism


I think the issue with loving or hating KSS is basically a matter of 
personal preferences and personal programming style.


-aj
begin:vcard
fn:Andreas Jung
n:Jung;Andreas
org:ZOPYX Ltd. & Co. KG
adr;quoted-printable:;;Charlottenstr. 37/1;T=C3=BCbingen;;72070;Germany
email;internet:[EMAIL PROTECTED]
title:CEO
tel;work:+49-7071-793376
tel;fax:+49-7071-7936840
tel;home:+49-7071-793257
x-mozilla-html:FALSE
url:www.zopyx.com
version:2.1
end:vcard

___
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] use path function on a python script

2008-10-11 Thread Garito
Did you imagine another way to do what I need to do?



2008/10/11 Dieter Maurer <[EMAIL PROTECTED]>

> Garito wrote at 2008-10-8 10:46 +0200:
> >How can I import the TALES funcion path on a python script?
>
> You cannot -- while it looks like a normal function, it not really is one.
>
> "path" gets a string but interprets this string with knowledge
> about the template's namespace. This shows you that some magic
> must be in the background that provides the template namespace
> to whatever implements "path".
> This magic is unavailable in a "Script Python".
>
>
> In fact, the "path" handling is prepared in
> "Products.PageTemplates.PythonExpr.PythonExpr._bind_used_names"
> by the following code:
>
>for vname in self._f_varnames:
>val = vars.get(vname, _marker)
>if val is _marker:
>has = val = getType(vname)
>if has:
>val = ExprTypeProxy(vname, val, econtext)
>names[vname] = val
>
> The last two lines bind "path" to
> "ExprTypeProxy('path', val, econtext)".
> This is what comes nearest to "the TALES function path".
> As you can see, it is not a simple function but one provided with lots of
> context information (behind the scenes).
> The "econtext" contains the template's namespace.
>
>
>
> --
> Dieter
>



-- 
Mis Cosas
http://blogs.sistes.net/Garito
Zope Smart Manager
http://blogs.sistes.net/Garito/670
___
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] [Off-Topic] KSS ugly? (was: Re: use path function on a python script)

2008-10-11 Thread Garito
In my country, Spain, there are a very high difference between the price it
cost a tomato when you buy it to the farmer that if you buy it on the store.
Why? Because of the intermediaries

In my opinion KSS is an intermediary who raises the work that the computer
needs to do to retrieve a response and more if we put the non intrusive
javascript techniques on the table

Sorry but I love minimalism and KSS is anything but minimalism

2008/10/11 Dieter Maurer <[EMAIL PROTECTED]>

> Garito wrote at 2008-10-8 14:22 +0200:
> >I'm agree with you, Tino. Plone has a lot of ugly features (as KSS, for
> >instance)
>
> Why is KSS ugly?
> Reading the documentation, I found it quite attractive
>
>
>
> --
> Dieter
>



-- 
Mis Cosas
http://blogs.sistes.net/Garito
Zope Smart Manager
http://blogs.sistes.net/Garito/670
___
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] webdav upload - controlling type, hook

2008-10-11 Thread Jakob Schou Jensen
Thanks Tres,

The PUT_factory works fine for controlling the upload type. In addition to
this I need a hook that gets called whenever a document is created OR
updated (the put_factory is only called on creation). I need this hook to
update some derived/cached data. Is there any way to do this?

Jakob

2008/9/25 Tres Seaver <[EMAIL PROTECTED]>

>
>
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> Jakob Schou Jensen wrote:
> > When uploading a file to the zope db using the webdav interface zope
> select
> > on object type based on the file contents (or extension?). For instance
> when
> > I upload a html file it becomes a DTML document. Is there any way to
> control
> > what type of object is selected?
> >
> > Additionally I would like to execute some script code after a webdav
> upload.
> > Is there any way to get a hook or callback or something similar?
>
> You need to implement the 'PUT_factory' hook for your container:
>
>  http://wiki.zope.org/zope2/PUTFactory
>
>
> Tres.
> - --
> ===
> Tres Seaver  +1 540-429-0999  [EMAIL PROTECTED]
> Palladion Software   "Excellence by Design"http://palladion.com
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.6 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFI2+lV+gerLs4ltQ4RAkEAAJ9vdWXskaVEB4IJAjFnxJc9HQ7K8ACgiCBy
> 7oWAtfQCkvyVKHfQ3B6NQzA=
> =uAf+
> -END PGP SIGNATURE-
>
>
___
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] [Off-Topic] KSS ugly?

2008-10-11 Thread Andreas Jung

On 11.10.2008 2:21 Uhr, Dieter Maurer wrote:

Garito wrote at 2008-10-8 14:22 +0200:

I'm agree with you, Tino. Plone has a lot of ugly features (as KSS, for
instance)


Why is KSS ugly?
Reading the documentation, I found it quite attractive


You know, there is this difference between theory and practise :-)

-aj
begin:vcard
fn:Andreas Jung
n:Jung;Andreas
org:ZOPYX Ltd. & Co. KG
adr;quoted-printable:;;Charlottenstr. 37/1;T=C3=BCbingen;;72070;Germany
email;internet:[EMAIL PROTECTED]
title:CEO
tel;work:+49-7071-793376
tel;fax:+49-7071-7936840
tel;home:+49-7071-793257
x-mozilla-html:FALSE
url:www.zopyx.com
version:2.1
end:vcard

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

2008-10-11 Thread Dieter Maurer
Nico Grubert wrote at 2008-10-9 10:17 +0200:
> ...
>> If your system gets slow but still occasionally responds, you can
>> use "ZopeProfiler" to find out, where the time is spend.
>> Ensure to use "real time" as the timer (not cpu time).
>
>Hi Dieter
>
>thank you very much for the information.
>
>This morning the server did not respond and all 8 threads in the 
>DeadlockDebugger's output look the same:
>
>Thread 1098918208
> ...
>   File "/zope/intranet/Products/LDAPUserFolder/LDAPUserFolder.py", line 
>1846, in _misc_cache
> return getResource('%s-misc_cache' % self._hash, SharedObject, ())
>   File "/zope/intranet/Products/LDAPUserFolder/SharedResource.py", line 
>50, in getResource
> _ResourceLock.release()

Your tracebacks really look strange: they almost all seem
to come from the release of looks.

Now, releasing a lock is a very fast operation.
An independent observer should rarely see the system in such
a state. That you see it there so often indicates that your
observer ("DeadlockDebugger") is not independent (we already knew that)
but in addition gets seriously confused -- thus, that we cannot trust
its observations when analysing the problem at hand.


You need to use a different observer.

As already written: if your Zope does not hang completely, "ZopeProfiler"
may be such an observer. It, too, is not independent, but different
things confuse it. Thus, we some luck, it may reveal the cause of
the current problems.

If your Zope hangs completely, then things get a bit more difficult.
You must attach the Zope process with a C level debugger. This
observer will not get confused by the Python GIL and is able
to observe threads that hold the GIL during long periods of time.
Unfortunately, quite a bit of preconditions must be met and
the analysis requires lots of knowledge about Python internas.
Therefore, I hope that you do not need an observer of this kind.



-- 
Dieter
___
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] use path function on a python script

2008-10-11 Thread Dieter Maurer
Garito wrote at 2008-10-8 10:46 +0200:
>How can I import the TALES funcion path on a python script?

You cannot -- while it looks like a normal function, it not really is one.

"path" gets a string but interprets this string with knowledge
about the template's namespace. This shows you that some magic
must be in the background that provides the template namespace
to whatever implements "path".
This magic is unavailable in a "Script Python".


In fact, the "path" handling is prepared in
"Products.PageTemplates.PythonExpr.PythonExpr._bind_used_names"
by the following code:

for vname in self._f_varnames:
val = vars.get(vname, _marker)
if val is _marker:
has = val = getType(vname)
if has:
val = ExprTypeProxy(vname, val, econtext)
names[vname] = val

The last two lines bind "path" to
"ExprTypeProxy('path', val, econtext)".
This is what comes nearest to "the TALES function path".
As you can see, it is not a simple function but one provided with lots of
context information (behind the scenes).
The "econtext" contains the template's namespace.



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