Re: [Zope] ZEO manageUndo not working - DisconnectedError

2015-05-06 Thread Tino Wildenhain


Hi Sebastian,

Am 06.05.2015 um 15:26 schrieb Sebastian Tänzer:
> After further testing I was able to sort this one out by downgrading 
ZopeUndo to 2.12.0 (pip install ZopeUndo==2.12.0 --force —upgrade).
> PyPi only said 4.0 brought Py3 compability. Should I expect any 
problems using ZopeUndo 2.12 + ZEO/ZODB4/ZODB3 with their latest versions?

>

Undo has long been a standard functionality in Zope2 but proven to be
quite dangerous as it is possible to totally mess up your object
tree.

IIRC undo has therefore been removed even from the ZODB - that is
what you are experiencing with the current version.

What seems to work quite well is to enable history support where you
have access to every old transaction and can compare or copy them
to be on top of the stack - which avoids the problem with disappearing
transactions as Undo has.

Unfortunately out of the box only a few Products have history support
enabled. Some monkey patching can enable it for many of the other
Products of stock Zope2. ObjectManager/Folder is a bit limited
since accessing a whole historic version of a subtree can't be done
easily. However, if you are interested and want to try:

http://old.zope.org/Members/tino/PatchHistory/view

(very old, but seems to work with the 2.12 at least)

Best,
Tino


Best, Sebastian



___
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] sending a encrypted login URL

2009-03-04 Thread Tino Wildenhain

Andreas Jung wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Use SSL and you're done.


SSL solves SSO? I don't think so.

Cheers
Tino


- -aj

On 04.03.2009 17:29 Uhr, Joseph Thomas (s) wrote:

We’d like to construct a zope login URL of the form on another server:

 


http://zope.domain:port/context/logged_in?__ac_name=uzz&__ac_password=xxx&submit=Log+in


 

 


where the ac_name and ac_password parameters are encrypted using zope
public key (?) and have the parameters decrypted when zope receives the
request and login the user.

 


Is there an API or some way to encrypt the username and password on the
3^rd party app server and configure zope so that it treats the
parameters as encrypted values rather than plaintext?

 


Joseph Thomas

College of American Pathologists

http://www.cap.org 

 





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



- -- 
ZOPYX Ltd. & Co. KG - Charlottenstr. 37/1 - 72070 Tübingen - Germany

Web: www.zopyx.com - Email: i...@zopyx.com - Phone +49 - 7071 - 793376
Registergericht: Amtsgericht Stuttgart, Handelsregister A 381535
Geschäftsführer/Gesellschafter: ZOPYX Limited, Birmingham, UK
- 
E-Publishing, Python, Zope & Plone development, Consulting

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkmurnAACgkQCJIWIbr9KYylKQCgn3WWP5SzGrrAQbJIQXv7Bfac
3fwAoIiI4iwtVBFVRg7jtZu5Vgy5fw3f
=MHol
-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 )





smime.p7s
Description: S/MIME Cryptographic 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] getProperty title and id

2008-10-15 Thread Tino Wildenhain

Tino Wildenhain wrote:

Hamzat Kamal wrote:

Hi,

I just want to why  will display 
the object title and and  will 
dispaly none.


apart from the fact that you probably should start using TAL instead of 
DTML,









Did you look at the resulting output? Not the HTML rendered
in the browser but the source - "view source" in the browser.



Ah sorry. yes id is not a property but an attribute of xx.

So instead of xx.getProperty("id") you'd use xx.id

Regards
TIno


smime.p7s
Description: S/MIME Cryptographic 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] getProperty title and id

2008-10-15 Thread Tino Wildenhain

Hamzat Kamal wrote:

Hi,

I just want to why  will display the 
object title and and  will dispaly none.


apart from the fact that you probably should start using TAL instead of 
DTML,









Did you look at the resulting output? Not the HTML rendered
in the browser but the source - "view source" in the browser.

Regards
Tino


smime.p7s
Description: S/MIME Cryptographic 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] use path function on a python script

2008-10-08 Thread Tino Wildenhain

Garito wrote:



2008/10/8 Tino Wildenhain <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>

Garito wrote:

Perhaps is better if I explain you what I'm trying to do

Imagine a Plone site (I know there are a plone list but this is
a generic question, sorry if not)

I configure it in the way if you put a parameter ?print the
plone point renders as when you push the print button at the
bottom of the point

For example: plone_site_url/front-page?print renders the plone
front page with the print.css sytle

Now I want to get the rendered code of this point as string to
pass it to PDFNode.renderAsPdf (it expect a string with the HTML
and the name of the generated pdf)

Did you know how can I get the html code of an url with get
parameters?


just context['front-page'](print=True) ?


Perhaps but this puts print on options/args/print or options/print in 
the page_template scope, isn't it?


In my way to solve this I use request/form/print because plone_css use 
tal expressions and request is passed to it


This would be very ugly. However in this case just set context.REQUEST
or context.REQUEST.form accordingly

HTH
Tino


smime.p7s
Description: S/MIME Cryptographic 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] use path function on a python script

2008-10-08 Thread Tino Wildenhain

Garito wrote:

Perhaps is better if I explain you what I'm trying to do

Imagine a Plone site (I know there are a plone list but this is a 
generic question, sorry if not)


I configure it in the way if you put a parameter ?print the plone point 
renders as when you push the print button at the bottom of the point


For example: plone_site_url/front-page?print renders the plone front 
page with the print.css sytle


Now I want to get the rendered code of this point as string to pass it 
to PDFNode.renderAsPdf (it expect a string with the HTML and the name of 
the generated pdf)


Did you know how can I get the html code of an url with get parameters?


just context['front-page'](print=True) ?

or something? (Am I the only one which does not see value in a print
button because there is CSS to make this happen without server
interaction? )

Regards
Tino


smime.p7s
Description: S/MIME Cryptographic 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] delete a variable from REQUEST

2008-09-30 Thread Tino Wildenhain

Hi,

indrajit926 indra wrote:

Hi,

thanks for ur reply.

My problem is, my code is like

#code code code

if REQUEST['usr_msg']:
  do some operations.
 
#some code related to project


my program control loops with above " if condition".

REQUEST is in same context.

so once REQUEST stores 'usr_msg ' every time when it goes to "if 
condition " , it performs that "do some operations"


Due to above reason i want to delete that "usr_msg" variable from REQUEST


But if you would really manage to delete this from REQUEST, you
would get an exception when trying to use it in the way above.

So, see Peters solution to your problem.

also i cannot put restriction on "usr_msg" ,because it comes from user 
input, and user can give any text to that variable.


If thats some kind of filter chain you probably want to change
it to some private name space within request as you would be
comfortably getting by REQUEST.set('allmystuff',dict())
at the very beginning. You can actually look up form values
from REQUEST.form to distinguish between user input and
data from your program. If you just ask REQUEST, you get
some kind of stacking layers of name spaces where values get
looked up.

Please see the Zope book (online) for description of the API.

Regards
Tino



thanks,
Indrajit.

On Mon, Sep 29, 2008 at 1:36 PM, Tino Wildenhain <[EMAIL PROTECTED] 
<mailto:[EMAIL PROTECTED]>> wrote:


Hi,


indrajit926 indra wrote:

Hi All,

Iam relatively new to zope.

I want to delete a variable and it value from REQUEST.I used
python pop() and __delattr__() ,but getting attribute error.


Actually you can't. (Not without writing a product in filesystem
and getting deep into zope). Why would you?

What you could do is to update one of the requests namespace to
give the variable a new value.

Regards
Tino





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




smime.p7s
Description: S/MIME Cryptographic 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] delete a variable from REQUEST

2008-09-29 Thread Tino Wildenhain

Hi,

indrajit926 indra wrote:

Hi All,

Iam relatively new to zope.

I want to delete a variable and it value from REQUEST.I used python 
pop() and __delattr__() ,but getting attribute error.


Actually you can't. (Not without writing a product in filesystem
and getting deep into zope). Why would you?

What you could do is to update one of the requests namespace to
give the variable a new value.

Regards
Tino


smime.p7s
Description: S/MIME Cryptographic 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] kill user Session

2008-09-17 Thread Tino Wildenhain

vaibhav pol wrote:

Dear all,
  I create logout page in my site when user want to logout it 
will submit the page  of page submit i called "manage_zmi_logout" 
function . which promt me for again  login user name password window i 
want redirect  user to login page  but  if redirect  whiout calling 
"manage_zmi_logout" function user not actualy logout from zope is any 
other way to kill user session  please tell me.


Is there a question somewhere?

Looks like you are trying to log out a "basic auth". This is not
really possible - the protocol has nothing to support it.
What zope does is using a dirty trick - most browsers expire
sending the auth header when they get a 401 response (look up your
copy of rfc2616).

What you probably want is to use a cookie based authorization.

Did you already explore zope PAS?

Cheers
Tino


smime.p7s
Description: S/MIME Cryptographic 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] 404 on "/manage" frames with mod_rewrite

2008-08-21 Thread Tino Wildenhain

Bernard Devlin wrote:
I worked it out.  For the apache virtualhost config for 443 I changed 
the rewrite rule to this:


RewriteRule ^/zp($|/.*) http://%{SERVER_NAME}:8080/VirtualHostRoot$1 [L,P]

I probably should have included my rewrite rules in the earlier 
message.  I'm sure my mistake would have been glaringly obvious.


Since 443 is missing in your rule its pretty obviously incorrect :-)

The witch is outputting:

RewriteRule ^/zp($|/.*) \
http://127.0.0.1:8080/VirtualHostBase/https/%{SERVER_NAME}:443/VirtualHostRoot/_vh_zp$1 
[L,P]


and I feel this should work :-)

Regards
Tino


smime.p7s
Description: S/MIME Cryptographic 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] 404 on "/manage" frames with mod_rewrite

2008-08-20 Thread Tino Wildenhain

Bernard Devlin wrote:

Hi folks,

I managed to find some good information on putting zope behind apache 
and using mod_rewrite.  This appears to be working fine as long as I'm 
using a non-framed page (and it works with SSL too). 

However, when I try to access the site using 
https://mysite.com/some_zope_page it works, but if I try 
https://mysite.com/zp/manage, I'm prompted for my zope admin 
credentials, and once I submit the credentials the framed portions are 
all 404d.  When I check the url for one of the framed pages it looks 
like this: http://mysite.com:443/manage_workspace.


Maybe you double check using the witch:

http://betabug.ch/zope/witch

Regards
Tino


smime.p7s
Description: S/MIME Cryptographic 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] TALES expression

2008-07-16 Thread Tino Wildenhain

Fred Drake wrote:

On Wed, Jul 16, 2008 at 6:34 AM, Tino Wildenhain <[EMAIL PROTECTED]> wrote:

You should check the tales documentation. the pipe symbol |
means a logical "or", in effect if the left expression resolves
to "non existent", None, empty object,... (generally python False)
the right part of it is evaluated.


Not at all.

The pipe uses the left-hand operand if it is defined; a value of None
or an empty string is still a defined value.  As long as "here" can be
traversed with the name "getDataInici" then the left-hand expression
will be used.  If that traversal fails the right-hand expression will
be used instead.


Indeed :-)

Cheers
Tino


smime.p7s
Description: S/MIME Cryptographic 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] TALES expression

2008-07-16 Thread Tino Wildenhain

Garito wrote:

Hi!
Please consider this TALES expression:



If I try this other:  
the result is None


Then the first one will render the alternate expression isn't it?

Then with it renders  ?


Сто? ;-)

You should check the tales documentation. the pipe symbol |
means a logical "or", in effect if the left expression resolves
to "non existent", None, empty object,... (generally python False)
the right part of it is evaluated.

In the special case it probably is nicer to use:

nosta instead so the fallback value is part

of the template (TAL is meant to be design by example)

I would also recommend not mixing " and ' for attributes and
maybe in the long run sticking to english language names for
your objects makes it easier to ask on mailinglists.

