[Zope] Re: ZPT and attributes

2005-04-08 Thread Josef Meile
Hi Antonio,

Hi all:
How I can create attribute names dynamically?
tal:attributes=attributename expression

Sorry, I haven't explain the problem correctly :)
The problem is the number of refX depends on the list of urls, i.e. if
I have ['http://foo', 'http://boo', 'http://google.com'] then I create:
books ref1='http://foo' ref2='http://boo' ref3='http://google.com'
but with ['http://foo'] I create:
books ref1='http://foo'
How I create refX?
Greetings.

For example, I want something like this:
books  tal:attributes=ref1 string:http://boo;;
 ref2 request/URL3 /
And so on.
I think you are using zpt for the wrong thing. For me it seems that what
you should use would be a xml product like ParsedXML. I haven't used it,
but I have taken a look at the source code of Silva and saw that it may
be possible to create dynamic attributes with a setAttribute or some
thing like that.
Regards,
Josef
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Re: Question regarding changing Zope site to another distro

2005-04-22 Thread Josef Meile
Hi Mário
Now...
I think my Zope is suffering from arthritis :(
I can't undo any more, either in Zope nor Plone and i can't compress
Zope's database without getting an error and... no database compressed.
As if you care to rapidly browse the site, you will see it is indeed a
small one, but the /usr/local/zope .bz2 tarball is already at 1 GB and
increasing.
Well, if you want somebody able to help you, you should post the error
you got + a traceback.

Does this sympthoms means that i'm going to have troubles now migrating
to RHEL 4 ?
Perhaps your Data.fs is corrupted or something like that. If I'm not
wrong, there was a bug when packing the ZopeDB on that zope version.
Somewhere on the zope hirarchy there is a script to repair this (look
the archives). Anyway,  if I were you, I would try to solve the problem
before migrating and off course do a backup before trying something.
Maintaining the Zope and Python version of course and the same scheme.
I don't want to upgrade Zope, nor Python, nor Plone.
You don't have to upgrade, but the new versions have some important bug
fixes. I'm also using the same zope as you and I really want to migrate
it. But first I have to migrate some ZClasses stuff :-(
Regards,
Josef
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Re: Forcing all Zope access to come through an Apache/SSL proxy

2005-04-28 Thread Josef Meile
Hi,
I saw that others already answered to your question; however, they use
the proxy module and you are using rewrite, which is what I use:
IfDefine SSL
VirtualHost YOUR_IP:443
  ServerName your.domain.com
  ServerAlias your.domain.com *.your.domain.com
  SSLEngine on
  SSLCipherSuite 
ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
  SSLCertificateFile /usr/local/apache/conf/ssl.crt/server.crt
  SSLCertificateKeyFile /usr/local/apache/conf/ssl.key/server.key
  RewriteEngine On
  RewriteRule ^/(.*) 
http://localhost:8080/VirtualHostBase/https/your.domain.com:443/VirtualHostRoot/$1 
[P,L]
/VirtualHost
/IfDefine

Note: this module also depends on the proxy module, but the sintax
is diferent.
Regards,
Josef
Reuven M. Lerner wrote:
I've written a Zope application that needs to be behind SSL.  I assumed 
that the most straightforward way to do this would be to (1) set up Zope 
on port 8080 and (2) use Apache to act as a proxy between the outside 
world and Zope.  Unfortunately, while it was a piece of cake to set up a 
proxy for non-SSL access to Zope, I'm rather stumped regarding SSL.  
I've done non-SSL proxying for years with mod_rewrite, and it was really 
a snap, so I'm surprised that this is so difficult.

Zope is working just fine when I access it directly (using HTTP) on port 
8080.  I have installed the (self-signed) SSL certificate into Apache 
without any trouble, and am able to access individual documents on disk 
via SSL, using Apache.  So if all I would want is to use Apache with 
SSL, I would be done by now.
Here is the relevant portion of the Apache configuration file (with 
names and numbers changed somewhat):

   VirtualHost 66.123.23.17:443
   ServerName myserver.com
   ServerAdmin [EMAIL PROTECTED]
   SSLProxyEngine on
   RewriteEngine On
   RewriteRule ^/(.*)
   http://localhost:8080/VirtualHostBase/https/myserver.com:443/app/$1
   [L,P]
   /VirtualHost
The above should make it possible (I believe), an HTTPS connection 
between my browser and my cup.  Apache should then take that incoming 
SSL request and issue its own request to the Zope server.  Zope will 
respond, sending it back to Apache, which (in turn) sends it back to me.

But of course, that doesn't happen.   Zope's provides indicates that 
many of the requests begin with \x80g\x01\x03.  My guess is that the 
SSL request is being piped to Zope directly, but it's hard to know from 
just a few characters.  Does this mean that I need to do some more 
translating, from HTTP into HTTPS?  
Not that it should make any difference, but I'm running Apache 2.0.52 on 
Red Hat Enterprise 4.0, with Zope 2.7.5 and Python 2.3.4.

Thanks in advance for any advice you might have,
Reuven
___
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 )


[Zope] Re: How do I logout using DTML

2005-05-12 Thread Josef Meile
How do I logout current user using DTML
I used dtml-call expr=acl_users.logout(REQUEST) but it didn't work 
and zope gave me this.
 

Site Error
An error was encountered while publishing this resource.
*Error Type: AttributeError*
*Error Value: logout*
**
 
*What did I do wrong??*
You didn't specify which user folder you are using and if, for example,
you use it with CookieCrumbler or other pluggins. If you use
CookieCrumbler, then you can expire the authentication cookies like
this:
dtml-call REQUEST['RESPONSE'].expireCookie('__ac', path='/')
dtml-call REQUEST['RESPONSE'].expireCookie('__ac', path='/')
I think a redirect is also needed, but I'm not sure.
If you aren't using CookieCrumbler, then you can try the method
described here:
http://zdp.zope.org/projects/zfaq/faq/General#973291635
Regards,
Josef
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Re: Managing Users with Postgresql.

2005-05-14 Thread Josef Meile
Hi Fernando,
I have a Postgresql database that stores all users, and booleans which 
describe permissions. The users log on in my application using a 
WebForm, I run a ZSQL Method and set all permissions in the Session.

I manage the security using Session calls, checking each permission and 
then allow or deny access to the object.

I know that it isn't the best solution, and now I want to change it! :)
Which is the best solution to solve my problem? I found pgUserFolder. 
But I'm not so sure if this will be the best solution.
I installed that user folder once and worked perfectly. There you can
manage the permissions and roles directly from zope. The folder offers
you the possibility to map the authenticated users to a zope role and
you can also use the local roles from the zopeDB. However, you will have
to create some sql methods to migrate your users db to the pgUserFolder,
but I think it is not difficult, you just have to see how users are
stored there.
Regards,
Josef
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Re: How do I logout using DTML

2005-05-14 Thread Josef Meile
Dear Allen,
please post your replies to the newsgroup as well.
I tried both yours and the dtml-raise methods, but both of them didn't 
work.
With yours I redirect myself out but I still logged in.
With dtml-raise Unathorized, it popped out an password query box and 
kept ask me to input password for three time and went to an error page 
and I'm still logged in as well.

Did I do anything wrong??

The dtml-raise should work. I don't know why isn't workning for you.
Perhaps you stored the password in the browser or something like that,
try deleting the stored passwords. About the popup window and the error
message, as Jens post in the other message you started, this is the
normal behaviour and can't be avoided. One way I can think about solving
this behaviour is storing a hidden input field like go_to_logout, then
check the request in the standard_error_message when an unauthorized
exception occures and close the window with javascript if such variable
is found. I know that zope can access the variables on the request after
an error happens, but I'm not I'm not sure if this is going to work with
an UnauthorisedException.
For the second approach with the authorization cookies, you first have
to make sure that you have installed CookieCrumbler and that you have
created an instance of it. After doing this, the expiration cookies
method should work. Once you install CookieCrumbler, you can modify the
default login forms if you want.
Regards,
Josef
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Re: Where can I found hot_plug function of zpi.zope ?

2005-05-24 Thread Josef Meile

Hi Stépahne,


I search the definition of hot_plug function.

I look it at CMFQuickInstallerTool/QuickInstallerTool.py file. The 
line code is that :


from zpi.zope import not_installed, hot_plug

I not found hot_plug function in my Product/ directory and not in Zope 
source. Where can I found it ?

I don't know where the function is, but if you are using linux you could
try:

% grep -r def hot_plug *.py

and in windows, just use the Built-in search feature and introduce as
filename *.py and in the text field insert def hot_plug

Regards,
Josef

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

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Re: Where can I found hot_plug function of zpi.zope ?

2005-05-26 Thread Josef Meile
Sadly, as of Windows XP, this is broken beyond use: it simply doesn't 
find some stuff in certain files, like .py files, for example :-(


Install cygwin and use grep there, if you really have to stay on windows 

There is no need of installing that big monster :-). You can also
install grep for windows:

http://gnuwin32.sourceforge.net/packages/grep.htm

or MSYS, which also has a grep utility and is even smaller than cygwin,
which I think isn't worth to install if you only want to use the grep
utility.

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

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Re: Opening .doc files in zope

2005-05-27 Thread Josef Meile
The short answer is it depends.  To make such files generally available 
you have to convert them to HTML so arbirary browsers can access them.  
You can use MS Word to do the conversion.  If your Zope is running on a 
Windows machine that also has Word, you can manage the conversion 
dynamically using an External Method or a Product (which you'd have to 
write).  Alternatively, you could store the MS Word document in it's XML
form and use that to drive the rendering.   If you are not interested in 
general availability and you users are all running Windows with Word 
installed, you can configure IE, I believe, to render Word documents 
directly.

In addition, you could use the wmWare libraries to convert the word
files to html/pdf, but they don't work well with complicated word
documents. You can download there here:

http://wvware.sourceforge.net   - linux
http://gnuwin32.sourceforge.net/packages/wv.htm - Windows

Regards,
Josef

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

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Re: Creating links dynamically

2005-06-01 Thread Josef Meile

Hi John,


The CMF's ActionsTool is a prime example for such
a link factory. CMFDefaults main_template.pt demonstrates
how to iterate over the links generated by portal_actions
(the ActionsTool instance in a CMF site).



Does that mean creating a CMF site?

I'm finding it hard enough figuring stuff out without adding CMF into the 
mix...


No, you can already do lots of things without CMF and using ZPT and
python scripts. You asked for a working example, so, Dieter pointed you
out to a feature of CMF that does it. Anyway, for the task you need, I
think the example of Vital will do the job.

It's up to you wheter or not install CMF or other Content management
system. After all everybody has diferent needs.

Regards,
Josef

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

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Re: External editor for ZMI

2005-06-27 Thread Josef Meile

Do you mean this?

http://plope.com/software/ExternalEditor

Are there any screen shots of it in action?

I'm not exactly sure how it works, but have feeling it won't work for me.

Yes, that's what Paul meant. I tried it once and it is not difficult to
install. You just have to follow the *README* and configure it to start
the editor you want according to the file type. You can edit word and
excel files, bitmaps, python scripts, dtml, zpt, and much more. Off
course you need to have the editor programs installed on the client
machine.

There were some bugs with excel and word, but I read in the link you
posted that they are likely solved (or I hope so :-)).

Regards,
Josef

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

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Re: question on python script, dtml method and options

2005-07-19 Thread Josef Meile

Hi Erik,