Regards
Tino



smime.p7s
Description: S/MIME Cryptographic 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] getting post data from a webcam

2008-07-08 Thread Tino Wildenhain

William Heymann wrote:
I am trying to integrate a webcamera with a site and I can get it to POST the 
data to a certain url on the server the problem is I can't figure out how to 
get access to the data. It is not in REQUEST.form


the relevant request vars are

('CONTENT_LENGTH', '111695')
('CONTENT_TYPE', 'image/jpeg')
('HTTP_CONTENT_DISPOSITION', 'attachment; 
filename="image01-07-29_05-54-26-96.jpg"')


This is being posted to a python script object inside zope, however if I need 
to use an external method that is not a problem I just need to figure out how 
to get the data.


If the file is posted as attachment (similar to file upload) it should
appear in the relevant form element as file. You can just use the method
.read() on it to get the data (or feed it into factory of image/file)

For this to work the data needs to be sent as 
enctype="multipart/form-data" (hopefully the cam does this).


Maybe you send all variables of the request to figure out.

Regards
Tino



smime.p7s
Description: S/MIME Cryptographic 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] UTF8 encoding

2008-06-17 Thread Tino Wildenhain

Hi Garry,

Garry Saddington wrote:
I am getting a few of this type of error only coming from Windows 
machines, does anyone know how to sort this out?


ProgrammingError: ERROR: invalid byte sequence for encoding "UTF8": 0xa3 
HINT: This error can also happen if the byte sequence does not match the 
encoding expected by the server, which is controlled by 
"client_encoding". insert into departmentplanning (planningcategoryid, 
taskid, subtasks, moneval, timescale, budget, success, subjectid, 
teacherid) VALUES (1 , 186 , 'Identify suitable tasks and activities for 
all G+T pupils and students ' , 'ADE- liaise with HS and GE' , 'JUL08 
on' , 'SOme activities could be bought in ~£50' , 'All G+T pupils and 
students given opportunity for enhanced work' , 1787, 41 )


You give us very little to base our suggestions on. From what I see
it looks like you are using a RDBMS, seems to be Postgres, and
the python binding (psycopg?) reports you this exeption. It also gives
you hints about the reasons. Maybe you see if you can follow that?
IIRC, recent ZSQL-driver for postgres allow for setting the encoding,
you should use that, also setting this in the database for the
user you are connecting with should be possible if everything else fails.

In any case please try do give more details about your setup.

Cheers
Tino



smime.p7s
Description: S/MIME Cryptographic 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] display HTML files using TAL

2008-06-08 Thread Tino Wildenhain

Hi,

sujitha mary wrote:

Hi all,
I need help in displaying a set of HTML files .I have created a TAL code 


explain "display".

which stores the name of the files in a list.But i don't know how to 
pass this values.


pass to where? How does a code store anything? To where?


this is my code
here 'x' is the list that contains file names. i have uploaded the files 
as DTML document.


this  will be replaced


You want to replace  with the contents of here/x?
Why do you think you need structure or python: ?

maybe you can tell us where exactly your approach fails?

Regards
Tino


smime.p7s
Description: S/MIME Cryptographic 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] Counting the elements of a result in a ZCatalog

2008-06-05 Thread Tino Wildenhain

Hi,

Marco Bizzarri wrote:
...

if result:
  result_len = results.actual_result_count
else:
  result_len = 0

return result_len


...


Thanks for your answer, but there is something I do not understand:

if results:

an empty result from ZCatlog is false in a boolen condition?


Yes, thats standard Python behavior, empty lists, dictionaries
and similar objects are assumed "False" when used as boolean.

This means you could even write it this way:

return (results and results.actual_result_count) or 0

in python2.5 (not yet supported by Zope) even:

return results.actual_result_count if results else 0

Cheers
Tino



smime.p7s
Description: S/MIME Cryptographic 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] statistics and click analysis for a plone site

2008-06-02 Thread Tino Wildenhain

Hi,

robert rottermann wrote:

Hi there,
for a Client using a plone2 intranet (with no access from the outside 
world) I installed awstat to track the usage of the intranet.

now I wonder how meningfull such statisics are.


I guess you have something like apache in front of the zope,
if so you can make a custom log format (with relevant fields,
separated uniform, e.g. tabs) and spool them in a database,
for example I used some tables in postgres: uris (uri_id,'/foo/bar')
queries (query_id,'?foo=bar')   methods (method_id, 'GET'),
hostnames (host_id,'www.foo.de')
access (timestamp,host_id,bytes,time,method_id,uri_id,query_id )

with an insert-script and then you can easily run reports against
those structured data. You can also include various request parameters
I did not show above (like session cookie, auth_user, ...)

Regards
Tino


smime.p7s
Description: S/MIME Cryptographic 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] Re: Displaying Graphs using TAL

2008-05-30 Thread Tino Wildenhain

Hi,

Encolpe Degoute wrote:
...


 If your site is only for FireFox or evolved browser you can use inline


not only Firefox. also Opera supports this for years :-)
It is not totally ideal because of the overhead due to the
base64-encoding.

For graphs (as the op wants to show) I think in the long
run SVG would be a better option (gnuplot can output SVG)

Regards
Tino


smime.p7s
Description: S/MIME Cryptographic 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] Displaying Graphs using TAL

2008-05-30 Thread Tino Wildenhain

Hi,

Andyy wrote:
i am preparing graphs(MatPlotLib) related files using external methods., 
when i test them on zope they display very well there.


But when i call these external methods using tal as:


where IterationBar is my external method that displays a BarChart.


No, well you need to understand how HTTP/HTML works. If you have
a method which outputs the data of the image, you can point your
browser to it and it will load. If you want to embed the image
into a HTML page you need to give the link to the method in
 _not_ the image data itself (look into
document source in your browser to find out about the difference.

In short, the very URL you have in your address bar when you view
the image itself should go into src= attribute.

Sounds easy, yes? Give it a try :-)

Tino


smime.p7s
Description: S/MIME Cryptographic 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] Making Zope stop storing old object versions

2008-05-09 Thread Tino Wildenhain

Hi,

Jonathan wrote:

Sinang, Danny wrote:
Hello,

...

You can also try some of the other storages like relstorage (where it
depends on the RDBMS how it handles writes)


Alternatively, you could just replace your Catalog with an external db 
such as MySQL (using zmysql database connections).


well if MySQL is the right tool and does not introduce other problems.
It should be pointed out that along the powerful open source DBs there
is for example also postgresql which is extreamly good at handling 
concurrent loads.


Cheers
Tino


smime.p7s
Description: S/MIME Cryptographic 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] Making Zope stop storing old object versions

2008-05-07 Thread Tino Wildenhain

Hi,

Sinang, Danny wrote:

Hello,
 
We've got lots of Catalog reads and writes and our Data.fs is growing 
at an immense rate. 
 
Is there a way we can tell Zope to stop storing old object 
versions to limit the growth and not have to pack that often ?


Well in fact it (Filestorage) does only "store" new object versions.
What it does not is removing the old version - this is done during packing.

When you have many Catalog writes or other parts of your object tree
experiences many writes, try to mount an extra ZODB (and storage) there.

You can also try some of the other storages like relstorage (where it
depends on the RDBMS how it handles writes)

Cheers
Tino


smime.p7s
Description: S/MIME Cryptographic 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] running in debug mode

2008-03-26 Thread Tino Wildenhain

David Bear wrote:
Is it possible to have one zeo client running in debug mode while another is 
not? It seems that it should be the way most people would make a development 
environment. One zeo is running in standard mode so you could see how the 
site performs -- while the other zeo is running in debug mode so you can do 
file system development.


Yes of course it is. And why didn't you just try it out?

T.
___
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 utf-8 problem using MySQL

2008-03-22 Thread Tino Wildenhain

Hugo Ramos wrote:

What would you recommend? :-)


What should the database do for you? How did
you select?

T.
___
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 utf-8 problem using MySQL

2008-03-22 Thread Tino Wildenhain

Hugo Ramos wrote:

yellow,

It's a question of taste... I use a Macbook Pro/Leopard laptop instead
of a PC/win32 laptop... Also a question of taste! :-)


Guess you got the taste thing a bit wrong ;-) MySQL is the PC/win32
in your picture :-)

Cheers
Tino
___
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 utf-8 problem using MySQL

2008-03-21 Thread Tino Wildenhain

Hugo Ramos wrote:

Yellow ppl,

I'm using Zope 2.10.5 + MySQL 5.0.51a + MySQL-python-1.2.2.


Why? I mean, is there a special business reason to use MySQL?
Just curious...


T.
___
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: Managing Zope objects in Subversion

2008-03-21 Thread Tino Wildenhain

Tres Seaver wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Tino Wildenhain wrote:

Dieter Maurer wrote:

When I remember right, Tres has a product that allows to
dump and restore standard Zope objects to/from the file system.
I forgot its name but you should be able to find it via
your favorite search engine.

I wonder if Tres has also finished DAV support of Zope to also
support DeltaV - this would make Zope immediately a SVN server
- problem solved :-)

Well... wishfull thinking ;)


Tres never even *started* adding Delta-V support, beyond reading the
specification and speculating about how hard it would be. ;)


Yes I know ;) Btw, how hard would it be? Provided to just use
hysterical versions of objects (and forbid/disable packing)?

Regards
Tino
___
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] define a class in a python script

2008-03-06 Thread Tino Wildenhain

Hi Yuri,

Yuri wrote:

Tino Wildenhain wrote:

Yuri wrote:

Hi, all!

I would like to define a class inside a python script (so I can 
catalog it and use catalog to store info, as the tutorial about 
catalog everything suggests).


Its not possible in Python Scripts. You would need to write either
an external method or a small product.


http://www.faqs.org/docs/ZopeBook/ScriptingZope.html

You also cannot easily hand instances of your own classes over to DTML 
or scripts. The issue here is that your instances won't have Zope 
security information. You can define and use your own classes and 
instances to your heart's delight, just don't expect Zope to use them 
directly. Limit yourself to returning simple Python structures like 
strings, dictionaries and lists or Zope objects.


So developing a product, is the only option?


Well actually its not so hard as it seems. And products are more
easy to handle then external methods (initializing is more clear).

All you need to create a folder with a good name for your project
in the instance or common Products folder (depending on your
zope.conf ) then copy 
ZOPE_ROOT/lib/python/Products/PythonScripts/module_access_example.py to 
YourFanceProduct/__init__.py


then you edit this file to your likings based on both the documentation
(yes I know this is a bit sparse) and the hints given in that file.

Not you can define your own classes and functions in this file as
well. For better structure you are encouraged to create actual
module files in that directory instead of writing everything
into __init__.py once your create more then just a toolset.

Regards
Tino


___
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] define a class in a python script

2008-03-05 Thread Tino Wildenhain

Yuri wrote:

Hi, all!

I would like to define a class inside a python script (so I can catalog 
it and use catalog to store info, as the tutorial about catalog 
everything suggests).


Its not possible in Python Scripts. You would need to write either
an external method or a small product.

Regards
Tino
___
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] Managing Zope objects in Subversion

2008-03-03 Thread Tino Wildenhain

Dieter Maurer wrote:

[EMAIL PROTECTED] wrote at 2008-3-2 14:17 +0100:
We use Zope for the  user interface part of our software product. 
We currently export the whole folder hierarchy into a .zexp file and
maintain this file in Subversion. 

I'm looking for a way to manage a folder structure as individual 
Zope objects in Subversion. 


When I remember right, Tres has a product that allows to
dump and restore standard Zope objects to/from the file system.
I forgot its name but you should be able to find it via
your favorite search engine.


I wonder if Tres has also finished DAV support of Zope to also
support DeltaV - this would make Zope immediately a SVN server
- problem solved :-)

Well... wishfull thinking ;)

Cheers
Tino
___
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] MySQL-python-1.2.2 breaks compiling on Mac OS X 10.5 (Andy Dustman?)

2008-02-21 Thread Tino Wildenhain

Hugo Ramos wrote:

Well,

I went googling for this error... Google gives 1 (one) answer!!! The
worst part is that it's related to django and mod_python.

I guess nobody solved this yet... I'll have to go back to OS X 10.4 (Tiger).


You could also forward to Postgres :-) Unless you have a very specific
need for mysql...

Regards
Tino
___
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] Happy Valentine's Day from Zwiki HQ

2008-02-15 Thread Tino Wildenhain

robert rottermann wrote:

Simon Michael schrieb:

Hello Zopistas.. a happy Valentine's day to all!


as martin said (or hinted) before me, a new wiki solution needs to be
seamlessly integratable into plone.

I like zwiki very much and still use it often. but rarely in new projects.
the userinterface is to different from plone.

thanks for the incredible useful zwiki you provided us with.

if you move towards something plonelike, I would be happy to help.


Still I'm not so much a friend of Plone. While having the hooks
in place, a lightweight wiki-core would really be great.

Perhaps split into document type/parser/editor, storage and
link calculation engine, search&catalog and security?

Then just some glue code to adapt to plain zope, CMF, Plone, Five...

I mean the biggest improvement would be skipping that DTML stuff ;))

Regards
Tino
___
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] POST version of Response.redirect

2008-02-15 Thread Tino Wildenhain

Hi,

Jonathan wrote:
I have a case where I need to redirect users from my Zope site to a 
third-party web site and send POST data that I generate.


The only information I can find on RESPONSE.redirect relates to the GET 
format.  Is there a POST version of RESPONSE.redirect and if so, how is 
the POST data included?


No its not. It helps to have an eye on the HTTP-Spec some time :-)
People circumvent this limitation sometimes by means of Javascript.
(Basically posting a form) - often you can skip the Javascript
and let the user send the form intentionally.

BTW, this isn't related to ZWiki :-)

Regards
Tino
___
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 ZMI Templates

2008-01-17 Thread Tino Wildenhain

Andreas Jung wrote:
...
Iframes are still a valid choice in case asynchronous won't work e.g. 
when you need to load resources from servers != your origin server. Due 
the security model of asynchronous requests, a browser will only load 
stuff from the origin server. Iframes are a way to work around this 
limitation - ugly as you said, but sometimes a good workaround.


Not only ugly but also a very security threat. Been there, seen a lot
important sites fell on their noses when it comes to CSS* and friends.
Better find another solution in such cases and allow users to disable
support for iframes for better security.

*) here: cross site scripting

Regards
Tino
___
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 ZMI Templates

2008-01-17 Thread Tino Wildenhain

Hi Tim,

Tim Nash wrote:

The other important difference between ajax loaded pages and iframes
is that when you click on a link within an iframe page, the returned
page is loaded into the same iframe.
If I am not being clear, please check out this png file.
http://medicinebrain.com/iframe.png";>
http://medicinebrain.com/iframe.png

In this png I did a search for DML Docs within a tab panel and the
search results are loaded into the same tab.

BTW, I would like to simplify the zmi even more for my users. I want
to hide various tabs (eg. security, find, etc) and I want to restrict
the number of products they are shown in the drop down box for adding
to a folder.
However, I still want to offer complete zmi functionality to the
overall administrator.
I can probably hide the security tabs using css (the overall admin
won't load the css sheet) but how can I control the products displayed
to a user in the folder view of the zmi?


You can either sub-class if you want to explicitely specify the products
you want an objectmanagerish class to add - this would also nicely solve
all your ZMI "problems" since you could just skin your new pages as you
want. Or for the easy way have a look at the Security Tab, specifically
at the "Add FooBar..." stuff there.

Regards
Tino
___
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 ZMI Templates

2008-01-16 Thread Tino Wildenhain

Tim Nash wrote:

Jurian,
  While the ZMI is a bit geeky for the average user, it works quite
well inside an iframe.
iframes are used by many ajax/web2 (whatever you want to call it)
libraries. So in my application (for example) I currently make ajax
calls to load specific zmi pages inside tabs of a window layout.


IFRames. You should avoid those. With ajax or similar its easy to skip
such stuff and just replace any named container tag.

Regards
Tino
___
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: Best Practice for including Javascript in Zope Applications

2008-01-01 Thread Tino Wildenhain

Andreas Jung wrote:



...

Larger JS frameworks like Dojo tend to be split across several files and
directories. The fun starts when such frameworks load/reload stuff
using relative URLs. A co-worker using Dojo intensively had to invest
some time in order to integrate such a JS monster properly. As far as I
remember Extjs also uses multiple files (but not as much as Dojo
does)..so please check in advance.


Another point: consider using CMF and putting your library files into a
directory system view on the filesystem. This makes your life much easier.


Or just upload via WEBDAV.
One of the biggest advantages of Zope is the isolation from physical
file system.

Regards
Tino
___
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] backup full instances

2007-10-27 Thread Tino Wildenhain

Hi,

Jonas Meurer schrieb:

On 27/10/2007 Andreas Jung wrote:

If you create a local copy, it is safe. If you rsync a running Data.fs,
it  is not safe. In this case you create a local copy and rsync the copy.

but if rsync is unsafe only because it takes long time, and changes on the
instance during the copy process could cause a corrupted Data.fs to be
backuped, then theoretically this could happen for a local copy as
well, right?

Think twice about your last sentence. What should cause a local *copy*
to be changed??


zope might write to the Data.fs while it is copied, thus an inconsistent
copy would be backuped, even inside one filesystem.

i've asked in #debian on freenode as i wasn't sure, here's the log:

< mejo> if i copy a large file inside a mounted filesystem (ext3), is it
possible that the file is changed during the copy process?
< Wyzard> mejo: Yes, it's possible that something else can write to the
file while you're copying it
< mejo> because i asked on the zope-users mailinglist if i could backup
the global Data.fs (database) while the daemon is running, and
someone answered:
< mejo> If you create a local copy, it is safe. If you rsync a running
Data.fs it  is not safe. In this case you create a local copy
and rsync the copy.
< Wyzard> mejo: Making a local copy is faster, so it'd be safer, but
still not completely safe
< mejo> exactly, that's what i thought as well.
< mejo> but when i wrote that, he replied:
< mejo> Think twice about your last sentence. What should cause a local
*copy* to be changed??
< mejo> so he's wrong?
< Wyzard> I'd say he's wrong
< Wyzard> A local copy isn't instantaneous, and Zope changes the file
while it's being read
< wols_> he is wrong yes
< mejo> thanks. is it ok for you if i quote you in my reply mail?
< Wyzard> mejo: sure
< wols_> mejo: while copying zope could change the database and create
an inconsistent state


Nobody is wrong. Your #debian guys just had not all informations.
Zope is always appending to Data.fs, copy (cp) works linear, so
it would always maintain a consistent state of this file.
(It either copies before or after the last append operation)

rsync on the other hand is very efficient by calculating only
differences of the file contents to be copied. This may or may
be not following the order of blocks in the file. In the latter
case it could try to sync wrong information. (You would need
a special rsync which would only transfer new blocks at the end
in their given order - you could script something like this
using dd, gzip/zcat, ssh.

Regards
Tino





___
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-18 Thread Tino Wildenhain

[EMAIL PROTECTED] wrote:

Forgive my ignorance, but not quite sure how to do that. Nonetheless...
1) There was no problem with any of this on the old server until the 
server crashed.
2) My backups were taken from a time when the old server was was working 
fine.


Did you ever check these backups? We are talking mySQL here which has
a lot of nasty bugs regarding reliability.


3) This problem occurs with *all* my shopping carts, not just this one.
Consequently, I have a hard time believing this is a code error. There 
*must* be something more fundamental at play here.


From what you wrote further down it looks like a threading issue with
the mysqlda. You would have to write a test case to isolate it.
Easiest if you set thread number in zope to 1 and test. This should
work similar to single threaded application.

Regards
Tino







___
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] SQLAlchemy 0.2 released - a generic database adapter for Zope 2

2007-05-05 Thread Tino Wildenhain

Andreas Jung schrieb:


I am pleased to announce the first public release of

 SQLAlchemyDA V 0.2.0


Nice, saves me a lot of time :-)
Btw, what do you think about an idea to (alternatively)
configure db-connections in zope.conf? Just to
add security (nobody could read credentials, nobody
could connect to whatever host/port he wants)

Regards
Tino
___
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: Problem Getting dtml-with to work

2007-04-30 Thread Tino Wildenhain

Andreas Jung schrieb:



--On 30. April 2007 11:02:29 -0400 "Mark, Jonathan (Integic)" 
<[EMAIL PROTECTED]> wrote:



Thanks to the other Jonathan for advising me to try 
to find why dtml-with was not working as expected with FolderB. When I
did that I realized that FolderB was not an actual folder. Rather, it
was a Plone instance.



Just the usual rant: do you have 3 good reasons for using DTML over ZPT? 
:-)


1) you mean ZPT and python script
2) one reason could be nobody rearranged
   the Zope-Book chapters in a way to
   move DTML chapter out of first sight ;-)

SCNR
Tino
___
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 with using versions.

2007-04-10 Thread Tino Wildenhain

Catherine E. Reinehr schrieb:

Hi,

I've been working in a version for over a week and finally finished my
changes today.  I saved them and quit the version, but the affected folder
still has a lock on it.  I've tried four times now to save my changes, and
it's just not working.  The first time, it seemed to publish the changes but
the folder was still locked.  On later tries, I encounter an error when I
try to access the page after saving changes.  Any suggestions?


The built in version handling was deprecated long ago for exactly these
problems. Which Zope version are you using?

- back up your Data.fs(s)
- export your structure as it is (better do this per root element)
- undo your last steps (this is optional in case you cannot see
  important parts due to version lock) and export these objects
  as well

- stop zope/zeo and delete Data.fs(s), restart it and
  create your site again using your above exports.

- do not use zope versions anymore.

if your zope is old, try to upgrade while you are working
on it. In this case, you can skip step 4.

HTH
Tino
___
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] What's the tal expression to test for whether someone is logged in?

2007-04-01 Thread Tino Wildenhain

Ken Winter schrieb:

Andrew ~

Yes!! It worked.

One more question: Where (if anywhere) could I have looked up this answer
(and probably many more), so I wouldn't have to bother this list with
questions like this?


Its in the general Zope API and in the ZPT documenation regarding the
name spaces you use. Both are in the Zope-Book which is online:

http://www.plope.com/Books/2_7Edition

Also an older version directly at zope.org.

Regards
Tino
___
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 can I reset zope time???

2007-03-24 Thread Tino Wildenhain

Flemming Bjerke schrieb:

On Fri, 23 Mar 2007 16:16:55 +0100
Andreas Jung <[EMAIL PROTECTED]> wrote:



--On 23. März 2007 16:09:15 +0100 flem <[EMAIL PROTECTED]> wrote:


I think this kind af date-deadlock is a vulnerability of the zope
architecture. Is it the same thing with zope3? Isn't it an unnecessary
vulnerability that an open zwiki comments field - or any other object
making act open to the public where the anyone can set the date - can
corrupt the time system irrepairbly.

Shouldn't there be some solutions:

1. A script could reset all relevant dates and the timestamp i the zodb.

2. The zope code should be changed so that the timestamp depended
directly on the pc-clock notwithstanding the dates of the objects thus
allowing for going backward in time.


I am not getting the point. What do you want to tell us?

That I think it is a vulnerability that a person can irrepairably corrupt zope's date system by sending one request with a wrong date (in my case using the default open comment opportunity in zwiki). 


Well, but this one can't be truth. ZODB time stamps are generated
in the ZODB layer and not taken from request. In fact, the concept
of a request is completely unknown to ZODB.

Regards
Tino
___
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: open image in a fitted new window