I don't get a traceback, i just get error and message back as empty 
strings; their initiallized value.


very strange.

Looking at your python script I saw that initially you set error and
message to the empty string ''. I guess the script is not detecting a
'next_state' keyword in the request. So, it is excecuting the first if
of your code:

if not request.has_key('next_state'):
  return container['MAIN'](context, request, error=error, message=message)

Where are you initializing 'next_state'? Try printing the request
object to see if it really exists or perhaps you are doing some typo.

Regards,
Josef

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

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Re: Connect to ms sql server from zope 2.8 on windows s erver

2005-07-20 Thread Josef Meile

Hi,


AJ Look at mxODBC or the latest version of ZODBCDA from zope.org.

I'm free download egenix-mx-base-2.0.6.win32-py2.3.exe.
I have install zope 2.8 for windows.
I could not install egenix-mx-base-2.0.6.win32-py2.3.exe. Becouse it
could not find python in registry.

How to install egenix-mx-base-2.0.6.win32-py2.3.exe without python in registry.

Please help me.

You have three alternatives (perhaps four if you consider linux):

First alternative:
1.1 Install the python 2.3.4 binaries (the python that comes with zope,
isn't logged on the registry, so, you can't use it)
1.2 Install the the egenix binaries
1.3 Copy the egenix installed files to:
 C:\YourZopeFolder\lib\python
 If I'm not wrong, the binaries are installed on :
 C:\python2.3\lib\python2.1 - Make sure that you don't overwrite
 something in the zope's python. You can download the source code
 of egenix to have an idea of the files it installs
1.4 Uninstall python if you want

Second alternative:
2.1 Create a folder called Python in C:\
2.2 Create manualy this registry key:
 [HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.3\InstallPath]
2.3 Set its value to C:\Python
2.4 Install the egenix binaries (they will be installed somewhere on
C:\Python).
2.5 Copy the egenix installed files to:
 C:\YourZopeFolder\lib\python
2.6 Delete the registry key

Alternatively to step 2.2, you can get this registry file:
http://www.zope.org/Members/SmileyChris/HowTo.2005-02-06.0339/pil_for_windows_fakepython.reg
Before double clicking on it, change the 2.1 by 2.3 in your
preffered text editor. Then you can double click on it and it will
automatically install the key. Be aware that the key will remain on
the registry till you manually delete it.


Third alternative: Install python from source and then egenix. Here
you need a C compiler. Finally copy the egenix files to
C:\YourZopeFolder\lib\python

I hope this was usefull. I did alternative 2 once and it worked. I
haven't tested it recently, so, I can't guarantee it.

Regards,
Josef

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

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Re: question on python script, dtml method and options

2005-07-20 Thread Josef Meile

Hi Erik,

next_state does get initialized - it is the name of the submit buttons 
on my various forms.

So, then it should be in the request object. Just to test it, put the
following at the begining of your python script (You don't have to
delelete anything):

return request

Then submit the form that calls the script and check if next_state is
really a key in the request object. On the contrary, it could be an
error in the html code where create the form.

Regards,
Josef

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

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Re: dtml-var variable from REQUEST not shown in input tag if it has spaces??

2005-08-04 Thread Josef Meile

Hi Thomas,


When i just use it as dtml-var sSQL everything is
ok.
When i use it like : input type=text
value=dtml-var sSQL, i get everything until the
first space. For example from select * from mytable
i get select.

I'm not sure, but don't you need to enclose it with double quotation
marks? Something like this:

input type=text value=dtml-var sSQL

You can also try:

input type=text value=dtml-sSQL;

Regards,
Josef

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

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Re: howto i18n?

2005-08-10 Thread Josef Meile

Hi Vlada,


for now I use the Zope 2.7.5 tarball. I write freelance (not bound in a
product) page template and wish it to be i18n'ed. I have appropriate
tags inside and the domain set at the top. There is also Plone with its
products in that instance.

Where should I put the PO files, so the messages can be substituted?

Normally you have to put them inside a i18n folder located in your
product tree. However, according to your message, you don't have a
python product, so, I guess, you have to look for the plone's i18n
folder and put your PO files there. The only problem I see here is that
you have to remmember it every time you update plone.

I'm not sure if this would work: you could try to create a dummy folder,
let's say MyTranslations, inside the Products folder of your instance.
Then create an empty __init__.py file and add a 18n folder to put your
PO files.

Regards,
Josef

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

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Re: zope.org site and limited search results

2005-08-16 Thread Josef Meile

Hi,

few times ago I was few times wrote to ZC webmaster about limited query to 
Zope Products search results (see attached picture) - in any case it does not 
find more than 200 results. Nothing to do. If somebody has enough power to 
initiate zope.org webmaster, please tell him about change number of results 
from database at advanced tab of appropriate ZSQL method (if it is not 
defined somewhere else).


Note, that old zope site does not has this limit.

Then you may try to post a bug in the collector of the zope.org site:
http://www.zope.org/Collectors/ZopeOrg

Regards,
Josef

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

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Re: OOP and Zope.

2005-08-22 Thread Josef Meile

Dieter Maurer wrote:

Fernando Lujan wrote at 2005-8-19 12:16 -0600:


I try to find information about programming in Zope with the OO
paradigm. I didn't find many documentation...

For instance, how can I define classes and instances once I just work
with dtml-methods and dtml-documents?



You can look at ZClasses.

Note, that there are people that recommend not to use
ZClasses because they want to drop ZClass support in some
future Zope release.

Yes, some people wants to drop them, but that is just a part of the
problem. Their bugs aren't a priority know, so, if I were the OP, I
wouldn't use them for a new development. I would use python based
products, which are also OO.

Regards,
Josef

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

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Re: OOP and Zope.

2005-08-26 Thread Josef Meile
I bought the book... But while it don't arrive, let me ask a last question... 


Is there a tutorial which allows me to work with pages in the .py
format? Then, I could only use python to generate the content... :D
I've seen a lot of pages in this format... Does Zope works with it?
If you mean to embedded html in python, it is possible, but not elegant. 
That's why there is zpt and dtml; to separate content from logic. 
However, there are some cases you may need to do it.


Anyway, if you still want to do it, then you can do something like:

def myPage():
  Generates html
  html =  \
  html
body
  This is a test
/body
  /html
  
  return html

Regards,
Josef

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

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Re: NauScheduler problem

2005-08-26 Thread Josef Meile

Hi Barry,


I'm getting an attribute error when I try to run Zope
2.7.6, which is occurring when NauScheduler starts up:

AttributeError: ignoreLater

[...]  



schedule.ignoreLater()

AttributeError: ignoreLater


It means that the object schedule doesn't have or can't access a method
called ignoreLater. With it can't access I mean that the object is
there, but it is broken.

Looking at the source code of the NauScheduler, I saw that the
__init__.py file checks for an instance of the ScheduleList class,
which has the same id and if I'm not wrong it is created the first
time that you create a NauSchedulder object in the ZMI, then the
absolute path of the new created object is added to a path list inside
the ScheduleList object. So, it means that somehow you already tried
to create a NauScheduler Object, but something when wrong causing either
the creation of a broken object or the object wasn't created at all, but
its path was stored in the ScheduleList. And I think that's why you
get AttributeError: ignoreLater because None or a broken object
don't have or can't access the ignoreLater method.

So, my suggestion is:

1)  Make a backup of your Data.fs
2)  Remove the NauScheduler Product from your Products folder.
3)  Restart Zope
4)  Remove the NauScheduler objects
5)  Remove the ScheduleList object.
6)  Stop Zope
7)  Move the NauScheduler again to the Products folder
8)  Restart zope
9)  Watch at the console to see if an error is printed
10) If no errors are printed, then try to create a NauScheduler object
and see if it works.

 I am using NauScheduler on other windows and unix
 systems.  But have not seen this problem before.  Can
 anyone help?  Below is the traceback.

Another possibility is that you are using a Data.fs comming from a unix
system into a Windows XP PC and somehow the import of the instances 
wasn't successful. If this is the case, the question is: did you make

sure to first install all the products you are using in linux before
moving the Data.fs? But I'm especulating here since you didn't give
details about the installation (ie: was it a clean zope installation or
did you migrate a Data.fs from unix to windows?)

Regards,
Josef

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

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Re: useradd command in Zope

2005-11-03 Thread Josef Meile

Hi ajit,


   i don't think this is non-zope question bca'z...

   i am using python script to add user to system which works fine 
when run outside of zope ...
  but when i run it through zope as external script (with all 
permission) it's not working and returning 256 without giving any error...

That's because the user running zope doesn't have any root privileges
and a external method is run as this user and not as root.

Anyway, I just don't think it is safe to allow an zope admin user to
create users in your operating system. What if your zope admin password
gets hacked? Then the hacker could easily create a user in your machine
and gain access to it as well. Why don't you do it directly by following
the old way: logging in to the unix console, su to root and then
calling useradd?

Anyway, if you still want to do this, then you have to use sudo as
Andreas said. Other alternatives would be:
1) Run zope as root.

2) use set-user-ID or set-group-ID (man chmod) with a C binary that
   calls useradd

3) Add your zope user to the group of root.

Those two things are too dangerous. If I were you, I wouldn't consider
any of them; however, it is up-to-you to decide this.

Regards,
Josef

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

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Re: useradd command in Zope

2005-11-07 Thread Josef Meile

 su zope (or whoever your zope runs)
 ./yourmethod.py someuser somepass

 You will see it fail (apart from the fact you need
 the #!/path/to/python.bin and set the execution bit
 with chmod a+x before you try)


 i tried using another user outside of zope .
  working very well(adding user to system)
Perhaps the other user is either root or it belongs to the root's
groups.

  owner of external method is root and set_user_id bit is set.
  but problem is when i run attached app it is not adding user 
set_user_id only works with C binary files. So, here you have to use
sudo as suggested.

Regards,
Josef

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

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Re: Translating a webpage

2005-12-06 Thread Josef Meile

Hi Sam,

 I've read about using .po files.  Is  there an easy

way to hook these up to Zope? Any help would be greatly  appreciated.

Yes, there are two alternatives:

PlacelessTranslationService and Localizer both of them allow you to use
po files and negociate the language according to the browser settings or
cookie based (Localizer allows you also a path based negociation ie:
/en for english, /de for german). If you only need to translate label
messages and small paragraphs, then PlacelessTranslationService will be
the way. Localizer can also do the same as its competitor; additionaly
you can also define localized contents (ie: you can have two versions of
a page and they will be selected according to the browser language).

Some days ago, I also read something about integrating the Zope 3.x
translation technolgy into zope 2 using five; it seems interesting as
well:

http://worldcookery.com/files/fivei18n

Regards
Josef

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

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Re: ZClass - object is broken

2005-12-14 Thread Josef Meile

Hi Jens,


i have a little Problem with an old self-made ZClass-Product named CMSFolder.
Allready existing objects of CMSFolder are broken since the last restart of the 
instance.
It is really strange because there is no broken-sign in /Control_Panel/Products.

It is still possible to create new objects with CMSFolder, but if i restart the 
instance, the new objects are broken too.
CMSFolder is folderish and it's subobjects of other meta_types are still 
accessable!

Now that you said folderish and ZClass, I recalled a bug when migrating
from zope 2.5.1 to 2.6.0, but I can't assure if it is the same bug since
you didn't mentioned your zope version and if you were either or not
migrating from a previous version. The message is also different, but it
could be related. Anyway, just in case you migrated from zope 2.5.x to
2.6.0, you could try:

http://www.zope.org/Members/jmeile/upgradingZope

I don't know if this also affects versions  2.6.0 because by that time
there was only 2.6.0/2.6.1 available. This small article assumes that 
you still have your Data.fs from the old zope instance. If not, the only

thing I could think about would be to downgrade, check that everything
works, and then upgrade following the instructions - I'm not sure if
this may work; I've never done such thing, for I always keep a backup of
my old Data.fs

By the way, before doing anything, make a backup of your Data.fs file
and then try the instructions.

It could be also that you forgot to install a product you used in your
old zope into the new one, assumming again you were migrating. So,
check the products folder.

By the way, posting your zope version, whether you migrated or not, and
the previous version you had before migrating would be useful in order
to get more help from the list.

Regards,
Josef

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

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Re: Cookie Crumbler

2006-01-05 Thread Josef Meile

Hi Infor,


I found that my weakness is that I am DTML scripter. After printing the Cookie 
Crumbler source code,
 I need some help/advice as how to access the Cookie Crumbler methods 
or api from DTML.  I have searched

 the Zope documents however have found none that can help.


I would appreciate some advice or pointers.
Thank you.


Infor Gates info_gates-/[EMAIL PROTECTED] wrote: Dear zopist

I have a trying time using Cookie Crumbler 1.2 with Zope2.8.4 (windows version).
I could NOT figure out how to log out a user.  I have simplified to the orginal 
logged_out form to this:

dtml-call RESPONSE.expireCookie('__ac_name')
a href=/manage_zmi_logoutlogout/a

Except for the /manage_zmi_logout part, I'm using some similar
script. I'm using it on zope 2.6.4 and it works. I don't know if
it works in 2.8.4. Anyway, here it is:

dtml-call REQUEST['RESPONSE'].expireCookie('__ac', path='/')
dtml-call REQUEST['RESPONSE'].expireCookie('__ac', path='/')

Note: Yes, I expired the cookie twice. If I'm not wrong, I recall to
have had problems with only one call (Not sure).

Regards,
Josef

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

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Re: installing PIL on Window Zope

2006-02-16 Thread Josef Meile

Yes, I got that too long time ago when working with Zope 2.7.2 and
python 2.3.3. At that time I did the following in the python shell:

import PIL
PIL.Image

But I got as well:
AttributeError: 'module' object has no attribute 'Image'

Then I tried this:

from PIL import Image as PilImage

and it worked. Perhaps you are having the same problem.



import PIL.Image works too.

Image is the module in the package PIL.

Yes, I know that too. I used the as PilImage sintax in order to avoid
conflicts between the PIL Image and the Zope Image modules

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

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Re: How do I do this using Zope?

2006-03-06 Thread Josef Meile

Never heard of Inungo. Is it easier to use than Plone?



Google is your friend - iungo.org



I know that Google is quite clever but Googling for Inungo did not lead me 
to iungo.org


:-) 

Yeah, you are right :-)

Actually Andreas misspelled it in his first post. He wrote Inungo 
instead of Iungo. So, google is only your friend if you feed it with

the right keywords ;-)

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

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Re: Zope User in Apache Logs

2006-05-17 Thread Josef Meile

Dear list,

I've been going through the list archives looking for tips on logging 
(getting sensible statistics from my log files).
At the moment I have the setup recommended by most posts, namely 
multiple Apache virtual hosts that proxies requests to a single Zope 
instance.


I would like to know how I can get Apache to log the current Zope user.
Here's an example from my Apache access_log:
10.0.0.100 - - [02/May/2006:15:32:18 +0200] GET / HTTP/1.1 200 35721

Which results in this entry from my Z2.log:
127.0.0.1 - adp [02/May/2006:15:32:21 +0200] GET 
/VirtualHostBase/http/mysite.com:80/vhosts/mysite.com/VirtualHostRoot/ 
HTTP/1.1 200 36054  Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; 
rv:1.8.0.2) Gecko/20060308 Firefox/1.5.0.2


The current user is logged by Zope, but not by Apache.
Is there a way to make Apache aware of who is logged in through Zope?

I'm also trying to do the same thing. I want either to modify the zope
log in order to show the real user IP and replace the referrer by the
one the user typed in the browser (without everything between
VirtualHostBase and VirtualHostRoot) or just return the authenticated
user to apache.

I read the answer from Dieter and unfortunately I'm not authenticating
from Apache. So, I went for the approach indicated by Chris Withers
without any success:

 If your Zope auth solution can put a header in the http response, 
then  you can use a custom apache logging directive to put this in your

 Apache log in place of what it thinks the username is.
I put this on the log method of the medusa/http_server.py file:
self.response.setHeader('remote_user',name)

and set my apache access log like this:
CustomLog /home/apache/httpd/logs/access_log combined

The combined log is defined as follows:
LogFormat %h %l %u %t \%r\ %s %b \%{Referer}i\ \%{User-Agent}i\ 
combined


There you see the %l and %u directives, which are the Remote logname 
and the Remote user.


But apache still doesn't get the zope authenticated user. So, Chris, do 
you remember what header you set, where, and which method you used?


On the other hand, I also tried to do it the opposite way: modify the 
zope log in order to show the real ip address and remove every 
VirtualHost info from the referrer. I achieved the first part by using 
the following patch:


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

Then I tried the following in the log method of the 
medusa/http_server.py file:


referer=getattr(self,'VIRTUAL_URL_PARTS',None)
#I tried this as well
#referer=getattr(self.request,'VIRTUAL_URL_PARTS',None)
if not referer:
referer=self.get_header('referer')
if not referer:
referer=''
else:
referer='/' + referer[1]

But it seems that I can't access the 'VIRTUAL_URL_PARTS' key. How can I 
get this information?


Thanks in advanced,
Josef

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

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Re: Zope User in Apache Logs

2006-05-17 Thread Josef Meile

I read the answer from Dieter and unfortunately I'm not authenticating
from Apache. So, I went for the approach indicated by Chris Withers
without any success:

  If your Zope auth solution can put a header in the http response, 
then  you can use a custom apache logging directive to put this in your

  Apache log in place of what it thinks the username is.
I put this on the log method of the medusa/http_server.py file:
self.response.setHeader('remote_user',name)

and set my apache access log like this:
CustomLog /home/apache/httpd/logs/access_log combined

The combined log is defined as follows:
LogFormat %h %l %u %t \%r\ %s %b \%{Referer}i\ \%{User-Agent}i\ 
combined


There you see the %l and %u directives, which are the Remote logname 
and the Remote user.


But apache still doesn't get the zope authenticated user. So, Chris, do 
you remember what header you set, where, and which method you used?

Ok, Answering to this question. I guess I had to set the header inside the
authenticate method of the BasicUserFolder class. Here is what I did:

def authenticate(self, name, password, request):
emergency = self._emergency_user
user = None
if name is None:
pass
else:
if emergency and name==emergency.getUserName():
user = emergency
else:
user = self.getUser(name)
if user is not None and user.authenticate(password, request):
pass
else:
user = None
 logUser = 'Anonymous'
 if (user != None):
 logUser = user.getUserName()
 request.response.setHeader('remote-user',logUser)
 return user

The header is set, but apache still doesn't get it, so, I guess I'm 
using the wrong name. What header should I use?


Regards
Josef

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

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Re: Zope User in Apache Logs

2006-05-18 Thread Josef Meile
  If your Zope auth solution can put a header in the http response, 
then  you can use a custom apache logging directive to put this in your

  Apache log in place of what it thinks the username is.
I put this on the log method of the medusa/http_server.py file:
self.response.setHeader('remote_user',name)


As you've found out, this is the wrong level to do this ;-)

Yes, I must confess I didn't read your suggestion the first time.


and set my apache access log like this:
CustomLog /home/apache/httpd/logs/access_log combined

[Some Apache config comes here]...

 There you see the %l and %u directives, which are the Remote
 logname and the Remote user.


Yeah, these aren't the ones you want to be using ;-)

But apache still doesn't get the zope authenticated user. So, Chris, 
do you remember what header you set, where, and which method you used?
Ok, Answering to this question. I guess I had to set the header inside 
the authenticate method of the BasicUserFolder class. Here is what I did:


def authenticate(self, name, password, request):


 [Some code comes here]...

 request.response.setHeader('remote-user',logUser)


Well, I wouldn't use that header, try using X-MyUserName instead, and 
then in the apache config you'd use %{X-MyUserName}o

Thanks Chris, that was exactly what I was looking for. Now Apache logs
the correct authenticated user.

Regards
Josef

___
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] SSL Redirect for CookieCrumbler

2006-06-16 Thread Josef Meile
Dear Zopers

I need to redirect all my http requests to the login_form of the
CookieCrumble to https, so, I wrote this rule in apache:

RewriteRule ^/login/login_form(.*) https://server/login/login_form$1 [NE,L]

It authenticates me through ssl, but then it cames back to http. I saw that
the problem is that the came_from variable refers to the original http
request; something like this:

https://server/login/login_form?came_from=http%3A//server/pageretry=disabl
e_cookie_login__=1

Is there any way of writing something like this in apache?

RewriteRule ^/login/login_form?came_from=http%3A(.*)
https://server/login/login_form?came_from=https%3A$1 [NE,L]

It is not working for me :-(. I even tried escaping the '%' with a backslash
like this:

RewriteRule ^/login/login_form?came_from=http\%3A(.*)
https://server/login/login_form?came_from=https%3A$1 [NE,L]

But Apache doesn't match the rule. What's wrong with that?

Anyway, another thing that bothers me about the last approach is that I even
don't know if there is always a came_from variable. Is this always the
case? Is there any other way of achieving this?

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


[Zope] Re: SSL Redirect for CookieCrumbler

2006-06-16 Thread Josef Meile

I need to redirect all my http requests to the login_form of the
CookieCrumble to https, so, I wrote this rule in apache:

RewriteRule ^/login/login_form(.*) https://server/login/login_form$1 [NE,L]

It authenticates me through ssl, but then it cames back to http. I saw that
the problem is that the came_from variable refers to the original http
request; something like this:

https://server/login/login_form?came_from=http%3A//server/pageretry=disabl
e_cookie_login__=1


Ok, finally I found a way of correcting this behavior without modifying 
my original RewriteRule. I added a new boolean attribute to the 
CookieCrumbler class: ssl_redirect. If it is set, then the http Part 
in the came_from variable will be replaced by https. All this would be 
done inside the getUnauthorizedURL method of the CookieCrumbler class 
(See the attachment).


If you think there is a better way of doing this, please let me know.

Regards
Josef

Note: The patch was done for the CookieCrumbler v1.2
diff -Naur CookieCrumbler_old/CookieCrumbler.py 
CookieCrumbler_new/CookieCrumbler.py
--- CookieCrumbler_old/CookieCrumbler.py2004-06-14 18:34:36.0 
+0200
+++ CookieCrumbler_new/CookieCrumbler.py2006-06-16 17:34:04.0 
+0200
@@ -83,6 +83,9 @@
 'label':'Use cookie paths to limit scope'},
{'id':'cache_header_value', 'type': 'string', 'mode':'w',
 'label':'Cache-Control header value'},
+   #SSL Redirection from Josef Meile
+   {'id':'ssl_redirect', 'type': 'boolean', 'mode':'w',
+'label':'Use ssl after login'},
)
 
 auth_cookie = '__ac'