2007-03-22 Thread Tino Wildenhain

Tres Seaver schrieb:
...

The only trick here is to get the javascript to include the "dynamic"
URL;  everything else is not specific to Zope or ZPT.  Here is the hack
I usually use for that::

  
  

Your popup javascript can then refer to the 'img_url' JS variable to set
the window location.



A little bit cleaner approach would be to have an ordinary link:

width, height ... />



and have a general javascript which scans thru the DOM after load,
finds the a-objects with class-attribute magnify and installs
an handler for mouse click which overrides the usual link action
and either pops up a window or uses layers the big view on top
with little DOM action (preferred). You dont even net buzzy "Ajax"
for this. The URL for the big picture is just encoded in the HTML
already, so you can use the usual tal: attributes to define in
ZPT.

The result is clean xhtml code which works in any case and only
is improved in case of javascript beeing available.

Regards
Tino
___
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 Tino Wildenhain

Remil Mathew schrieb:

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.


Well thats not business of ZSQL methods but rather
stuff you do with the instruments of your database.
Say SQL (or whatever SQL like mysql has there)

IIRC, mysql has some kind of UPSERT which should
handle it. If not, stored procedure or trigger
etc could do it.

Regards
Tino
___
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 do people work with html-designers?

2007-03-16 Thread Tino Wildenhain

Chris Withers schrieb:

Martijn Pieters wrote:

That, for ZPT, was sadly a myth.

Not a myth at all. Perhaps underutilised and not as robust as first
hoped, but not a myth. At Pareto the designer and templater were quite
comfortable with keeping TAL intact while using graphical tools.


My experience has been that as soon as you put any of the common visual 
html tools into the mix, they happily strip out tal: and metal: 
attributes :-(


Which ones do that? Certainly not the infamous DW...

Regards
Tino
___
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] sql and script python

2007-03-13 Thread Tino Wildenhain

javi lopez schrieb:

hello everyone:

how to create a query(mysql) inside script python


You dont. You write your Query into a ZSQL Method and
call it as function in your python script.

Regards
Tino
___
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 can run multiple query in an Z sql method

2007-03-09 Thread Tino Wildenhain

Jary Busato schrieb:
If I understood you're telling me that begin and commit statements are 
"redundant".


No in this case they would be an error.


Sometimes conflicts are not correctly managed by ZTM (no rollbacks in db)


Examples? Which bug reports?

Regards
Tino
___
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] Two mysql / timestamp related fixes

2007-03-09 Thread Tino Wildenhain

Gaute Amundsen schrieb:

On Friday 09 March 2007 09:40, Tino Wildenhain wrote:

Gaute Amundsen schrieb:

On Thursday 08 March 2007 17:27, Tino Wildenhain wrote:

Gaute Amundsen schrieb:

Hi.




1 )
First I got a ValueError 'query' when using a very simple zsql method.
(consisting of only "")

Thats a very bad idea. Better make zsql methods
for every query

I know the orthodoxy :-/
I'd rather have a proper DB library, (or model layer, if you will)
and build my SQL in python.

So you want to use SQLAlchemy? Feel free to write a product
as wrapper :-)


Hm.. have never quite gotten around  to writing my first product.
Looks like a very nice candidate, but no promises :)


To build anything complex or generalized in dtml is a PAIN.

Is it? Can you come up with examples?


tabell:string
felter:list
INSERT INTO  SET

  
,
 =

  

  

  

  


SELECT LAST_INSERT_ID()

and that is not _really_ complex is it?


Well, it looks a bit silly - I mean you make
a hand-written ORM? This would be the time to
either write a real ORM as product or try
some of the available: ZPatterns, Archetypes, ...

Usual database interacting zope solutions
have only a handful insert places where you
need bulk inserts. And even then you can just
call one ZSQL method (per table) in a loop
to insert your values from a list.

More, sql_quote does not really work
for tablenames or column names - it
may work by accident for MySQL though,
but not for standards compliant databases.



There's the whole sqlgroup thing.


Well to be honest I never used it ;)

dtml is after all depreciated, so I can see no reason to learn it as torougly 
as ZSQLMethods obviously requires when I can use python instead.


You always can but what do you gain? How does your python script
code look like for the above problem?


And a sea of too specific templates is even worse.

Well from some level of complexity you could also use
database functions. But if its so complex, why using
MySQL?

Don't see quite what you mean here, but it would be just the same problems 
with PGsql.


Not direct related but if you have complex queries,
e.g. join over many tables, partial indexes, subqueries, ...
it may be a bit hard to get reliable performance with MySQL.
I think it was related to different views at the word "complex
queries"


instead of
rebuilding your own (obviously not working)
templating for SQL.

I's not a template, it's a wrapper to get around the whole mess.
A hack in fact ;)

If a template this simple "" is "obviously not working"
then it is ZSQLMethods that have a problem, not me.

No, the content of your variable sql is wrong :-)
 would indeed work if it contains valid sql
code.


It did not. 
That was the whole point of this mail.


The method was "" and the sql was "select * from foo"
care to spot the invalid code in that?


wait... your variable really is named "sql"? Maybe that is
the problem. I did not verify this but it could be. DTML
is sometimes weird ;)


(it's working fine now.)


Quoting is done automatically
when you use 

I can use sql_quote when I need to, thankyou.

this does not need to work identical - but current
adaptors indeed do their handmade quoting.


The only thing that I worry about is transaction support.
"insert foo; select last_inserted" works when built inside the template
with dtml, but not with the exact same statement passed to this
"wrapper". Probably another bug, but I have not taken time to dig
properly into it yet.

Yes, MySQL doesnt want ; as sql-delimiter. It rather wants \0 and sql
methods hack around it for you if you put the template there.



Hm.. interesting, but I looked into it a bit, and I can't find where this 
happens.

I see that ZRDB/DA.py does: argdata['sql_delimiter']='\0'
Tried a "query = query.replace(';','\0')" at line 444, but to no effect :)


Interesting. I must admit the whole ZSQL Code is very old and ugly
and I even removed some parts in my private installations ;)



Suggestions?
I guess this could be a problem with LAST_INSERT_ID, forcing me to use 
ZSQLMethods, or dome ugly workaround  for inserts, where I need the id 
afterwards.


Last_insert_id is really part of the uglyness of mysql. But you would
work around with distinct ZSQL Methods. See these methods as interface
and really methods of your database to interact with your data model.


Transactions are maintained thrughout your session (read: request)
so there is no need to squeeze it all into one ZSQL call. Every
subsequent ZSQL call inside your request will be in the same
database transaction.



No plans to squeze it all into one huge SQL statement. Now THAT would be ugly!
but python errors does not trigger rollback it seems. I guess only sql errors 
would do that?


No, every transaction is rolled back if it bubbles up t

Re: [Zope] How can run multiple query in an Z sql method

2007-03-09 Thread Tino Wildenhain

Andreas Jung schrieb:



--On 9. März 2007 14:42:57 +0530 Remil Mathew <[EMAIL PROTECTED]> wrote:


Hi,
How can run  multiple query in an Z sql method..


Sure. SQL Statement just have to separated by .

I am using Mysql..

Also is there any method to return a value from insert query?


An insert statement does not return a value! If you are working
with sequences for generating the primary  key you might perform
a select on the current value of the related sequence.


Well, it can. See RETURNING clause:
http://www.postgresql.org/docs/8.2/static/sql-insert.html

but I doubt mysql supports this ... checking ... no, it doesnt.

Regards
Tino
___
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 Tino Wildenhain

Maciej Wisniowski schrieb:
 

Where? I added this line to zopectl and rebooted:


rebooted? Lets hope you only restartet zope :-)


Regards
Tino
___
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] Calling a Variable

2007-03-09 Thread Tino Wildenhain

Martijn Pieters schrieb:

On 3/8/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
I thought I could call a variable in a page template by defining it 
and then

putting a ? in front of it in a URL, like this:


Incorrect, you can only use ? to interpolate variables into a path 
expression:


 

The above example will look up 'bar' and render it as the content of the 
span.



I notice ZPT gets weirder and weirder...
How many syntactic specialities will we add to path expressions? ;)
Why not keep it simple? :-)

Or make it simpler by removing even tal:define ...

Regards
Tino
___
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] Two mysql / timestamp related fixes

2007-03-09 Thread Tino Wildenhain

Gaute Amundsen schrieb:

On Thursday 08 March 2007 17:27, Tino Wildenhain wrote:

Gaute Amundsen schrieb:

Hi.



1 )
First I got a ValueError 'query' when using a very simple zsql method.
(consisting of only "")

Thats a very bad idea. Better make zsql methods
for every query 


I know the orthodoxy :-/
I'd rather have a proper DB library, (or model layer, if you will) 
and build my SQL in python. 


So you want to use SQLAlchemy? Feel free to write a product
as wrapper :-)


To build anything complex or generalized in dtml is a PAIN.


Is it? Can you come up with examples?


And a sea of too specific templates is even worse.


Well from some level of complexity you could also use
database functions. But if its so complex, why using
MySQL?

instead of 
rebuilding your own (obviously not working)
templating for SQL. 


I's not a template, it's a wrapper to get around the whole mess.
A hack in fact ;)

If a template this simple "" is "obviously not working"
then it is ZSQLMethods that have a problem, not me.


No, the content of your variable sql is wrong :-)
 would indeed work if it contains valid sql
code.


(it's working fine now.)

Quoting is done automatically 
when you use 


I can use sql_quote when I need to, thankyou.


this does not need to work identical - but current
adaptors indeed do their handmade quoting.



The only thing that I worry about is transaction support.
"insert foo; select last_inserted" works when built inside the template with 
dtml, but not with the exact same statement passed to this "wrapper".

Probably another bug, but I have not taken time to dig properly into it yet.


Yes, MySQL doesnt want ; as sql-delimiter. It rather wants \0 and sql
methods hack around it for you if you put the template there.

Transactions are maintained thrughout your session (read: request)
so there is no need to squeeze it all into one ZSQL call. Every
subsequent ZSQL call inside your request will be in the same
database transaction.


Regards
Tino
___
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] Two mysql / timestamp related fixes

2007-03-08 Thread Tino Wildenhain

Gaute Amundsen schrieb:

Hi.

Just had som troubles when I added timestamp columns to a table.
Commnets?


my setup:
Mysql: 4.1.20-log
 Zope Version: (Zope 2.7.5-1.fc3, python 2.3.4, linux2)


1 )
First I got a ValueError 'query' when using a very simple zsql method.
(consisting of only "")


Thats a very bad idea. Better make zsql methods
for every query you want to issue instead of
rebuilding your own (obviously not working)
templating for SQL. Quoting is done automatically
when you use 


(I am not totally sure this is related to the timestamp  column)

I appled the fix to customDefaultReport.dtml  mentioned in 
http://mail.zope.org/pipermail/zope-db/2005-June/004219.html


< href="&dtml-URL;?query_start=&dtml-previous-sequence-start-number;&query=query url_quote>">

---

href="&dtml-URL;&dtml-sequence-query;query_start=&dtml-previous-sequence-start-number;">
25d24
<  href="&dtml-URL;?query_start=&dtml-next-sequence-start-number;&query=query url_quote>">

26a26
 
href="&dtml-URL;&dtml-sequence-query;query_start=&dtml-next-sequence-start-number;">

This does not seem to be exactly the same fix as described in: 
http://www.zope.org/Collectors/Zope/1812


Should I have this problem in Zope 2.7.5-1.fc3?


2)

ValueError: invalid literal for int(): 0-  
When trying to do a "select *" 

this is definitely connected to the timestamp  column, because this change 
fixed it:


diff /usr/lib/zope/lib/python/Products/ZMySQLDA/db.py 
/usr/lib/zope/lib/python/Products/ZMySQLDA/db.py~
173d172
< conv[FIELD_TYPE.TIMESTAMP] = DateTime_or_None

I have found no mention of this anywhere?
Have anyone else had this problem
Comments?

Regards

Gaute Amundsen

___
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 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 Tino Wildenhain

Jary Busato schrieb:

Maciej Wisniowski ha scritto:

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.

  

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.


However download of files off ZODB isnt such a big problem (you should
mount an extra storage for the files to avoid overly cache trashing)
but the performance is more then acceptable. ZODB/Filestorage is currely 
only a problem if you regulary update those files (or objects anyway)

because it would add a complete new version.

Regards
Tino Wildenhain
___
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] datetime format

2007-03-05 Thread Tino Wildenhain

Andreas Jung schrieb:



...

And I would not
use it much because you loose all type information and the
ability to sort accordingly and calculate with the values.

Better format them just for output - which would be in
python code.



It depends on the usecase..if you don't have to deal with different
date format it is handy to convert it on the RDBMS level..otherwise
you have to write something like





No, you would do that in your formatter class or at least in
the python script preparing the values for the template.

Regards
Tino :-)
___
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] datetime format

2007-03-05 Thread Tino Wildenhain

Andreas Jung schrieb:



--On 5. März 2007 07:12:23 +0100 Tino Wildenhain <[EMAIL PROTECTED]> 
wrote:



Garry Saddington schrieb:

I have 'datetime-format international' set in zope.conf but the date
output is  still rendered in the format (y,m,d) when using ZopeTime or
when returning  dates from python scripts. How can I change this
behaviour? My server config  is:


Well what you see is not "the date" but one representation of the
DateTime object. You can use the strftime() method to render your
date object to string in any form you want. This should also
answer your question on postgres list. Your database adaptor
turns database types into zope types.


In addition: SQL also provides support converting a date type of the 
database into a string. See TO_DATE(...).


Yes it does but its to_char() not to_date() ;) And I would not
use it much because you loose all type information and the
ability to sort accordingly and calculate with the values.

Better format them just for output - which would be in
python code.

Regards
Tino
___
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] datetime format

2007-03-04 Thread Tino Wildenhain

Garry Saddington schrieb:
I have 'datetime-format international' set in zope.conf but the date output is 
still rendered in the format (y,m,d) when using ZopeTime or when returning 
dates from python scripts. How can I change this behaviour? My server config 
is:


Well what you see is not "the date" but one representation of the
DateTime object. You can use the strftime() method to render your
date object to string in any form you want. This should also
answer your question on postgres list. Your database adaptor
turns database types into zope types.

Regards
Tino
___
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 export ZWiki contents in ZODB to MYSQL

2007-02-26 Thread Tino Wildenhain

Win Myint Aung schrieb:

Dear Members,
 
I am a newbie in Zope. please do me a favor. I am looking for some 
python scripts that can export Zwiki contents from ZODB to MYSQL.


Well, the script is easy in principle but you need to know how
the result in your MySQL should look like. So its basically
just traversing the object tree in zope, lookup the properties
and attributes with content and then rewrite them in the form
your application needs it.

Otoh, its a lot of work - what is the expected gain?

Regards
T.
___
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] frameset problems

2007-02-21 Thread Tino Wildenhain

Garry Saddington schrieb:

I have this page:




">



The 'page' variable is in the request but no matter what I try I am having 
problems passing it the the python script 'getproperty'. Can anyone point me 
in the correct direction?


dtml-call? wtf! This will never ever work since dtml-call does not
return values. You might want to use dtml-var instead.

(Let alone you should try to not use dtml at all)

You above example would also not work since _['page']
would read a variable named page from _ namespace,
which would try to look up properties first and
only as last resort look for request variables.
There is REQUEST even in DTML.

Also note, design has long since moved away from frames
(Yes I know ZMI still uses them) - it makes things with
application servers much more easy if you don't use frames.

Easiest way is to return rendered pages from python script
for example


pagename=context.getProperty('page','defaultpage')

return context[pagename]()


as a python script would do the trick.

Regards
Tino


___
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] emulate a sequence

2007-02-08 Thread Tino Wildenhain

Jonathan schrieb:


- Original Message - From: "Yuri" <[EMAIL PROTECTED]>
To: 
Sent: Thursday, February 08, 2007 9:09 AM
Subject: [Zope] emulate a sequence


I need a field in zope object which act as a sequence. I mean every 
time I create an object, the value is the previous sequence value of 
the last object created + 1.


also I need to browse the objects by sequence (from the object 1 to 
the last, by the sequence number)


I think I need a catalog FieldIndex to store the sequence for 
searches, a property in the object.


Can I use the catalog to retrieve the max value of the index, so when 
I create the object, I just add 1 and store it in the property?


You could use a catalog if you have other searching requirements, but 
the method objectIds() (see the zopebook for more info) will return a 
list of contained Ids, which you can then sort to get you what you 
need.  Also, len(somefolder.objectIds()) will give you the next 
available id (assuming your object ids have some sequential numbering).


Which both would not exacly emulate a sequence. Sequences live outside
transaction borders so they are inremented every time under any 
circumstances.


All the above methods would fall flat on the tummy when you are hit with 
variuos rollback or retries while other transactions concurrently add 
objects.


Regards
Tino
___
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 Methods and transaction control

2007-01-10 Thread Tino Wildenhain

robert rottermann schrieb:

Hi there,

I am implementing a tool to handle userdata that is stored in a MySQL db.
The underlaying logic of the stored procedures used to maintain the db
content
dictate that I have to control the transactions myself.


Can you elaborate on that? I dont see a reason why you would
commit around zopes transaction handling (which would actually
be dangerous anyway - think of the retry mechanism in case of
database conflicts)


I understand that there is a way to handle transaction controll in the
ZMySQL
methods. However I find no documentation at all on how to use it.


Well most databases accept "COMMIT" as sql command.


Without using ZMySQL methods I would be using the following piece of code:
db = mysql.connect(host="localhost" ...)
cursor = db.cursor()
query = "CALL insertUser('%s', '$xxx$', @id, @error);select @id, @error"
% 'JohnTheUser'
cursor.execute(query)
# get the next resultset, it has the result of the select
cursor.nextset()
result = cursor.fetchall()[0]
error = int(result[1])
if error:
print "error %s when trying to add user %s" % (ERRRORS[error],
'JohnTheUser')
db.rollback()
continue #we are in a loop actually


what does the loop?

..
db.commit()
How can I mimic that using ZSQL Methods


Are you adding users in a series? What exactly
are you doing? If its kind of migation, consider
running it as a script with zopectl run migationscript.py
once. There you could just write python code as you like
w/o interfering w/ Zopes session handling.

Regards
Tino

___
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] Recovering from Data.fs

2007-01-09 Thread Tino Wildenhain

Maciej Wisniowski schrieb:

>From my understanding the paths for the zope instance have to be the
same for Data.fs to work correctly. Is that correct?

No, Data.fs should be portable.


Yup, need to crete plain new Zope instance and put
your data.fs into var directory. After this start Zope
and take a look into ControlPanel->ProductManagement to
see if you have broken (or not installed at all) products.
You might also lack external methods from Extensions/ folder.

Of course you need to know user and password to log into ZMI.
You may create new one in zopectl with useradd (or adduser I don't
remember) command.


Needless to say you should keep an original copy of your
Data.fs on a safe place while you do the above tests.

You should be save, but you never know :-)

Regards
Tino
___
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] tal loop to render table

2006-11-29 Thread Tino Wildenhain

Tino Wildenhain schrieb:

Dennis Schulz schrieb:
I would like to build a tal loop that renders a list of elements 
(widgets in my case) in a table.
(for example I have a list of 9 items, then it renders a table: five 
rows with 2,2,2,2,1 items)
the table has 2 columns, so i would need to open and close the table 
row every second item.
I tried to check with a condition if the row is odd or even, but 
unopened and unclosed tags are not valid.


Is there any possibiliy to do this with tal?


Well, you just dont want to do this in TAL, really ;)
You have to choices: either not using a table but

"two"


a couple of carefully CSS-crafted  tags
(See alistapart.com or so for hints on tableless floating
designs)

Or you go the easy path and have a data preparing script
(Script (Python) - Object) which does something along the lines
of:

data=your_nine_items

rowlength=2

return [data[i:i+rowlength] for i in range(0,len(data),rowlength)]


I think you get the idea :-)


ah yes, and I forgot the TAL:


 
 
   
 123
   
 



I guess you know what values you really want to put in :-)

Regards
Tino
___
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] tal loop to render table

2006-11-29 Thread Tino Wildenhain

Dennis Schulz schrieb:
I would like to build a tal loop that renders a list of elements 
(widgets in my case) in a table.
(for example I have a list of 9 items, then it renders a table: five 
rows with 2,2,2,2,1 items)
the table has 2 columns, so i would need to open and close the table row 
every second item.
I tried to check with a condition if the row is odd or even, but 
unopened and unclosed tags are not valid.


Is there any possibiliy to do this with tal?


Well, you just dont want to do this in TAL, really ;)
You have to choices: either not using a table but
a couple of carefully CSS-crafted  tags
(See alistapart.com or so for hints on tableless floating
designs)

Or you go the easy path and have a data preparing script
(Script (Python) - Object) which does something along the lines
of:

data=your_nine_items

rowlength=2

return [data[i:i+rowlength] for i in range(0,len(data),rowlength)]


I think you get the idea :-)

Regards
Tino
___
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] Z2.log format

2006-11-16 Thread Tino Wildenhain

Sascha Adler schrieb:
I'm running an instance of Zope 2.8.6, and I'm stumbling into a problem 
with the format of Z2.log. Unlike an Apache log, which would have the format


%S - %u ...


Well the apache log format is configurable. I don't know why the
analysis products stuck with the weird default.


Z2.log appears to have the format

%S- %u ...

The lack of the space following %S causes analog to choke on an address 
that contains a hyphen in it, and in my case, analog cannot read half of 
Z2.log. I've tried looking up how to change the format Z2.log comes in, 
but I haven't found anything useful. Is there any way to work around this?


Usually you work around this by placing apache as frontend to zope -
which makes a log things easy (simple balancing, switching, virtual
hosting, ssl, ...  to name just a few) and last not least configurable
logging. You can completely disable Z2.log.

For no good reason, many log analyzer do not look on mime-information
of the request but try to find out by inspecting the suffix of the url,
thy of course als don't know that /foo and /foo/ in zope really means
the same thing and so on. Sane log analysis makes a good deal of work
I can tell you.

Good luck
T.
___
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: adding a python library

2006-11-14 Thread Tino Wildenhain

David Bear schrieb:

On Mon, Nov 13, 2006 at 08:32:11PM -0500, Tres Seaver wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

David Bear wrote:

I would like to add Mark Pilgrims feedparser to the available modules
that I can use in zope. I have installed the feedparser into the
python instance that zope uses. However, when I attempt to import it,
I get an error that I'm not authorized. How might I make the
feedparser available to zope?

Check the examples in
$SOFTWARE_HOME/lib/python/Products/PythonScripts/module_access_examples.py



Thanks. This seems straightforward. However, I am now rethinking this.

What if I created a zope script and just pasted the feedparser.py
modules contents into it. Do python scripts that live inside zodb
become importatable?


No, not at all, a "Script (Python)" Object is much more like a
class method of the container object (e.g. Folder).

So if you write a python script in ZODB/ZMI with name foo
in folder bar, its comparable to somethign like that:

class bar:
 ...

   def foo(context,)
   [your method body here ]

(not literally of course since acquisition
and all that comes into play, but as a thought model.

Regards
Tino
___
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] matplotlib and zope problem

2006-11-14 Thread Tino Wildenhain

Marek Szczypiński schrieb:

Hello All,

  I've been using zope and matplotlib for some time now, and I want to
connect them. I'am using the example code from page:
http://www.scipy.org/Cookbook/Matplotlib/Matplotlib_and_Zope ,
but whenever I try to import matplotlib, and/or pylab packages i get
this error from zope:

Error Type: RuntimeError
Error Value: '/' is not a writable dir; you must set environment
variable HOME to be a writable dir


*wild guess*

you are starting Zope as root (via init) so $HOME
points to root's home directory (usually /root)
Now zope switches to another user (configured or
default to nouser and thus cannot write to
root's home anymore.

You can either set another value for $HOME in your
zope.cfg - there is a section for custom environment
vars or modify mathplotlib to _not_ write to $HOME.

(Sounds like a bad idea anyway - whats wrong with temp?)

Zope Products use ZOPEHOME and INSTANCE_HOME

Regards
Tino
___
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 create a new TAL statement?

2006-10-28 Thread Tino Wildenhain

Garito schrieb:

Tino Wildenhain escribió:

...
I'm talking about  not tal:replace="/foo/bar" />


What I need is control the expression far away from the normal way (I 
want to process the result automatically before return the result)


Aj and Chris dissapoint me to modify the __gettattr__ member of my class 
to make this calculation


Then I thing I can make this calculation via some tal:statement

Some idea?


Err, what they didnt tell you, its easier to implement get()
on your method (item access) just like dictionaries.

This can be used w/ tal path expressions as well.

No need to fiddle around with extending TAL.

Regards
Tino Wildenhain
___
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 create a new TAL statement?

2006-10-27 Thread Tino Wildenhain

Garito schrieb:

Hi all!

As Aj and Chris advise my to forget the __getattr__ bussiness I try to 
solve the same question by other ways


Now I have a new question:

Can you point me to some help about how to create a new TAL statement?

I would like to create a tal:yanged (for example) statement to control 




would work :-) But what are you really trying to do and why?

Regards
Tino
___
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 Call Fails

2006-10-24 Thread Tino Wildenhain

[EMAIL PROTECTED] schrieb:
Changing the dash to an underscore in the variable name solved the 
problem.


I'm quite sure you could solve it even better - if we would know
where these variables come from and what their meaning is.

I suspect some kind of form?

Regards
Tino Wildenhain
___
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 Call Fails

2006-10-24 Thread Tino Wildenhain

[EMAIL PROTECTED] schrieb:
Hi Tino.  Yes, that is correct. This application has variables named 
like:


'AR-DA-08'


Not very clever.


This also fails in a Page Template:


   


you still have to quote if you mean the variable with that
weird name. Otherwise its an expression in python.

_['AR-DA-08'] could work in DTML... but lets better forget
that ;) Where does your variable live? In Request maybe?




With the error:

Compilation failed
TAL.TALDefs.TALError: Python expression error:
invalid token (Python expression "data.set('AR-DA-08',AR-DA-08)", 
line 1) in expression "python: data.set('AR


TAL??



Yet this works:


   


So you are saying the interpreter is seeing the '-' as a minus? Why 
would it work in one case and not the other?


See Andrew's note on ocal numbers.



Could the minus be escaped somehow?


No, but see above.

Could you please escape the horribly code + template
mixing with DTML? ;) See the zope book for python scripts.
(After all in DTML "expressions" its already python code,
so why not write just python code and skip all that
 stuff around it you dont need anyway?

Regards
Tino Wildenhain
___
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 Call Fails

2006-10-24 Thread Tino Wildenhain

[EMAIL PROTECTED] schrieb:

A little bit of legacy DTML fun here... Zope 2.9.3

On save of a DTML Method, why would this dtml-call fail:


  


With the error: 


"Expression (Python) Syntax error: invalid token"

Whereas this works fine:


  



I doubt any of that really "works". So you happen
to have the variables named "AR" and "DA" defined
as numerical values somewhere? Otherwise the expression
makes no sense at all. The leading 0 in 08 and 07 indicates
you might have a completely other illusion on what's going on.

Any reason you cannot write in a python script something like:

REQUEST.SESSION.set('some_resonable_named_variable','AR-DA-07') ?

Could you explain in plain english what your final goal
of your construction is?

Regards
Tino Wildenhain
___
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 Method's Precision

2006-10-24 Thread Tino Wildenhain

Maciej Wisniowski schrieb:



In a PostgreSQL DB I have a Numeric data type with a precision of two
decimal places. If I have 1.33 in as the result from my query, it's
everything is good. However, if I have 1.30 it reduces the precision
to one decimal place and I get 1.3. Not so good when dealing with
currency ( I don't want to use the money data dype ).

Any ideas on how I can get my ZSQL method to keep two decimal places?

As others said it's a matter of displaying. You say that you don't want
to use money datatype but keep in mind that postgre adapter
is able to use Python's Decimal datatype for money values (in python2.3
you need additional module decimal.py from Python 2.4 to enable it)
which may give you necessary precision for financial operations and is
able to store really big numbers.


The adaptor should use it for numeric data as well (hey, hence the name 
;) Use of the deprecated money datatype in postgres isnt recommended.

(And its superceeded by numeric anyway)

Regards
Tino Wildenhain

___
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] [Fwd: [USN-359-1] Python vulnerability]

2006-10-06 Thread Tino Wildenhain

Chris Withers schrieb:

ouch... I'd imagine Zope is vulnerable to this?

What source version(s) of python have these problems fixed?


Well debian also had it already. I'd guess current sources
should have it too. Watch changes.txt and friends.

Regards
Tino
___
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] Log in as another user

2006-10-01 Thread Tino Wildenhain

Sinang, Danny schrieb:

Hello,
 
In Unix, there's the "su" command which admins can use to log in as 
another user.
 
Is there a similar facility in Zope ?


not as "login" but there are the proxy roles you can assign to
an object (script) to do something with raised privs.
 
If not, is there a way for admins to view the passwords of their users ?


Usually no. (most sane userfolders hash the passwords and dont store
them clear text)

Regards
Tino
___
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] Calling a Script from ZPT

2006-09-18 Thread Tino Wildenhain



--On Montag, 18. September 2006 06:43 -0700 Ferhat Ayaz 
<[EMAIL PROTECTED]> wrote:



Hi,

a quick and newbie question:

How can I call a Script (Python) within a page
template. I'm using the 'define' tag:



Is there a more serious way to do this?


Yes, don't do it :-)

PageTemplates are "views" and as such not
supposed to have sideeffects on application.

I'd do it in the application code instead,
e.g. before the pagetemplate is called.

(Yes you can return the result of a call to
a pagetemplate from a python script if you
want it easy :-)

e.g. python script:

doseomething ...

return context.thepagetemplate(arg1=var1, ...)


Regards
Tino
___
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] \n problems with mysql5

2006-09-15 Thread Tino Wildenhain



--On Freitag, 15. September 2006 01:08 -0700 Ferhat Ayaz 
<[EMAIL PROTECTED]> wrote:




Hi,
sorry list. The problem was the changed syntax of JOIN
between mysql 4 and 5.

SELECT bla FROM bla INNER JOIN table1,table2 ON ( bla
)

must be changed to

SELECT bla FROM bla INNER JOIN (table1,table2) ON (
bla )


Crazy syntax.
What about SELECT bla FROM table1 JOIN table2 USING bla ?

Regards
Tino
___
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 -> ZPT

2006-08-31 Thread Tino Wildenhain
Antonio Beamud Montero wrote:
> Is this the equivalence?
> 
> 
> 
> 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] python expression in tal:attributes

2006-08-30 Thread Tino Wildenhain



--On Mittwoch, 30. August 2006 04:32 -0700 Ferhat Ayaz 
<[EMAIL PROTECTED]> wrote:




yes, you're right. With define it works. Below is the
same code with define. Thank you.
But now I have another problem (actually my main
problem). For instance,if you click more and more on
the link 'Catalog'. The URL grows up like
http://localhost:8080/Site/Catalog/Catalog/Catalog//index.html
How can I say that the Catalog folder is just under
the Site folder?

   

link name

   


Why don't you better use python script to prepare your search
and results and use its return value (usually prepacked, preformattet
data in lists and dictionaries) instead?

Links to index.html are also extremly ugly. Why not just link
to the container?

Regards
Tino Wildenhain 
___

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] autorefresh a web page every x minutes

2006-08-04 Thread Tino Wildenhain
Andreas Jung wrote:
> 
> 
> --On 4. August 2006 15:32:26 +0100 Alan <[EMAIL PROTECTED]> wrote:
> 
>> Dears,
>>
>> Is there a way of doing a particular page template (ZPT) keeping
>> reloading/refreshing itself every x minute?
>>
>> I hope so. Any help would be very appreciate. Many thinks in advance.
>>
>>
> 
> This is not a Zope question. Google for "meta refresh tag".

or google for real headers :-)

context.REQUEST.RESPONSE.setHeader('refresh','60')

for example.

Regards
Tino
___
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 use chinese character in zope 2.8.7

2006-07-29 Thread Tino Wildenhain
Chris Withers wrote:
> Mark Barratt wrote:
>> 2: In the root of the Zope Management Interface, choose the properties
>> tab. In it, add a new property called MANAGEMENT_PAGE_CHARSET of type
>> 'string' with value utf-8.
> 
> Actually, for hysterical raisins, this needs to be UTF-8 rather than
> utf-8 in order for the unicode property types to make themselves apparent.
> 
> Aside from this, use unicode for everything...


Btw, still waiting for comments, thumbs down/up for:

http://www.zope.org/Collectors/Zope/2148

cheers
Tino
___
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] Script execute with every request

2006-07-24 Thread Tino Wildenhain

Joshua Burvill wrote:

Hi,

 

I’d like to log certain parts of each request into a database table for 
every request to provide an audit trail.


 

I thought of inserting a  into the standard_html_header, 
but when there is a RESPONSE.redirect, it will not be the original 
request that gets logged.



Well that would mean 2 log entries - one from the redirecting
page and one from the target of the redirect.

Btw, its usually not the best idea if you can avoid it -
what about using the apache log facilities here?




Can anyone offer any suggestions?

 


Thanks, Josh


--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.394 / Virus Database: 268.10.1/391 - Release Date: 18/07/2006


 Ah, wasting cpu cycles for nothing :-)


Regards
Tino
___
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] default webpage after External Method script executed

2006-07-20 Thread Tino Wildenhain
Andreas Jung wrote:
> 
> 
> --On 20. Juli 2006 19:25:11 +0100 Alan <[EMAIL PROTECTED]> wrote:
> 
>> Hi!
>>
>> My simple webpage for submitting files is ok. It calls a External
>> Method script to do all the dirty job. However, I am running out of
>> ideas of how to get back to my default submitting web page after
>> submitting a file (and thus execute the script).
>>
> 
>  return self.context.REQUEST.RESPONSE.redirect(some_url_plus_query_string)

valid but very ugly. Why not just return the result of the call of a
template?

e.g. return self.zpt_or_whatever_template()

Or do all the form work in a python script anyway, which calls
the external method when everything looks ok and returns
with the template as above.

While I wonder what the mentioned dirty work really is...

Regards
Tino
___
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: [***SPAM*** Score/Req: 04.00/04.00] Re: [Zope] Catalog aware

2006-07-20 Thread Tino Wildenhain

Garito wrote:

Martijn Pieters escribió:

Please don't email me personally; let's keep this discussion on the list.

Garito wrote:
 

Yes, the indexes depends on the entity (I don't know what indexes I use
until I define the entity but I need to catalog every characteristic of
the entity)

For example if I have a entity with a container where to put my cousins
information I will catalog a keyword index called (is an example,
remeber) HowMuch that counts the number of the objects stored in the
container

Or if I talk about skills I will catalogue the marks or the way to print
the certificate of excelence (again an example)



But then you can create specific subclasses that are catalog aware. What
standard objects would you use to implement this? You have a specific,
non-generic use-case that has already been catered for by the framework.
  
I can't subclass every class I need. These will need to reajust 
(subclass) every new case

For example:
Now I know I need Page Templates and Script Python catalogaware, then I 
subclass them and I finish the work, good