@@ -95,6 +98,9 @@
 local_cookie_path = 0
 cache_header_value = 'no-cache'
 
+#Patch from Josef Meile
+ssl_redirect = 0
+
 security.declarePrivate('delRequestVar')
 def delRequestVar(self, req, name):
 # No errors of any sort may propagate, and we don't care *what*
@@ -315,6 +321,11 @@
 came_from = req.get('came_from', None)
 if came_from is None:
 came_from = req.get('URL', '')
+
+#Patch from Josef Meile in order to redirect to ssl if 
using http
+if self.ssl_redirect and came_from.startswith('http:'):
+came_from = 'https' + came_from[4:]
+   
 query = req.get('QUERY_STRING')
 if query:
 # Include the query string in came_from
@@ -371,6 +382,14 @@
 return p.get('label', id)
 return id
 
+#Patch from Josef Meile
+def __setstate__(self,state):
+#This method adds new attributes and deletes old ones each time
+#that you view old instances of the class
+Folder.__setstate__(self,state)
+if not hasattr(self,'ssl_redirect'):
+self.ssl_redirect = 0
+
 Globals.InitializeClass(CookieCrumbler)
 
 
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Re: SSL Redirect for CookieCrumbler

2006-06-19 Thread Josef Meile

Hi Chris,


I need to redirect all my http requests to the login_form of the
CookieCrumble to https, so, I wrote this rule in apache:


Why bother? Just because the form is secure doesn't make cookie 
authentication any more secure.

Yes, you're right. That is exactly the conclusion I also figured out
after finding an interesting article in plone.org, which talks about this:

* Secure login without plain text passwords
http://plone.org/documentation/how-to/secure-login-without-plain-text-passwords

The only Problem is that the product mentioned there, SessionCrumbler,
is based on the CMF CookieCrumbler and not the Standalone version.

I guess it wouldn't be  difficult to port; I even tried it by replacing
the CMF imports by the Standalone version, but it didn't work. Zope
hangt and I even didn't get a TraceBack. Anyway, I'm not going to spend
more time trying to get this working. I will perhaps try to do some
patch to the basic http authentication like CookieCrumbler does, but
instead of showing the login forms, I want to do a redirect if the
request is insecure, so, you will still get the popup window, but in https.



Do you say in https once authenticated?


Yes, the problem, if you read my post was that with the apache
RewriteRule, I could authenticated myself in ssl, but after that the
browser took me back again to http - See the article; it exposes
clearly the problem.

Regards
Josef


___
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] Basic Authentication SSL Redirector

2006-06-23 Thread Josef Meile
Hi,

After having started the thread about securing CookieCrumbler[1], I figured
out that it was better to secure Basic Authentication instead. So, I just
created a new Product, called JMSSLBasicAuth[2], which is based on the
CookieCrumbler Transversal Hook. Instead of Cookie Authentication, I will
redirect insecure Basic Authentication requests to ssl.

I have tested it and it seems to work. I'm planning to use it in production
websites, so, I would really appreciate if you could give me some
constructive feedback about the product (See reference [2]), ie: what can I
improve, change, or add?

Thanks in advanced
Josef

[1] SSL Redirect for CookieCrumbler
http://mail.zope.org/pipermail/zope/2006-June/166784.html

[2] JMSSLBasicAuth - Secure Basic Authentication Redirector
http://www.zope.org/Members/jmeile/JMSSLBasicAuth 
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Re: Basic Authentication SSL Redirector

2006-06-23 Thread Josef Meile
After having started the thread about securing CookieCrumbler[1], I 
figured

out that it was better to secure Basic Authentication instead. So, I just


Which is actually identically :-) Its just a different HTTP-Header
involved :-)
Yes, but you won't send your credentials in plane text as you do with 
CookieCrumble, will you?



created a new Product, called JMSSLBasicAuth[2], which is based on the
CookieCrumbler Transversal Hook. Instead of Cookie Authentication, I will
redirect insecure Basic Authentication requests to ssl.


You remember to stay in ssl once you switched?
Let's say I remember that. Let's also say that the user turns manually 
back to http, then an Unauthorized Exception will be raised by zope, so, 
he will be redirect again to ssl, where an HTTP-Header where already set.


I checked it with the Live HTTP Headers of Firefox, and here the user 
won't send his credentials while switching to http, what you will see is 
this:


--
http://some_url/folder1

GET /folder1 HTTP/1.1
Host: some_ip
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.0.4) 
Gecko/20060508 Firefox/1.5.0.4
Accept: 
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5

Accept-Language: de-de,de;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive

HTTP/1.x 302 Moved Temporarily
Date: Fri, 23 Jun 2006 12:02:34 GMT
Server: Zope/(Zope 2.7.8-final, python 2.3.5, linux2) ZServer/1.1
Bobo-Exception-Line: 313
Content-Length: 2686
Bobo-Exception-Value: See the server error log for details
Bobo-Exception-File: Expressions.py
Bobo-Exception-Type: Unauthorized
X-Zopeuser: Anonymous
Location: https://some_url/folder1/index_html
Content-Type: text/html
WWW-Authenticate: basic realm=Zope
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
--
https://some_url/folder1/index_html

GET /folder1/index_html HTTP/1.1
Host: some_ip
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.0.4) 
Gecko/20060508 Firefox/1.5.0.4
Accept: 
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5

Accept-Language: de-de,de;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Authorization: Basic YWRtaW46Zm9vcGFzcw==

HTTP/1.x 200 OK
Date: Fri, 23 Jun 2006 12:02:34 GMT
Server: Zope/(Zope 2.7.8-final, python 2.3.5, linux2) ZServer/1.1
Content-Length: 156
Content-Type: text/html
X-Zopeuser: admin
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
--

On the contratry, with CookieCrumbler you will the your credentials 
encoded in base64, which can be easily decoded.




I have tested it and it seems to work. I'm planning to use it in 
production

websites, so, I would really appreciate if you could give me some
constructive feedback about the product (See reference [2]), ie: what 
can I

improve, change, or add?


I'd think you could add the redirection support (which can indeed be 
usefull
and simplify configuration) in a way not disabling cookie-auth the same 
time.


(For example you cannot really log out with Basic Auth)
I think you can, or how is it done in the ZMI? If I'm not wrong, there 
is something like a zmi_logout script, which raises an Unauthorized 
Exception, then you will see the popup window asking your credentials.


Regards
Josef

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

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Re: Basic Authentication SSL Redirector

2006-06-23 Thread Josef Meile
Yes, but you won't send your credentials in plane text as you do with 
CookieCrumble, will you?


Well, its more or less exactly the same as with BasicAuth :-)
(base64 plaintext vs. plaintext in html forms does not really matter)
Yes, but if you set only the authentication header in https and manually 
came back to http, then will you send your password in plain text?



--
https://some_url/folder1/index_html

GET /folder1/index_html HTTP/1.1
Host: some_ip
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.0.4) 
Gecko/20060508 Firefox/1.5.0.4
Accept: 
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 


Accept-Language: de-de,de;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Authorization: Basic YWRtaW46Zm9vcGFzcw==

HTTP/1.x 200 OK
Date: Fri, 23 Jun 2006 12:02:34 GMT
Server: Zope/(Zope 2.7.8-final, python 2.3.5, linux2) ZServer/1.1
Content-Length: 156
Content-Type: text/html
X-Zopeuser: admin
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
--


nice password btw ;)

Yes, a test password off course ;-). Will this being sent encrypted?

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

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Re: Alternate Forms of Authentication

2006-07-14 Thread Josef Meile

Hi Benjamin

Just getting into Zope and loving it!  I do have a question about the 
basic authentication that Zope uses... I have a login page (ZPT) and 
would love for Zope to display that page instead of the basic auth 
dialog when it determines it needs to authenticate.


Is this possible?  Is there a Product that does this?

Yes, you can use the CookieCrumbler Product and customize its login forms.

Regards
Josef

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

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Re: Logging client IPs to Z2.log

2006-08-17 Thread Josef Meile
Hi Oliver

 You can also look inside the logs of your Apache for the IP addresses?!
 
 That's not always possible in our virtual hosting environment, and besides
it
 makes no sense to have to look in two different places for the same
information.

I would also look for that information in the apache logs as Andreas 
suggested. The problem if you patch the zope code to show the ip addresses
in the zope log, and your zope webserver is under a firewall, then you won't
know if your firewall is working or not. However, if you don't care about
this, then you can try this patch:

Title:  Logging of client IP rather than the IP of the Proxy  
http://www.zope.org/Collectors/Zope/1732

Regards
Josef

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


[Zope] Re: Change language with PTS

2006-09-04 Thread Josef Meile
Hi Peter,

First at all, I think Localizer may be easier to do this task, it has
Built-in Cookie and traversal url support. You may also define your own
language selection method. If you still want to try this with PTS, then read
the following lines.

 Now, perhaps this works if my browser setting was 'sv' but it isn't. I
 actually don't want to use the browser setting at all, I want to
 control with via my own cookie and url traversal stuff.
To set the language you want with PTS, you have to set the
HTTP_ACCEPT_LANGUAGE as follows:

REQUEST.set('HTTP_ACCEPT_LANGUAGE',lang)

where lang could be 'sv'. Please note that you have to do this at the
beginning your your ZPT Template or DTML method. I have had problem when
doing this in the middle of the code.

I think cookies could also work, but I haven't tested the code myself. You
will need to set them via the request object like this:

REQUEST.RESPONSE.setCookie('lang','sv', max_age=something)
lang = REQUEST.cookies['lang']

PTS doesn't support traversal url. Anyway, you can still achieve this with
Access Rules. There is an outdated how-to that can give you an idea on how
to do this:

How To build multilingual sites with SiteAccess:
http://www.zope.org/Members/jdavid/MultilingualSiteAccess

There you will see that SiteAccess is mentioned, which is deprecated;
however, I think this Product was replaced by SiteRoot and Access Rules
(somebody correct me if I'm wrong). You may need to google about this.

As mentioned in that How-To, it was superseded by Localizer, so, you may
look at the source code of this product as well. 

Regards
Josef

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


[Zope] Re: Change language with PTS

2006-09-08 Thread Josef Meile
Hi Chris,

 Don't use PTS!
Only if using zope  2.8.x, which indeed I'm using, for we have a 3rd party
product that depends on that. Anyway, an update will be done, so, I will
follow this advice.

 If you have a google, you'll see i've just recently done the 
 language-selection-from-cookies dance in Zope 2 but using Zope 3's 
 infinitely better translation machinery ;-)
Yes, I googled a little bit and it looks promising. I even did a small
example, which luckily worked.

 There's even a sx.translations package which will help with providing 
 you with a list of languages to pick from...
 
 Lemme know if you want me to release it once you've had a read of the 
 relevant threads...
I searched that thread and the references there helped me a lot with my
small example. Google even now how to spell your last name ;-), but I don't.
Anyway, for the interested here is the thread:

* Zope 2.9 and Zope 3 i18n, more questions...
  http://mail.zope.org/pipermail/zope3-dev/2006-June/019496.html

The article by Philipp von Weitershausen, which is mentioned in there, is
really useful. The examples of his website are even better.

I'm not the OP, jet I would be also interested in your product. I'm not
planning to use the zope3 translation yet, but I want to experiment a little
bit.


Regards
Josef

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