But tomorrow I need a Mail host catalogaware, begin again and create a 
subclass for Mail host


haha. I wonder which property of that single MailHost object you
probably use you want to catalog and what exactly would be your
Query to the ZCatalog, once you want to find out...

I would like if there are a generic way to add catalogawareness by code. 
If there are my problem about catalogawareness finish


Speaking of code: did you think about my hint? I mean the one with
the loop - if you have the weird notion you need to make anything
catalogaware, why dont you write a product which iterates over
all other products in zope, and if not catalogaware, generate
a generic catalogaware subclass for you?

Heaven, you could even half way finished by the tiem you feed the thread :-)

Regards
Tino
___
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] Catalog aware

2006-07-20 Thread Tino Wildenhain

Garito wrote:

Tino Wildenhain escribió:

Garito wrote:

Tino Wildenhain escribió:

Garito wrote:
 

Tino Wildenhain escribió:
 

Garito wrote:
...
 
   
Sure, but I can't create a new product for every product I'll 
use only

to do it catalog aware, isn't it?


Yes you can. Why not? I mean you are using them - so you can use
your products instead as well.
  
Yes but what if tomorrow you create a product? need work to 
times: you

first, me later


Who says you have a use for the product I create? Or if it makes
sense to catalog it? If you want a cataloguing framework, why
dont you use CMF or something?


I want to make every class catalogable only if I point a zcatalog id
(with self.default_catalog) but If I point it I want to catalogue the
object



And what of the object do you want to catalog?
Which kind of indexes do you want it to support?
What kind of questions do you expect your ZCatalog
(hypothetically) answered? Could you give examples?
  
Is not important what I want to catalog, for me is important that the 
object *was* in the catalog (some catalogs indexes some properties 
some others other properties)


Please read the catalog section again: there isnt the object in the 
catalog!

Again: The object is _not_ in the catalog.
Its all about usefull indexes and maybe object metadata.
So again: _what_ actually do you expect to find?

When I talk about was in the catalog I mean the object is catalogued
I expect to find *the object* in the catalog

For example:

How do you know how many cousins you have? Because you are a catalog 
that catalog the number of cousins you have


So you want to count objects based on their meta_type?
Of what use would be such an information?
What if you know how many pagetemplates you have? :-)

Another example: how much skills about computing do you have? Again your 
skills are objects that you need (as a catalog you are) to catalog


We have a skills object in plain zope now? Thats news for me.

Like an entity (a thing, and object) you need to know some data stored 
in your life added to you


Yes, but a zcatalog cannot work with "some data" - you need to specify
exactly _which_ data you want to find. So what exacly is this on
standard Zope objects?
..


Yes, but its nonsense. You cant do anything more with the objects
in Zope if they are catalogued.
Are you sure? I can find them!!! Then if I can find them I can count 
them, give to you (even if its don't depend on me, remember your skills 
or your cousins?)


Ah yes, which zope product stores cousin data?



I want to create an object that acts like an entity (like a human or a 
mortage or a paper or a product -that you can sell)


Yes, you crate it - you define its cataloguing. So what is your business
with standard zope objects here?


These entity need to know how is it (its properties, its characteristics)


You cant barely catalog all properties - the catalog would not even know
if this property is meant as keyword or fulltext or whatever...

I ask myself if I know myself but I only know about myself all I can 
catalogue

...


Regards
Tino
I don't expect anyone guess my needs (is for that I need to develop the 
class) :)
I only ask if I can add some super classes to an object when  I create 
it :)


You can, you just add it. Its there and you even know its name.
So what was your problem again? :-)

I know my needs are so particular but I want to create something new 
with a new perspective. If I can the result will be very curious (I 
suppose, I expect even)


I choose Zope because is the most near to my finall result


Exactly :-)

Regards
TIno
___
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] Catalog aware

2006-07-20 Thread Tino Wildenhain

Garito wrote:

Tino Wildenhain escribió:

Garito wrote:
 

Tino Wildenhain escribió:
   

Garito wrote:
...
 
 
Sure, but I can't create a new product for every product I'll use 
only

to do it catalog aware, isn't it?


Yes you can. Why not? I mean you are using them - so you can use
your products instead as well.
  

Yes but what if tomorrow you create a product? need work to times: you
first, me later


Who says you have a use for the product I create? Or if it makes
sense to catalog it? If you want a cataloguing framework, why
dont you use CMF or something?


I want to make every class catalogable only if I point a zcatalog id
(with self.default_catalog) but If I point it I want to catalogue the
object



And what of the object do you want to catalog?
Which kind of indexes do you want it to support?
What kind of questions do you expect your ZCatalog
(hypothetically) answered? Could you give examples?
  
Is not important what I want to catalog, for me is important that the 
object *was* in the catalog (some catalogs indexes some properties some 
others other properties)


Please read the catalog section again: there isnt the object in the catalog!
Again: The object is _not_ in the catalog.
Its all about usefull indexes and maybe object metadata.
So again: _what_ actually do you expect to find?



 

Now is a search era, isn't it?



Yes, search for what and by whom is the question here.
  

I don't thing so. The question is who is in the catalog
 

Use another framework only to do the objects catalogable?

I love simple things



So why are you trying to make standard zope objects more
complicated? :)
  
More complicated? Sure, but I don't understand the cost to make every 
object in Zope catalogable. A class and a variable I don't thing is a 
big cost

And I thing in Zope when I thing in keep it simple


Yes, but its nonsense. You cant do anything more with the objects
in Zope if they are catalogued.


 
 
In my opinion (is only an opinion) these is not the best situation 
in a

future

Sorry but is not so acceptable for me


The point is, it makes no sense to catalog Pagetemplates,
Python Scripts, Folders and ZSQL Methods, Mailhosts
and Database connections. These are all standard zope
objects, yet they make catalogable content only in derived
work or when they play together - which is a custom
solution anyway. There you can add whatever cataloguing
awareness you want.


And if I use them dinamically (a user with the role1 use the template
Ver but a user with the role2 use the template Ver1 for the same
context)? (I'm not sure if I understand you clear, sorry If I make a
mistake, please



This would not be supported by just adding indexing to the standard
objects anyway. You would write a container which supports the bahavior
you want - and while you are at it you can easily add catalogawareness
to that - exactly where and in the way _you_ need it :-)
Individual objects cataloguing themself would get in your way.

Regards
Tino Wildenhain
  
Yes, I'm creating a specific container that works in a curious way. In 
that container I could catalog a Page Template when I'm adding it but 
perhaps sometimes I want to track its changes an so on



Yes, but who should know what _you_ want your objects to do? You cannot
expect all people (especially the ones writing zope core) to guess
your needs - you are the one to express your wishes in the form of
code :-) If you end up having a general solution (like these frameworks
are) you can share them with others.

Regards
Tino
___
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] Catalog aware

2006-07-19 Thread Tino Wildenhain
Garito wrote:
> Tino Wildenhain escribió:
>> Garito wrote:
>> ...
>>  
>>>>> Sure, but I can't create a new product for every product I'll use only
>>>>> to do it catalog aware, isn't it?
>>>>> 
>>>> Yes you can. Why not? I mean you are using them - so you can use
>>>> your products instead as well.
>>>> 
>>> Yes but what if tomorrow you create a product? need work to times: you
>>> first, me later
>>> 
>>
>> Who says you have a use for the product I create? Or if it makes
>> sense to catalog it? If you want a cataloguing framework, why
>> dont you use CMF or something?
>>   
> I want to make every class catalogable only if I point a zcatalog id
> (with self.default_catalog) but If I point it I want to catalogue the
> object

And what of the object do you want to catalog?
Which kind of indexes do you want it to support?
What kind of questions do you expect your ZCatalog
(hypothetically) answered? Could you give examples?


> Now is a search era, isn't it?

Yes, search for what and by whom is the question here.

> 
> Use another framework only to do the objects catalogable?
> 
> I love simple things

So why are you trying to make standard zope objects more
complicated? :)
>>  
>>> In my opinion (is only an opinion) these is not the best situation in a
>>> future
>>>
>>> Sorry but is not so acceptable for me
>>> 
>>
>> The point is, it makes no sense to catalog Pagetemplates,
>> Python Scripts, Folders and ZSQL Methods, Mailhosts
>> and Database connections. These are all standard zope
>> objects, yet they make catalogable content only in derived
>> work or when they play together - which is a custom
>> solution anyway. There you can add whatever cataloguing
>> awareness you want.
>>   
> And if I use them dinamically (a user with the role1 use the template
> Ver but a user with the role2 use the template Ver1 for the same
> context)? (I'm not sure if I understand you clear, sorry If I make a
> mistake, please

This would not be supported by just adding indexing to the standard
objects anyway. You would write a container which supports the bahavior
you want - and while you are at it you can easily add catalogawareness
to that - exactly where and in the way _you_ need it :-)
Individual objects cataloguing themself would get in your way.

Regards
Tino Wildenhain
___
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] Catalog aware

2006-07-19 Thread Tino Wildenhain
Garito wrote:
...
>>> Sure, but I can't create a new product for every product I'll use only
>>> to do it catalog aware, isn't it?
>>> 
>>
>> Yes you can. Why not? I mean you are using them - so you can use
>> your products instead as well.
>>   
> Yes but what if tomorrow you create a product? need work to times: you
> first, me later

Who says you have a use for the product I create? Or if it makes
sense to catalog it? If you want a cataloguing framework, why
dont you use CMF or something?

> In my opinion (is only an opinion) these is not the best situation in a
> future
> 
> Sorry but is not so acceptable for me

The point is, it makes no sense to catalog Pagetemplates,
Python Scripts, Folders and ZSQL Methods, Mailhosts
and Database connections. These are all standard zope
objects, yet they make catalogable content only in derived
work or when they play together - which is a custom
solution anyway. There you can add whatever cataloguing
awareness you want.

>>
>>  
>>> Can you say more about monkeypatching?
>>> 
>>
>> If you cant figure out (google, imagination)
>> you better dont do it :-)
>>
>> The code to monkey-patch is roughly the same
>> as subclassing. So you better just subclass
>> and use your products.
>>
>> Hint: you can use loops in python too .-)
>>
>> Kind regards
>> Tino
>>   
> A! sure, I'll searched at google!

great :-)

Regards
Tino


___
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] Catalog aware

2006-07-19 Thread Tino Wildenhain
Garito wrote:
> Tino Wildenhain escribió:
>> Garito wrote:
>>> Andreas Jung escribió:
>>>>
>>>>
>>>> --On 19. Juli 2006 09:34:58 +0200 Garito <[EMAIL PROTECTED]> wrote:
>>>>
>>>>> Andreas Jung escribió:
>>>>>>
>>>>>>
>>>>>> --On 18. Juli 2006 15:14:54 +0200 Garito <[EMAIL PROTECTED]> wrote:
>>>>>>
>>>>>>> Hi all!
>>>>>>>
>>>>>>> Is possible to create an object (for example a Page Template) and
>>>>>>> make it
>>>>>>> catalog aware?
>>>>>>
>>>>>> Look at the CatalogAware mixin class.
>>>>> But with this class I could create a new class of PT Catalog aware,
>>>>> isn't
>>>>> it?
>>>>> I would like to convert a normal PT is this possible?
>>>>
>>>> It makes little sense to index the contents of PTs. PTs are used to
>>>> present a view on a particular instance of your class but not for
>>>> providing content
>>>> itself.
>>>>
>>>>>>>
>>>>>>> I wonder why the objects aren't catalogable by default (I need
>>>>>>> all my
>>>>>>> object catalogables)
>>>>>>>
>>>>>>
>>>>>> Because Zope is not CMF and Zope is not Plone. Because you need this
>>>>>> feature it does not mean that everyone needs this feature by default.
>>>>>>
>>>>>> -aj
>>>>> Sure but Is the cost so big?
>>>>
>>>> This is not the question. If you need catalog awareness, either
>>>> implement it as stated above or use one of the frameworkslittle
>>>> need to discuss the pros and cons...by default Zope default
>>>> content-types  don't depend on the catalog. CMF and Plone depend on
>>>> the catalog for various reasons. If you have the requirement to use
>>>> a catalog you have the mentioned options.
>>>>
>>>> -aj
>>>>
>>> Yes but what about something like
>>>
>>> if self.default_catalog != '': self.reindex_object()
>>>
>>> ?
>>>
>>> I think it's a question of preferences
>>>
>>> Then can I "inject" Catalog awarness to an object?
>>
>> Yes you can. Its possible with so called monkeypatching.
>> However if you can do that, you better just write
>> a product w/ subclasses of the standard zope objects and
>> your CatalogAwareness. Its easy and clean and you dont
>> interfere with further development of zope.
>>
>> Regards
>> Tino
> Sure, but I can't create a new product for every product I'll use only
> to do it catalog aware, isn't it?