[Zope] Re: automated object exporting

2006-09-28 Thread Josef Meile

Hi Sascha,

I have a Zope object (a Plone site, to be specific) that I would like to 
have exported on a regular basis so I can back it up to another server. 
While I am familiar with Python, I'm not familiar with the specific 
methods involved in interacting with Zope for this. How would I go about 
doing this?
I saw other advised you to use wget + cron; however, there is also an 
interesting approach with ZEO. I haven't tried it myself 'cause I'm not 
using it, but if you have it enabled in your zope, then you can look at 
this:


* Accessing zope through command-line python
  http://mail.zope.org/pipermail/zope/2003-February/131882.html

Somebody correct me if I'm wrong, but it seems that you don't need to 
give any password when running such out-of-process script; you just need 
to put it on a users account able to access the zope files. On the 
contrary, with wget, you will need either to pass a user and password 
with manager rights to the command line, or store it in PLAIN-TEXT in a 
file called .wgetrc.


If you opt to use the alternative with the .wgetrc, then you had better 
save it in the home directory of an administrative account (ie: root in 
linux) and deny all access rights for the other users.


The other alternative would to use some schedule products for zope:

* ClockServer
  http://plope.com/software/ClockServer

* ZopeScheduler - Not on line at the moment
  http://dev.legco.biz

There are maybe others, you will have to google.

Regards
Josef
___
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] Running scripts after zope startup

2006-10-25 Thread Josef Meile

Hi,

I'm working in a configuration module for other products I'm developing. 
The idea is that the user first has to make an instance from this 
product, then define there where the other products instances will be 
created, what header, footer, and style sheets they will use, etc..


The configuration product has to detect which of my products are 
installed, then load some xml Formulator forms. I just created a 
registry class that to do the detection process:


import Products

JM_PRODUCTS = ['JMConfigurator','JMPlace','JMPerson']
class JMRegistry:
  def __init__(self):
availableJMProducts = {}

for productName in JM_PRODUCTS:
  productModule = getattr(Products,productName,None)
  if productModule is not None:
availableJMProducts[productName] = productModule
self._AvailableJMProducts = availableJMProducts

  More methods come here
 ...
  

JM_Registry = JMRegistry()

The problem here is that if I import this in the initialize method of my 
configuration product, the _AvailableJMProducts dictionary is empty 
because at this point the other products hasn't been jet registered by zope.


I just thaught about something like the StartupScripts products does: 
running this after zope starts. This is achieved as follows:


__init__.py from my product:

from Products.JMUtils import JMRegistry
def initialize(context):
  #Some registration code comes here
  #...

  import ThreadedAsync.LoopCallback
  ThreadedAsync.LoopCallback.register_loop_callback(
   JMRegistry.createRegistry)

JMRegistry.py:
JM_PRODUCTS = ['JMConfigurator','JMPlace','JMPerson']
class JMRegistry:
  #Class definition is the same as above
  #...

JM_Registry = None
def createRegistry(args *):
  JM_Registry = JMRegistry()

Unfortunatelly, after seeing the zope source code, I saw that the 
ThreadedAsync is only used by ZEO, which I'm not using.


My workaround was to call this in the __setstate__ method of my 
configuration product as follows:


from Products.JMUtils import JMRegistry

class JMConfigurator(ZCatalog):
  #__init__ and other methods come here
  #...

  def __setstate__(self, state):
ZCatalog.__setstate__(self,state)

if JMRegistry.JM_REGISTRY is None:
  JMRegistry.JM_REGISTRY = JMRegistry.JMRegistry()

  #After having initialized the registry, I can call the methods to
  #load the Formulator forms
  self.LoadFormulatorForms()

This works well, but I think it is not the better place to define this 
kind of things. Is there any better way of achieving the task?


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

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Re: How to do...[Rendering zpt on the fly]

2006-10-27 Thread Josef Meile

Hi Garito,

I saw in another thread you still need this. If I'm not wrong what you 
are pretending is to somehow render zpt on the fly. So, here is my idea:

I would like to write things like:

object.property = 'here/anotherproperty'
object.anotherproperty = 'Barcelona'

and ask it like:

print object.property - 'Barcelona'

or

tal:city tal:replace='here/property' / - 'Barcelona'

Is this possible?
I think you could perhaps create a new class to store the tal expression 
attributes, let's say you called it ExpressionAttribute. This class 
must be callable and be able to evaluate tal expressions. This is a 
small sketch of how I think it should look like:


from Products.PageTemplates.ZopeTemplate import ZopeTemplate

class ExpressionAttribute:
  #Here I also assume that you only enter the expressions
  #without html and the tal part, like: 'here/property'
  #Please also noticed that all sintax errors in your zpt
  #code must be catched somewhere
  def __init__(self, id, talExpr):
self.talExpr = 'span tal:replace=%s/' % talExpr

#I'm not sure about this, but I think it will create a Template on
#the fly.
self.zpt = ZopePageTemplate(id, text = self.talExpr)

  #Note: I really don't know if you have to pass other parameters to
  #pt_render, ie: the container of your property. You will have to test
  #this.
  def __call__(self):
return self.zpt.pt_render()

Then, in the __init__ of your zope product you will need to do things 
like this:


class YourProd(...):
  def __init__(self,prop1,prop2,prop3,...):
#This is a normal property
self.prop1 = prop1

#This two are tal expression properties
self.prop2 = ExpressionAttribute(prop1)
self.prop3 = ExpressionAttribute(prop1)

Then, I guess you can call it as:
yourProdObj.prop3 or in tal: here/prop3

I'm not sure about what I wrote and if this is what you are looking for. 
I just hope it helps.


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

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Re: __bobo_traverse__ help

2006-11-10 Thread Josef Meile

Hi Garito,


You may try to return a wrapper that behaves the same way
as the original object (by deriving from the respective type)
but has __roles__ = None as additional attribute (which declares
the object public).



  

Uau!
Can you point me to a simple example or similar? I'm not sure if I 
understand what you are telling me

I guess Dieter is telling you something like this:
def __bobo_traverse__(self, REQUEST, name):
   obj = self.Propiedad(name)
   if obj is None: return self
   else:
   obj.__roles__ = None
   return obj

Although, I would try this as well:

def __bobo_traverse__(self, REQUEST, name):
   obj = self.Propiedad(name)
   if obj is None: return self
   else:
   return obj.__of__(self)

I was having a similar problem (not with __bobo_traverse__), but it was 
an UnauthorizedException, and I could solve it by using the second 
sintax: __of__(self)


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

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Re: adding a python library

2006-11-14 Thread Josef Meile

Hi,


I am now looking at the modules feedparser imports. These include

sgmllib
re
sys
copy
urlparse
time
rfc822
types
cgi
urllib
urllib2
cStringIO
xml.sax

It seems that sys would be a bad one to allow zope to import.
Well, you don't have to allow all of them. You only need to allow the 
feeparser module and use it from your python scripts or classes, zpt, 
and from dtml (if you still use it)


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

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Re: TimeError in Zope 2.8.5

2006-11-22 Thread Josef Meile

import time
time.localtime(106900545747.045975).tm_year

5357


Now, we understand: it's the Python time implementation that has
changed.

With Python 2.3.3 (under Debian Sarge), we get:


from time import localtime
localtime(106900545747.045975)

(1901, 12, 13, 21, 45, 52, 4, 347, 0)

localtime(106900545747.045975).tm_year

1901

In my python 2.4.3 (compiled from source) and the one installed with the 
OS, which is also 2.4.3, it doesn't work. I get:


Traceback (most recent call last):
  File stdin, line 1, in ?
ValueError: timestamp out of range for platform time_t

So, I guess there should be something that you can configurate when 
building python, or it is perhaps a linux kernel paramater. With python 
2.3.5 it works however, so, it is a change in python as Dieter mentioned.


By running the zopectl in debug mode for zope 2.9.4, the resulting 
traceback is the same as the one posted by the OP. With zope 2.8.8 it 
runs without any problem. So, it could be that the provider is running 
zope 2.8.5 with python 2.4.


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

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Re: Specifying the target language with i18n

2006-11-24 Thread Josef Meile

Hi Daniel,


Hello,

I am trying to set the target language using i18n:target label

Example:

p i18n:translate= i18n:target=string:en
label_search
/p

It doesn't work. I cannot specify the target language.

I am in Zope 2.9.4.

Just a guess: Don't you need to specify a domain as well?

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

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Re: Specifying the target language with i18n

2006-11-24 Thread Josef Meile

Example:

p i18n:translate= i18n:target=string:en
label_search
/p

It doesn't work. I cannot specify the target language.

I am in Zope 2.9.4.

Just a guess: Don't you need to specify a domain as well?

Ok, I tested it as well and it didn't work either. I just found it is a
bug and here is a patch:
http://www.zope.org/Collectors/Zope/1114

However be careful when using patches, specially when working with
unicode data. You have to make sure they don't concatenate normal
strings and unicode: This is really difficult to debug.

I think that the i18n:target directive is only useful you want to show
a text in a zpt which must be always rendered in the same language (ie:
some governmental entities shows first an English version of a official
document, then immediately above there is a version let's say in
spanish). But if what you want is to change the language in the whole
zpt, then implementing your IUserPreferredLanguages would do the trick.

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

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Re: error with simple python script loop

2006-11-24 Thread Josef Meile

I have test the script on my local windows python version with an print 
statement, and it works fine
- everytime - so its only on zope. i cant use pdb on zope´s python 
script i think?

Are you using the same mail servers?

Anyway, another thing you could do would be to run the script in debug
mode:

'''
home_instance/bin/zopectl debug
Starting debugger (the name app is bound to the top-level Zope object)

app.YourScript
'''

You could perhaps trying to do a fresh install of python and zope (from
sources) in your debian server and see if it works.

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

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Re: Zope newbie.... unicode problem

2006-11-30 Thread Josef Meile

Hi Tyler

When serving a web page, we get an error that involves the 
fetching and display of a document to the browser. Evidently, 
it's choking on some unicode bytes when it's expecting plain 
ascii.  


I'm assuming it's
/usr/lib/zope2.7/lib/python/Products/PageTemplates/PageTemplate.py
that's causing the problem as the data isn't somehow massaged correctly
before processing arrives at /usr/lib/python2.3/StringIO.py line 203.

So, you are using zope 2.7 and for the location I guess it is a binary.



I don't know if the bad byte is in a zope template, document, or
a database record that it's fetching.  I do believe this installation
of Zope uses Plone... but I've no idea whether Plone is somewhere
used in the error stream of all the different calls.

Do I need to post more information?  Tell me .. and I'll get it.
Yes, perhaps you could post the template generating that error. If it is 
really long, try to localize the problem by removing parts of the 
template and test it continuously till you find the offending code.


Recently I got some similar problem. I'm using zope 2.8.8 and I taught I 
was affected by this issue:

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

However, after adjusting that patch for 2.8.8 (it is for 2.10), I was 
still getting the problem. Then I figured out that somewhere in my code 
I was getting the title from an object and comparing it with an unicode 
string. The title turned to be a normal string with unicode parameters. ie:


a = u'This is unicode \xc3\xa4\xc3\xb6\xc3\xbc'

#this has unicode characters äöü, but it isn't a Unicode string
#Note that the u' is missing
b = '\xc3\xa4\xc3\xb6\xc3\xbc'

#This will fail
print a == b

#This is what you need to do

a = u'This is unicode äöü'
b = 'This is ascii'
print a == b.decode('utf-8')

I was doing that in a python product, so I could do this:
from types import StringType
if type(b) == StringType:
  b = b.decode('utf-8')

I don't know if you can do that in zpt. You also have to know which 
encoding you are using. In my case it is always utf-8


You may also trying to see if your plone version supports your zope 
version, which is old (Open the README or INSTALL file).


Try also to upgrage your zope. Perhaps this will solve your problem.

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

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Re: Adding HTML to Python

2006-12-06 Thread Josef Meile

I tried that and it will print the BR, like this

These IDs have Errors:BR 1BR 46 BR 76BR 45BR

If you are using zpt, then you have to call it like this:
div tal:replace=structure here/myScript/


Otherwise it will be rendered as text.

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

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Re: Resizing Images In Page Templates

2007-03-05 Thread Josef Meile

Hi tony


I saw somewhere someone adding code like this:
img src=myimage.jpg/resize /
that would automatically resize his image according to a predetermined 
standard. Does anyone know how this or something similar is done?
Yes, I have seen this. Silva, a zope based CMS, has a class called 
SivaImage. Inside that object, you can specify a scale. Then inside 
another class called SilvaDocument, it will be called as follows:


img src=myId.jpg/hires_image - Will get the image with its real 
resolution


img src=myId.jpg/image - Will get a resized version of the image

I know that class uses PIL. You could download it from:
http://www.infrae.org/

and take a look at it.

The only thing I don't like is that when saving an image, its name will 
be either hires_image.jpg or image.jpg instead of the real name.


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

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Re: I don't understand why fail

2007-03-08 Thread Josef Meile
Have a look at the full traceback in the error_log (ZMI root folder - 
you may have to remove the 'Unauthorized' entry from the 'Ignored 
exception types' field), it may provide some more information.
Another thing you can do is to activate the verbose-security directive 
in your zope.conf file. Don't forget, to set the 
security-policy-implementation to python and restart zope. You may 
get more verbose output when getting an Unauthorized exception.


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

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Re: Lost user credentials

2007-03-12 Thread Josef Meile
To Dieter: I use HTTP authentication method (at least I suppose that). I 
don't change anything about the default configuration nor use any cookie 
at least
What you get when you authenticate: a pop-up window (HTTP 
authentication) or an html form (Cookie based authentication)?


What I wonder is CrearFuncionalidad works ok but not BorrarFuncionalidad 
who are launched both in the same way

In the original thread:
http://mail.zope.org/pipermail/zope/2007-March/170794.html

you said:

The question I can't understand is when BorrarFuncionalidad ask for a 
login and password I put my user that is manager and owner but the 
login don't work (it ask again and again)


Both scripts has the same parent and the same security permissions

How are you defining the permissions: by checking the Acquire 
permission settings? checkbox or are you implicit defining a role for 
that permission? In the first case zope will scan the folder hierarchy 
till it finds a folder where the permission is defined. In the worst 
case it will reach the root folder where the permission must be either 
enabled or disabled. So, it can be that somewhere the Delete Objects 
permission was disabled for the Manager and Authenticated roles. If 
I were you, I would try to implicit define the Delete objects 
permission in the folder where you want to delete the objects and see if 
the problem persists.


In your last reply to the other thread:
http://mail.zope.org/pipermail/zope/2007-March/170806.html

you asked:

I'm using prototype to launch some actions via AJAX
Could be this the problem?
How can I conservate the user who launch the actions between AJAX calls?


I have never used AJAX, so, I don't know if the user credentials get 
lost during the call of your AJAX code. Perhaps other people can help here.


Regards
Josef


Out-topic:
Fuck$%ing gmail
Sorry all for this stupidity
Then try to use another newsreader like Thunderbird (multi platform). If 
you are on windows you could also try Outlook Express as well.

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

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Re: catalog aware not working.. help

2007-03-20 Thread Josef Meile

Hi Allen

I made a pyhon product with catalogaware as one of my base class but my 
zcatalog named 'catalog' doesn't automatically catalog when I add a 
product item. what could be a problem?

Perhaps setting the catalog in your object instance may help:

self.manage_editCataloger(catalogPath)

You may also try to change the way you are sub classing. In my case, I 
put CatalogAware as the first sub class (left-most).


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

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Re: catalog aware not working.. help

2007-03-21 Thread Josef Meile

Hi,


Keep in mind that you really should be using CatalogPathAware not
CatalogAware, or you will run into trouble with absolute_url() and
virtual hosting.

Does it make a difference? If you go to
Zope_home/lib/python/Products/ZCatalog/CatalogPathAwareness.py

You will see that CatalogPathAwareness.CatalogPathAware is a subclass of 
CatalogPathAwareness.CatalogAware with no code at all. I'm in deed using 
CatalogAware as base class of a python product in a virtual hosting 
environment and haven't noticed any problem.

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

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Re: CorpCalendar 1.4 and 1.7 issues

2007-03-22 Thread Josef Meile
Now I just need to look at the Zope Book to see what the changes to the 
security declarations are so the lines below will quit showing up in my 
event.log.  


--
2007-03-22T14:10:44 WARNING Init Class 
Products.CorpCalendar.CorpCalendar.CorpCalendar has a security declaration 
for nonexistent method 'addEvent'

--
Well the security declarations are the same. The only thing that changed 
is that the zope develolpers added this wonderful warning when one adds 
a security declaration for an inexistent method. In older zope versions 
you could do this and no warning was shown in the log. So, you could 
waste lots of time trying to figure out that your method raised an 
Unathorized Exception because of a typo in the security declaration.


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

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Re: zope problem

2007-04-04 Thread Josef Meile

Hi kashif


when we run zopectl the following error message occour



[EMAIL PROTECTED] zope]# zopectl
/usr/lib/python2.4/whrandom.py:38: DeprecationWarning:
the whrandom module is deprecated; please use the
random module
  DeprecationWarning)
program: /usr/bin/runzope
daemon manager not running
zopectl   
Well, actually that's not an error. The message is right; you haven't 
started zope. To start it, you have to run zopectl start without 
quotation marks.


Do zopectl help without quotation maks to see what you can do with it.

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

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Re: windos and linux

2007-05-27 Thread Josef Meile


windos and linux
windos? Is it a new version of DOS? ;-)


this snippet behaves differently on windows and linux:
http://zope.pastey.net/42188-1gbl

Why don't you try to directly create a OFS.Image directly
into the zopedb, then see if this still happens. It would
help you to discard any error inside the ProfilePicture
class.

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

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Re: Problem Augmented assignment

2007-06-04 Thread Josef Meile


A quick fix would be to move the code from your python script to an 
external method.




Ok,thanks, but how can I call this external method in a page template. 
In a first page I have a form that submit 6 parameter in url. The second 
page must call the external method or python script(don't run) and 
with the method sort of python I make a search in portal_catalog.

If I'm not wrong this should work as with normal python scripts:

python:context.myExtMethod(par1,par2,...)


You just have to define your parameters inside the external method and
your script must be in the acquisition path of the template where you
are calling it.

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

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Re: Problem Augmented assignment

2007-06-06 Thread Josef Meile

julian schrieb:

In fact it's a problem of AdvancedQuery :
   TypeError: Augmented assignment to And objects is not allowed
   in untrusted code

If I don't write query = And(), there are no errors. But I want the 
function And :s .

Does this also happens when you make an external method? It seems that
you were still trying to run a python script.



My code :

 [Snip...]
I haven't work with this kind of sql queries, so I can tell you if
something is wrong there.

Best regards
Josef
___
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] does zope support java script

2007-07-18 Thread Josef Meile
 I figured out that the small browser inside ZMI has a problem with
 javascripts, it can't display them. But, when I visit the URL of the
page
 from IE, the javascripts are executed normally.

Now I understand why this fails. You are pressing the View/Test tab
inside
the ZMI. For some objects, zope will add an extra text at the end of the
url. ie: for images it will add: /your_image.gif/view_image_or_file, for
scripts, page templates, and other objects, it will add
/your_object/ZScriptHTML_tryForm. For other objects no extra text will
be
added, so they will work as expected. (Look at the status bar of your
browser before hitting this tab).

Am I right that ZMI can't displays JS ? and is there a solution for it.
If I'm right, this is a path problem, one could solve it, but I think
the invested time isn't worth. You'd better copy and paste the link from
the View/Test tab and remove the extra text at the end.

Regards
Josef

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


[Zope] Re: utf-8 problem in Zope when using Localizer

2007-09-04 Thread Josef Meile

Install a separate python that is used only by your zope instance. Use
setdefaultencoding only there.



This is nonense. A custom sitecustomize.py script does the job without 
installing a complete new Python.

You need to read a previous reply:

I set it global in sitecustomize.py under 
/usr/lib/python2.4/site-packages and then



dtml-var MessageCatalog('Hallo Welt!')

works. Now I only must find the right place for setdefaultencoding() so
it only affect my zope-instance.
For the path used there /usr/lib/python2.4/site-packages, it seems
that the python used by zope is a binary that comes into a rpm package,
so, this may break some things on the OS. So, I guess a new python for
only zope makes sense here
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


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

2007-09-12 Thread Josef Meile

Hi,

You could try to install an oficial python 2.1.x release from
python.org, then change the python's path in the runzope.bat
script. I work mostly with zope under linux, so, I haven't
tested this, but perhaps it works.

Another problem you may face is that perhaps the official
python binary may also don't have large file support. On that
case, you will have either to search if somebody provides one
with LFS, build your own python (and zope probaby) from sources,
or as somebody said, use a newer zope binary release, which will
require you to upgrate your Data.fs.

Best regards
Josef


Tit-Liviu Leontin schrieb:

Folks,


I desperately need support for large filesystem so the data.fs file can exceed 
2 GB.

I can only make minimal changes to the existing set-up, which consists of Zope 
2.5.1 (binary release, with Python 2.1.3) on Windows Server 2003 and NTFS.

From what I've read, the issue is with the old Python not having LFS enabled, 
so I thought I'd just upgrade it to 2.2.3 which has LFS enabled.

The question is, how do I do that? Windows installer for Python doesn't know 
what to upgrade in the Zope install, so I'm thinking to copy the right files 
from the extracted Python 2.2.3 in Zope folders.

What goes where? I appreciate your patience and spoonfeeding. :-)


Thanks in advance!
Titel





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

 http://mail.zope.org/mailman/listinfo/zope-dev )



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

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Re: How to know what are zope doing now?

2007-09-20 Thread Josef Meile

Hi Garito


Thank you very much!
I was thinking in something more like a monitor (to use it even if zope 
is working ok) but I try it

Perhaps profiling is what you are looking for. Inside the ZMI Go to:
/Control_Panel/DebugInfo and press the Profiling-tab. In order to use
this, you will have to enable it in your zope.conf file (See the
comments there).

I'm not sure if this is mentioned somewhere in the zope book (you may
look for it), but I know that the zope help mentions it; just click on
the  Profiling-tab, then go to the help link at the upper-right corner
of the ZMI.

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

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Re: Defining a dictionary in ZPT?

2007-11-02 Thread Josef Meile

Hi Michael

michael nt milne schrieb:

yeah I have modified to this

li tal:define = query here/testquery
 tal:repeat=result python:query(id='IT')
span tal:replace=python:repeat['result'].firstnameFirst 
Name/spannbsp;

  /li