Yes you can. Why not? I mean you are using them - so you can use
your products instead as well.


> Can you say more about monkeypatching?

If you cant figure out (google, imagination)
you better dont do it :-)

The code to monkey-patch is roughly the same
as subclassing. So you better just subclass
and use your products.

Hint: you can use loops in python too .-)

Kind regards
Tino
___
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] external method with import tarfile

2006-07-19 Thread Tino Wildenhain
Alan wrote:
> Hi there!
> 
> I managed to find the problem and the solution.
> 
> First, I've forgot to mention that in my script, oname is an uploaded file.
> I just inserted a f.close() and voilá!
> 
> def upload_external(self,file,REQUEST):
>   import os,tarfile
> ...
>   f=open(oname,"wb")
>   f.write(file.read())
>   f.close()
> ...
>   tar = tarfile.open(oname,"r:gz")
>   for itar in tar:
>   tar.extract(itar.name,jobdir)
>   return "Done"
> 

Err. why not

tar=tarfile.open(fileobj=file) ?
Why bother with potentially name clashing
files in filesystem?

Regards
Tino
___
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] Catalog aware

2006-07-19 Thread Tino Wildenhain

Garito wrote:

Andreas Jung escribió:



--On 19. Juli 2006 09:34:58 +0200 Garito <[EMAIL PROTECTED]> wrote:


Andreas Jung escribió:



--On 18. Juli 2006 15:14:54 +0200 Garito <[EMAIL PROTECTED]> wrote:


Hi all!

Is possible to create an object (for example a Page Template) and
make it
catalog aware?


Look at the CatalogAware mixin class.
But with this class I could create a new class of PT Catalog aware, 
isn't

it?
I would like to convert a normal PT is this possible?


It makes little sense to index the contents of PTs. PTs are used to 
present a view on a particular instance of your class but not for 
providing content

itself.



I wonder why the objects aren't catalogable by default (I need all my
object catalogables)



Because Zope is not CMF and Zope is not Plone. Because you need this
feature it does not mean that everyone needs this feature by default.

-aj

Sure but Is the cost so big?


This is not the question. If you need catalog awareness, either 
implement it as stated above or use one of the frameworkslittle 
need to discuss the pros and cons...by default Zope default 
content-types  don't depend on the catalog. CMF and Plone depend on 
the catalog for various reasons. If you have the requirement to use a 
catalog you have the mentioned options.


-aj


Yes but what about something like

if self.default_catalog != '': self.reindex_object()

?

I think it's a question of preferences

Then can I "inject" Catalog awarness to an object?


Yes you can. Its possible with so called monkeypatching.
However if you can do that, you better just write
a product w/ subclasses of the standard zope objects and
your CatalogAwareness. Its easy and clean and you dont
interfere with further development of zope.

Regards
Tino
___
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] question on simple_send in MailHost

2006-07-19 Thread Tino Wildenhain

Andreas Jung wrote:



--On 18. Juli 2006 21:55:36 -1000 John Schinnerer <[EMAIL PROTECTED]> 
wrote:



Aloha,

I did try send() - it seems one must know something about RFC822 message
formatting to use it...?
I know nothing about that, and could not quickly find any clear and
concise howtos or tutorials, just verbose and confusing specs and mailing
list posts and so on.


Nonsense. The Python 'email' module is perfectly suited and documented 
(with examples). We use the 'email' module in various places for 
generating rfc822 compliant emails that are send through MailHost.send().


So you are writing a Product to enable it to python scripting? .-))

Well, its so easy... some of the beginners should be able to do it.

from AccessControl import allow_module, allow_class, allow_type

from formatter import BlockFormatter
from email.MIMEText import MIMEText
from email.MIMEMultipart import MIMEMultipart
from email.MIMEBase import MIMEBase
from email.Header import Header
from MailCrypt import signmail
from email.Encoders import encode_base64

allow_class(BlockFormatter)
allow_class(MIMEBase)
allow_class(MIMEText)
allow_class(MIMEMultipart)
allow_class(Header)
allow_class(signmail)
allow_class(encode_base64)


would roughly do it.
Pack it nicely, add some ZMI howtos
and be ready :-)

Regards
Tino Wildenhain
___
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] Using the DTML REQUEST Object

2006-07-18 Thread Tino Wildenhain
Muk Yan wrote:
> Dear Exalted Sirs and Madams,
> 
> I'm a Zope newbie, so be gentle.
> 
> I'm using DTML on Zope (yes I know Plone and Tal is now the norm) and

No, Plone has nothing to do with TAL (although it uses it too)
But nobody forces you to DTML either. You can use python scripts
and ZPT (TAL) is just easy - much lesser to type.

> I was wondering if regularly using the REQUEST(set and get) object is
> bad practice.

You should avoid that if possible.

> I'm mostly a C++ programmer and I know of the horrors of global
> variables, but I was wondering if there was any way to pass

DTML is pure horror in this regard. You see every little object/variable
everywhere. All namespaces are a big pile in DTML. You will have
a hard time finding out if a value comes from REQUEST, REQUEST.form,
Property, Object somewhere down the aquisition path or even local
loop and  namespaces.

> information from DTML Documents to DTML Methods and vice versa (and
> maybe from DTML Methods to DTML Methods) without using the REQUEST
> object.
*shiver* You need to have a good portion of masochism to work with
that ;) But you can call DTML with DTML too. (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 Method Question

2006-07-18 Thread Tino Wildenhain
Peter Bengtsson wrote:
> What if you have 1,000,000 requests/sec?
> What if between the INSERT and the LAST_INSERT_ID() another INSERT is made?
> 
> I use PostgreSQL and with postgres you can always ask the sequence what
> the next id is going to be. It goes something like this::
> 
> next_id = context.GetNextId()[0].next_id
> context.SQLInsertUser(uid=next_id, name='Peter')
> 
> where 'GetNextId' is a ZSQL method that looks like this::
> 
> 
> SELECT NEXTVAL('users_uid_seq') AS next_id

Its even easier:
one ZSQL Method:

INSERT INTO foo (foo_id,blah,bar) VALUES
(nextval('foo_foo_id_seq'), ... );
SELECT CURRVAL('foo_foo_id_seq') as foo_id;

But your above solution is valid too.

Regards
Tino
___
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] attaching an image to an email

2006-06-29 Thread Tino Wildenhain

Kate Legere schrieb:

I get a result like :

Cv/Y/+AAEEpGSUYAAQEBAEgASAAA/9sAQwAHBAQEBQQHBQUHCgcFBwoMCQcHCQwNCwsMCwsNEQ0N
DQ0NDRENDxAREA8NFBQWFhQUHh0dHR4iIiIiIiIiIiIi/9sAQwEIBwcNDA0YEBAYGhURFRogICAg
ICAgICAgICAgISAgICAgICEhISAgICEhISEhISEhIiIiIiIiIiIiIiIiIiIi/8AAEQgGggXsAwER
AAIRAQMRAf/EABwAAAMBAQEBAQEBAgMEBQYHCP/EAD8QAAICAgEDAwMDAwMDBAEA
CwABAhEDITEEEkEFUWETInEGMoEUQpEVobEHI1IzYsHRFuHxJDRyFyVDgvCS/8QAGwEBAQEBAQEB
AQAAAQIAAwQFBgf/xAAmEQEBAQEAAwEBAQEAAgMBAQEAARECEiExA0EEE1FhFCIyQgVx
/9oADAMBAAIRAxEAPwDcrUANTIToYo6fIxg2gaQnoRTS+2w1NNcDqp8F+QtEinXv/Bt00d3KDGh9
y7fk2e04Nsel4EESHvYkl3XZg1jmlEkto541tCS7YSdozMc0EjajqM1Ois1pVLKQ6ah5P8lSJp4m
Zl2ONafdRsCO9sLG1dU9GI+4cbQrMxXT4MTUv8mwYrXkNaG6H+mnYW+xaYX22l5HGJOXDGBbQ4yd
0Ta2ntCQ/kGCUTWsONBp6p1E2Jg4M0+jRRPlEYDVUUqlHgYLRFhcjG3oolbS0DWm+QiaezMSsMOG
noWGgow0xjYTZoo6sqAqJY3wMmjB4sabDRIgQnAFbQjUGkbGIY2m6s2qGgtTgAhsrG1VLySaRX8T
h34omGk03+CgS5GqPkIxpsbQf/JNY+NmlYas0OEmr2UIewgI1UafkGlCEAW0GY7XsZh4J1tFeSrT
gdoxweTYB/cDaO73MKfd7CcLkax+CAEJH1ci/BsGj+qjwwxpSeaNa5EpUm2ONYuKfINFXQtTsAX4
GNqqsKxPRoQYWn8oohvRFgBQPYqFEsH8mBxoxLjYwDnbMSMDS9zaSto0B2mT8po2uB6ZX1J0iQpZ

... it's longer but you get the picture. 


yes I get it, its an JPEG 1516x1666.
Perfectly except for the extraneus \n
(linefeed) in front of it.

Thats the problem with DTML :-)
You can work around it when you dont have
newlines between the tags...

Regards
Tino
___
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] Content Disposition - Download files

2006-06-26 Thread Tino Wildenhain



context.REQUEST.RESPONSE.setHeader('Content-Disposition','attachment;
filename=%s' % context.getId())


Nice idea, but what i need is different. In PHP there is a function
called readfile, i'm sure there is something also in Zope, but i'm not
able to find it!


No, I can tell you you are on the wrong path. Zope isnt PHP. Dont try
to follow old PHP patterns with Zope.
(Of course you could read the file object data but this inefficient)

What is the problem with above solution?

Regards
Tino
___
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] Content Disposition - Download files

2006-06-26 Thread Tino Wildenhain

Bruno Grampa schrieb:

Hello,
i want to send an image or a pdf  to a browser not for viewing but for
downloading.
I've written this code:



now i have to send the file as a binary flow, but i don't know how to
do. Can you help me?



Do you plan to always send the file for download?
Then you just put a script name into "precondition"
field of the object. The script could be something
like:

(Python script)

context.REQUEST.RESPONSE.setHeader('Content-Disposition','attachment; filename=%s' % 
context.getId())



Regards
Tino Wildenhain
___
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] Searching for and displaying properties

2006-06-24 Thread Tino Wildenhain
Sinang, Danny wrote:
> Dear All,
>  
> I managed to add a property to an object by using the manage_addproperty
> () method.
>  
> However, if I don't issue a manage.reindexIndex () for the new property,
> it won't come out in the catalog search results.

manage_addProperty does not trigger recataloguing of the object even
if its a subclass of CatalogAwareness. You should either call
obj.reindex_object() or at least obj.index_object(), if your
class has the CatalogAwareness-Mixin or you use the catalog API:

yourcatalog.catalog_object(obj,obj.absolute_url_path())

After that, your metadata should show up nicely w/o indexing
the whole object tree.

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


  1   2   3   4   5   >