but get this as a result. Thanks for the reply.

Module Products.PTProfiler.ProfilerPatch, line 32, in __patched_call__
Module Products.PageTemplates.ZRPythonExpr, line 47, in __call__
- __traceback_info__: query(id='IT')
Module Python expression query(id='IT'), line 1, in expression
AttributeError: Results instance has no __call__ method

I suspect that result isn't a dictionary. Why don't you try to print
result instead and see its type? Try this:

span tal:replace=repeat/result/span

You could also try the other sintax for your zpt:
span tal:replace=repeat/result/firstnameFirst Name/span

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

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Re: Defining a dictionary in ZPT?

2007-11-05 Thread Josef Meile

ok, thanks Duncan

ul
li tal:define=query nocall:here/testquery tal:repeat=result 
python:query(id='IT')

span tal:replace=result/lastnamelastname goes here/span

/li
/ul

Good that you got it working. By the way, why do you need to define
query? Do you really need a reference to the testquery function? Won't
be enough by writing:

li tal:repeat=result python:here.testquery(id='IT')

Or are you using query somewhere else?

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

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Re: Appending to a file via manage_edit?

2007-12-11 Thread Josef Meile

I've been looking around for this, but can't seem to find anything.  I'm
assuming that it is just not possible, but thought I'd ask just in case.

For File objects, I see that manage_edit() has the parameters: title,
content_type, precondition, filedata  REQUEST.  Setting something in the
filedata parameter will replace the file's current data with that.

This implies (to me at least) that the only way one can edit a file is a
complete rewrite.  Does there exist a way to simply append data to the 
end
of the file?  For instance, if one wanted to write to a file line by 
line,

is that possible in Zope?


out-of-the-box: NO

Appending data would require the manipulation of the linked list of Pdata
elements. There is no API for this available...so basically forget it.

What about the python pickle/cpickle and marshal modules? If I'm not
wrong zope uses cpickle to append data to the Data.fs, or am I wrong?

I haven't read the module documetation deeply, but as I understand,
pickle/cpickle is used for serializing python objects, while marshal is
for binary data.

http://docs.python.org/lib/module-pickle.html
http://docs.python.org/lib/module-marshal.html

Anyway, you still need to load the whole file into a temporal memory.

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

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Re: Intercept request

2008-01-07 Thread Josef Meile

BTW - I'm using ZPT, not DTML. I'm guessing I can do this with a
simple script that I include on every page, yes? That could work, but
seems a bit error prone - that's why I'm looking for some sort of
request hook. But maybe that's my best option within Zope. Thoughts?

I guess if you want to do this easily inside zope, then a script is the
way to go. Somebody already posted a dtml solution; however, I think it
is better you put it in a python script that will be called from your
standard_header file, which can be either a dtml method or a page
template.

A request hook will require you to patch zope, write a monkey patch, or
some kind of UserFolder based on ip addresses, which means to directly
modify zope's code or create an external product. The invested time on
doing this isn't worth, when you can do it easier and in less time, with
either a script or by modifying your proxy's configuration.

I think it would be better to let your proxy do this. This isn't really
hard with nginx:

http://wiki.codemongers.com/NginxHttpAccessModule

Anyway, if you don't have access to the maschine hosting your zope, then
you should try the script solution.

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

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Re: Intercept request

2008-01-07 Thread Josef Meile

Raphael Ritz schrieb:

David Chelimsky wrote:



[..]


BTW - I'm using ZPT, not DTML. I'm guessing I can do this with a
simple script that I include on every page, yes? That could work, but
seems a bit error prone - that's why I'm looking for some sort of
request hook. But maybe that's my best option within Zope. Thoughts?



Are you saying you want an access rule?

http://www.zope.org/Documentation/Books/ZopeBook/2_6Edition/ZopeServices.stx 

Well, I guess that would be much easier than the script solution I
mentioned before. You can put your access rule, which is also a script,
on the folder you want to restrict. You have to be careful with this
rules since you can block your access to the site; however, this
can be easily undone.
___
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] Zope lists in google

2008-02-07 Thread Josef Meile

Hi,

Today I noticed that google doesn't find anything when giving
site:mail.zope.org anymore. It worked before :-(

Moreover, when you get the robots.txt from the list:

http://mail.zope.org/robots.txt

You will see:

User-agent: *
Disallow: /

So, is it intended that the zope list aren't indexed by the
search bots or is this an error?

Best regards
Josef
___
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: [ZWeb] Re: [Zope] Zope lists in google

2008-02-08 Thread Josef Meile

Hi,


Today I noticed that google doesn't find anything when giving
site:mail.zope.org anymore. It worked before :-(


Yeah, I noticed this too. It's a real shame.

I wonder who did that and why?
(file objects have no history tab and the database has been packed to 
the point where there's no Undo data)




I can't think that mail.zope.org has anything to do with a ZODB or is 
configured from zope.org

I guess he is either making fun of me 'cause I did an OT question here
or he just replied to the wrong message.



Anayway:
If you are having trouble using the lists, please contact 
[EMAIL PROTECTED]

Ok, I already wrote them a message. Anyway, I preffer google to search
the list :-(
___
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] Conditional dtml-boundary in dtml-sendmail

2008-04-09 Thread Josef Meile
Dear list

I'm trying to send a multi-part email after having submitted a
form. In that form, the user will give some basic information
from him, then he will be able to send at most three files.

This is my dtml-method to send email after having submitted the
data:

dtml-let email=REQUEST.get('aba_email_txt').encode('utf-8')
  name=REQUEST.get('aau_name_txt').encode('utf-8')
  lastName=REQUEST.get('aat_vorname_txt').encode('utf-8')
  company=REQUEST.get('aas_firma_txt').encode('utf-8')
  file1=REQUEST.get('aap_dateien_anhang_dat')
  file2=REQUEST.get('aaq_dateien_anhang_dat')
  file3=REQUEST.get('aar_dateien_anhang_dat')

dtml-sendmail smtphost=my_host.my_domain.com
To: [EMAIL PROTECTED]
From: dtml-email;
Subject: Anfrage dtml-name; dtml-lastName; - dtml-company;
Content-Type: text/html; charset=utf-8
dtml-mime type=text/html; charset=utf-8
html
  body
Some html code comes here
  /body
/html
dtml-boundary type=application/octet-stream disposition=attachment
   filename_expr=file1.filename
dtml-var file1.read()dtml-boundary type=application/octet-stream
disposition=attachment
   filename_expr=file2.filename
dtml-var file2.read()dtml-boundary type=application/octet-stream
disposition=attachment
   filename_expr=file3.filename
dtml-var file3.read()/dtml-mime
/dtml-sendmail
/dtml-let

Let's say that the user doesn't submit file3, on that case, zope will
generate something like this: some_ramdom_id.dat and it will attach
an empty file. I tried something like this:

dtml-if file1.filename not in ['', None]dtml-boundary
  type=application/octet-stream disposition=attachment
  filename_expr=file1.filename
dtml-var file1.read()/dtml-if

However when I try to save, zope fails and says:


Error Type: Document Template Parse Error
Error Value: Unexpected tag, for tag dtml-boundary
type=application/octet-stream disposition=attachment
filename_expr=file1.filename , on line 215 of sendAnfrage


The only way I found to cope with this was doing a script to validate if a
file has whether a name or not, then I will return a dictionary like this:
{'name': real_name_or_dummy_name, 'data': file.read()_or_dummy_text}

So, I feed the boundary with a dummy file when no file was uploaded. I don't
really like to send dummy files since it may confuse the person receiving
the emails. Is there any better way of achieving this? Please note that
since I'm working in the zmi and I'm not the administrator of the machine
where my page is hosted, I can only use dtml to send mail :-(, thus using
the python mail library isn't an option on this case.

Best regards
Josef

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


[Zope] Re: Conditional dtml-boundary in dtml-sendmail

2008-04-10 Thread Josef Meile
 I started shivering while reading your code. We would have written such 
 code
 five or six years ago - because we had no other choice.
 Please use the standard 'email' module of Python...this just works
 and you don't need to write such ugly and error-prone DTML
 code.
Yes, I know it is ugly and I would like to use python instead, but as I said
before I can't use the email module of python since the Machine were the
page is hosted isn't administrated by me, so, there isn't any change of
allowing or installing a python module.

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


[Zope] Re: Conditional dtml-boundary in dtml-sendmail

2008-04-10 Thread Josef Meile

The 'email' module is part of the standard Python distribution since
generations.

Well, I said allowing or installing. I wasn't sure if it was and with
allowing I meant by using allow_module or allow_class. I guess you can't
just use this module without removing security assertions. I will try to
confirm this.
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Re: Conditional dtml-boundary in dtml-sendmail

2008-04-11 Thread Josef Meile

Tom Von Lahndorff wrote:
How is dtml more error-prone than python? I'd imagine that all 
depends on

who's authoring it.


In this particular example, python's email package has a very OO 
approach to generating emails.

Yes, that's what I hate from the dtml thing; it looks ugly :-(

The DTML approach relies on you remembering to put in the right 
statements for the right constituent email parts in the right places.
It's easy to make mistakes and generate emails that won't work with most 
clients.


It's also harder to generate emails with the correct headers (Date, 
Message-ID, etc) than it should be, so you're more likely to pump out 
email that mtas consider to be spam.

Actually, I did several mistakes: first, if you include a blank line
just after finishing defining the email settings, ie: To, From,
Content-Type, etc, you will get your email, but in a format that you
can't read.

The second problem was with the unicode: first I got the characters
wrong on the email subject, but on the mail's body were ok, then I
change something and got them good on the subject, but on the
body non-ascii characters were dropped. After lots of testing, I
finally saw that you have to define content-type everywhere: on the
mail headers and also on the text-mime contents. Then you have to
encode all your strings to utf-8.


The DTML approach also makes attaching files a living hell...

Yep, I agree on this. You can't dynamically set the number of
attachments and even if you don't submit a file on your form, zope
will send an empty file with a strange name.


Well, I guess I will do an external method on my own server and then try
to convince the people owning the machine where the page is hosted to
include it. Otherwise, my last resouce would be to embebbed the content
on a iframe or call an external link to my server.

Thanks anyways for your replies.

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

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Re: Conditional dtml-boundary in dtml-sendmail

2008-04-11 Thread Josef Meile
The email library should be available to use with a Script (Python) and 
can be done all within the ZMI. Otherwise maybe use dtml-try?

Well, I should have mentioned this: the zope installed on the server is
2.8.x. Yes, it is old, but it is because all the page uses an own CMS
based on silva, which isn't compatible with newer versions.

I tried this:

import email

and it worked; however, as soon as I tried this:

from email.MIMEText import MIMEText
msg = MIMEText('Sending mail through python module')

or

import email
msg = email.MIMEText.MIMEText('Sending mail through python module')

An Unauthorized exception comes. So, I guess MIMEText is protected at
least on 2.8.x. But I guess in 2.11.x is protected as well, or am I
wrong?

Thanks for your reply. I guess there is no way of achieving what I want
on dtml, so, I will try to do it an external method and try to convince
people there to store it on the server or I will have to do it on my
own server and embebbed it on an iframe or call an external link.

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

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Re: authentication with python program

2008-04-18 Thread Josef Meile

Hi Miguel

First, you could drop the Unauthorized Exception from the error_log
object in the root folder of the zope management interface. Then
activate the verbose-security option in your zope.conf file. To do
this, you need to put/replace this lines:

security-policy-implementation python
verbose-security on

After you have done this, you need to restart zope, try again your
authentication script, and take a look at your event.log file or
the error_log object. You may find the reason of why is this failing.
In case you don't find it, then place the full traceback here.

Best regards
Josef

Miguel Beltran R. schrieb:

I have this program what open a dtml what return a XML page, but I
have error with permisions:

import urllib, urllib2

pagina = http://10.28.1.239/bitacoras/alta/estado2.html;
datos = {btipo:D,
 bholo:87654321,
 bplac:dd-12345,
 accion:alta_gasolina,
}

params=urllib.urlencode(datos)
aut=urllib2.HTTPBasicAuthHandler()
aut.add_password(AFICON, pagina, myuser, mypass)
opener=urllib2.build_opener(aut)
urllib2.install_opener(opener)
r=urllib2.urlopen(pagina,params)
print r.read()
r.close()

but returned XML say:
ajax
  accionalta_gasolina/accion
   respuestaerror/respuesta
error_typeUnauthorized/error_type
error_descriptionYou are not allowed to access 'zsql_alta'
in this context/error_description

  /ajax

help? how I can send HTTPBasicAuth?

pd. Sorry by my bad english


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

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Re: disappearing external methods

2008-05-07 Thread Josef Meile

Garry Saddington schrieb:

Have you tried deleting the .pyc files associated with the external methods
and then restarting zope?

There are no .pyc files in any of our installations.
Have you used the Zope that comes with Centos or from Zope.org?
Tried, as somebody say, to open the external method on the ZMI, then 
press save, and test if it works. If you have a lot of them, you could

try Dieter's advice here:

http://mail.zope.org/pipermail/zope/2002-July/119101.html

Check also that you move all .py files from your external methods and
that file and folder permissions allow the user running zope to access
them.

I'm not sure but I think this problems with the external methods only
happen with old zope versions. Which version you have?

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

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Re: m2crypt in Zope 10

2008-06-23 Thread Josef Meile

I am wondering, if there are some howto patching the zope 10


We're in the year 3030? We are just at Zope 3.X :-)

You are in year 3030 ;-). I'm still stucked in the past with zope 2.8.x
:-(

Anyway, my suggestion for the original poster is to use apache for ssl.
I used m2crypto in the past and it was first really slow and second,
it hanged sometimes while loading pages. I didn't wanted to use apache
since I thoght it was too much effort. Anyway, I finally installed it
and now I'm really happy with it ;-)
___
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] i18n from a python script or external method

2008-09-17 Thread Josef Meile
 However, I dont need to do this with PTS - i would be happy to know the 
 five solution !
I'm using sx.translations + five in order to achive this 
programatically. In order to use i18n from five, read this:

http://codespeak.net/z3/five/i18n.html

Then install sx.translations from here:
http://www.simplistix.co.uk/software/zope/sx.translations

Please note that the product self do not compile po files into mo you 
have to compile it either manually or apply my patch:

https://secure.simplistix.co.uk/support/issue310

I did also some functions to be able to translate messages 
programatically. Please note that I'm using zope 2.8, so, I don't know 
if it will work with 2.10.x. Please also note that I'm using a request
variable called 'lang' to set the source language. If this variable
isn't set, then the browser language will be assumed.

Best regards
Josef

Code

from zope.component import getUtility
from zope.i18n.interfaces import ILanguageAvailability
from zope.i18n.interfaces import INegotiator
from zope.i18nmessageid.messageid import MessageID
from zope.i18n import translate as _

def getSupportedLanguages(domain=None):
   Gets the supported languages for a Message catalog
   options = getUtility(ILanguageAvailability,
domain).getAvailableLanguages()
   options.sort()
   langCodes = []
   for option in options:
 langCodes.append(option[0])

   return langCodes

DEFAULT_LANGUAGE = u'en'
def getLanguage(context,domain=None,optionsDict = {}):
   Gets the current language of the user browser
   context = getattr(context,'REQUEST',context)
   lang = optionsDict.get('lang',None)
   if lang not in [None,'']:
 context.set('lang',lang)

   supportedLanguages = getSupportedLanguages(domain)
   negotiator = getUtility(INegotiator)
   currentLang = negotiator.getLanguage(supportedLanguages,context)
   if currentLang in ['', None]:
 #We failed to get the browser's language, so, the default will be 
assumed
 currentLang = DEFAULT_LANGUAGE

   return currentLang

def useTranslationService(context, msgid, domain = None, mapping = None, 
lang = None,
   default = None):
   Uses the TranslationService from python
   context = getattr(context,'REQUEST',context)

   isMessageId = (type(msgid) == MessageID)
   if lang is None:
 if isMessageId:
   domain = msgid.domain
 lang = getLanguage(context,domain)

   if default is None:
 default = msgid

   if isMessageId:
 #A MessageId object already has everything on it: domain, mapping, 
and a
 #default value, so, we don't need to pass them here
 translation = _(msgid, target_language = lang, context = context)
   else:
 translation = _(msgid,
 domain = domain,
 mapping = mapping,
 target_language = lang,
 default = default,
 context = context)
   return translation
___
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 suppress http based authentication window of zope

2008-09-18 Thread Josef Meile
Hi,

CookieCrumbler worked fine for me on the past. The only thing that's
up-to-you is to customize the login form if it doesn't fit your needs.

Perhaps the only issues I see on CookieCrumbler are:

1) Even if you redirect your login_form to https, the came_from
variable, which is set when you arrive to the login_form page, will
redirect you to http. In order to fix this, you have either:

a) Change the came_from variable to https. I did some patch on the past,
however, since I personally don't like cookies, I'm not using it nor
having tested it recently. See this post:

SSL Redirect for CookieCrumbler
http://mail.zope.org/pipermail/zope/2006-June/166799.html

Please note that you need an apache rule to redirect all http requests
to your login_form to https.

b) Force that zope authentication is always done in ssl. I also did a
product, but I have only tested it with http authentication. I think
it may also work with the CookieCrumbler:

JMSSLBasicAuth
http://www.zope.org/Members/jmeile/JMSSLBasicAuth

With this product, no apache rule to redirect to ssl is needed.
Nevertheless you still need the apache ssl module to define your https
virtual host.

3) Cookies are somehow stored on the hardisk. I don't know how
CookieCrumbler manages this. That's why I forget about them and keep
using http based authentication through ssl. Anyway, an alternative
would be the SessionCrumbler product; It also stores a Session Cookie,
but it will be ramdom and expire at sometime. However it depends on
Plone, but I guess it won't be difficult to port to plain zope:

http://plone.org/products/sessioncrumbler

Best regards
Josef

vaibhav pol schrieb:
 Dear All,
   As per my information zope  provide http based 
 authentication and not support cookies based authentication . I used  
 CookieCrumbler,exUserFolder,fcForum  Products but it not so useful and 
 robust . I want to suppress login wnidow of the zope which  genarated by 
 browser and replace to that I want to show  user  login form. Is any way 
 to do that if you have any information  or any one who working on zope 
 devlopment to make zope support for cookies based  authentication.
 please help me!
 
  
 
 thanks and regards,
 vaibhi
 
 
 
 
 
 ___
 Zope maillist  -  [EMAIL PROTECTED]
 http://mail.zope.org/mailman/listinfo/zope
 **   No cross posts or HTML encoding!  **
 (Related lists - 
  http://mail.zope.org/mailman/listinfo/zope-announce
  http://mail.zope.org/mailman/listinfo/zope-dev )

___
Zope 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 suppress http based authentication window of zope

2008-09-18 Thread Josef Meile
Hi,

 Thank you for replay . yes I know that product is using cookie 
 based authentication.I want to know that is any work go around to 
 support zope cookie based or form based authentication.
Well, I think it won't be included to zope source code. Why to do it?
There is already two products for that: CookieCrubmbler and
SessionCrubmbler.

   I also I used CookieCrubmbler for Cookie based authentication.
   It Modify the request and server response and edit the header but 
 because by using that we can suppress login window of browser but at the 
 time logout it not modify the server response server send the Basic 
 Authentication with 401 code .
 By seeing that browser kill user session I want is any other way to 
 kill user session.
  means by sending any response or can i kill user session
I just don't know if this is correct, but as I understand, at the logout
time, what the CookieCrumbler does is to reset the authentication
cookies. I used it on the past and it worked. I don't know what problem
are you having.
___
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 suppress http based authentication window of zope

2008-09-18 Thread Josef Meile
  Yes you are  correct it reset the authenticate cookies but from 
 logout from  zope it
 call zmi_logout  beacuse of that  again login window prompt I just 
 want to redirect to the login page  and also i want user must be logut .
  As per my knowledge It not possible because  session is maintaind by 
 client browser.
 If you have any information Pleaase help me.
Ah, you are log in into the zmi. I thoght that you were talking about
non manager users accessing a protected zope content. For this case the
CookieCrumbler logout form will work. Well, then I guess you will have
to close the browser. I don't know any other solution.
___
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 )


AW: [ZWeb] Re: [Zope] Zope lists in google

2008-02-08 Thread Josef Meile
Sascha Welter wrote:
 I can't think that mail.zope.org has anything to do with a ZODB or is 
 configured from zope.org
 (Removed the cross posting, dunno what this has to do with zope@)
Sorry, I wasn't aware about this list nor that there were a thread already 
here; the person who cross-posted to [EMAIL PROTECTED], where I originally
posted, didn't mention that.

Because the person originally asking the question posted there...
(I'm now CC'ing him in directly...)
Thanks.

 http://mail.zope.org/robots.txt has:
 
 User-agent: *
 Disallow: /
 
 Somebody didn't like the bots to roam the archives? 

I have a feeling someone didn't want bots spanking some web-subversion 
front end that's running, but the end result is that we loose all Zope 
code and mailing list archives from Google :-(
Yes, that's really sad. I really don't like gmane searching function :-(
and google is my friend ;-)

 I think Chris wanted
 to see the undo history to find out who made that change.

Indeed, yes, brain fart, shouldn't have been looking on www.zope.org...
I guess it doesn't matter who did it. What matters is if it will continue
like that or if somebody in zope.org will repair it.

Best regards,
Josef

___
Zope-web maillist  -  Zope-web@zope.org
http://mail.zope.org/mailman/listinfo/zope-web


[Zope-DB] Re: Which objects can be stored in Data.fs

2005-10-06 Thread Josef Meile

2) is it possible to tell zope NOT to store some things in the database
(for instance in zope.conf-I've looked but not too closely and found
nothing)

Why don't you run a cron job that packs the database, let's say each
month? You could also do a backup before packing; just in case you want
to undo something later.

Something that would be nice, would be to be able to store transactions
in a separate file before packing, but I don't think it is posible in
Zope. You may have to write something to do this.

Regards,
Josef

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


[Zope-DB] Re: Which objects can be stored in Data.fs

2005-10-07 Thread Josef Meile

Something that would be nice, would be to be able to store transactions
in a separate file before packing, but I don't think it is posible in
Zope. You may have to write something to do this.



Huh? not sure what you mean... if you keep the .old file created during 
packing, that has all the transactions in it that would have been packed 
away...

I was just thinking about only keeping a log file with the transactions
without the data and let's say apply it to a packed Data.fs. It was just
a nice-to-have idea, nothing else. But I think for the OP would be
enough to keep the Data.fs.old as you said.

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