Re: [Zope] Set MIME type using ZPT

2005-04-04 Thread Cliff Ford
srikanth wrote:
Hi,
  I am using an external method to load an Image from the harddrive. The
external method is as follows:
from email.MIMEImage import MIMEImage
##parameters=filename
def getDocument(filename):
  fname = '/mnt/'+filename;
input = open(fname,'r')
content = MIMEImage( input.read( ) )
input.close( )
return content
When I try to display the content in the webpage what I actually got is
all raw data of the file rather the image. 
So how can I convert the raw data to be dispalyed as image in the
webpage. I am using ZPT to display the web page (image). If its dtml I
could have used  tag is there any equivalent to that in ZPT.

Any suggestion would be a gr8 help.
It is not clear exactly how you are using the Page Template. Typically 
the page would have an img tag that calls a python script that calls the 
External Method. Remember the web browser fetches the image separately 
after the html has been received - so your img tag might look like this:
 and your getImage python 
script would look like this:

(type, encoding) = context.getMimeType(context.REQUEST.filename)
context.REQUEST.RESPONSE.setHeader('Content-Type', type)
context.REQUEST.RESPONSE.setHeader('Content-Disposition', 'inline;
return context.getDocumentCall(context.REQUEST.filename)
where getDocumentCall is the name of your External Method that calls the 
getDocument External Method and getMimeType is another External Method 
that looks like this:

import mimetypes
def getMimeType(filename):
return mimetypes.guess_type(filename)
and your own external method would look like this:
> ##parameters=filename
> def getDocument(filename):
>   fname = '/mnt/'+filename;
>input = open(fname,'r')
>content = input.read( )
>input.close( )
>return content
At the moment you seem to have skipped a step.
HTH
Cliff
Ta.
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   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: Potential PythonScript bug (was: Re: [Zope] question about manipulating zcatalog query results)

2005-04-04 Thread Ira Sher
Dieter,
thanks. I'll take a look at that now. The folks at bug collection are
unable to reproduce the bug on 2.7.5, though, and so we're trying to
determine how else it might be occuring--Products would be my best
guess, as the Product list has changed (many are obsolete or simply
don't run on 2.7.5 when migrating from 2.5.1 (with products that have
been left on since 1.x...ug). The last version I had it running stably
on was 2.6.3, locally, and of the several products that have been
migrated out since then, PluginIndexes and ZCTextIndex I can't grab
from cvs (the versions I have crash the startup) as I get a 4k empty
tarball downloading with any browser...don't know if these should be
obsolete, too.

take care and thanks again for the suggestions
ira

On Apr 4, 2005 11:48 AM, Dieter Maurer <[EMAIL PROTECTED]> wrote:
> Ira Sher wrote at 2005-4-3 13:32 -0700:
> > ... "NameError: global name _getiter_ not defined"...
> 
> >if sorton == 'id':
> >   res=[(row.id.split().pop(), row) for row in results]
> >res.sort()
> >return res
> >
> >This doesn't work, either, in zope 2.7.4 or 2.7.5 with python 2.3.4
> >and 2.3.5 respectively, as far as I can see.
> >
> >Thanks for taking a look at things--I'll file a bug report (this is
> >stopping me from migrating a site into 2.7) as you suggested
> 
> The strange thing is that I can do:
> 
> return [o.id for o in container.Catalog()]
> 
> without a problem.
> 
> However, I am still using Zope 2.7.2 -- the version
> before the last security shakeup...
> 
> If your script does not need security checks, than
> my "TrustedExecutables" might help you. It provides
> "PythonScript"s without any security restrictions -- and
> especially without the need for "_getiter_".
> 
>   
> 
> --
> Dieter
>
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Problem with Z Psycopg

2005-04-04 Thread Barry Pederson
Jason Leach wrote:
I'm having a problem with Z Psycopg.  From time to time (quite often)
it looses the connection with the database and I get:
   Site Error
   An error was encountered while publishing this resource.
   Error Type: OperationalError
   Error Value: no connection to the server
Then I have to login then close and open the connection.  It then
works for a while before bailing again.
Does anyone know what would be causing this?
Zope Version (Zope 2.7.3-0, python 2.3.4, linux2)
Python Version 2.3.4 (#1, Oct 13 2004, 21:44:19) [GCC 2.95.4 20011002
(Debian prerelease)]
And ZPsycopg is version 1.11
Not sure, but I can report seeing the same thing on a different setup
FreeBSD 4.8
Zope 2.7.5
Python 2.3.5
psycopg 1.1.18 (linked to PostgreSQL 8.0.1 client library)
(PostgreSQL server is also 8.0.1, but on FreeBSD 5.2.1)
On the very same machine I also have
Zope 2.6.1
Python 2.1.3
psysopg 1.0.6 (linked to an older PostgreSQL 7.2 client library)
running simultaneously, connecting to the very same DBs, but it hasn't 
had the same connection problems.

I was wondering if it might be something with psycopg and the new pgsql 
8.0.1 library.  What pgsql client lib is you psycopg linked to?

	Barry
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   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] Set MIME type using ZPT

2005-04-04 Thread srikanth
Hi,

  I am using an external method to load an Image from the harddrive. The
external method is as follows:

from email.MIMEImage import MIMEImage
##parameters=filename
def getDocument(filename):
  fname = '/mnt/'+filename;
input = open(fname,'r')
content = MIMEImage( input.read( ) )
input.close( )
return content


When I try to display the content in the webpage what I actually got is
all raw data of the file rather the image. 
So how can I convert the raw data to be dispalyed as image in the
webpage. I am using ZPT to display the web page (image). If its dtml I
could have used  tag is there any equivalent to that in ZPT.

Any suggestion would be a gr8 help.

Ta.


___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   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] Iron Python

2005-04-04 Thread Lennart Regebro
On Apr 4, 2005 11:50 PM, Brian Sullivan <[EMAIL PROTECTED]> wrote:
> I am trying to digest what if anything the introduction of Iron
> Python(http://www.gotdotnet.com/workspaces/workspace.aspx?id=ad7acff7-ab1e-4bcb-99c0-57ac5a3a9742)
>  (and Microsoft's involvement/leadership investment) will mean to Zope
> or in general.
> 
> Thoughts? Is this positive, negative or neutral?

As zope doesn't run on Iron python the impact will be small. it's nice
for people that are forced to run .NET to be able to do it in Python
though. And it does marginally widen .NETs appeal, but only
marginally. :-)
-- 
Lennart Regebro, Nuxeo http://www.nuxeo.com/
CPS Content Management http://www.cps-project.org/
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] Problem with Z Psycopg

2005-04-04 Thread Jason Leach
I'm having a problem with Z Psycopg.  From time to time (quite often)
it looses the connection with the database and I get:
   Site Error
   An error was encountered while publishing this resource.
   Error Type: OperationalError
   Error Value: no connection to the server

Then I have to login then close and open the connection.  It then
works for a while before bailing again.

Does anyone know what would be causing this?

Zope Version (Zope 2.7.3-0, python 2.3.4, linux2)
Python Version 2.3.4 (#1, Oct 13 2004, 21:44:19) [GCC 2.95.4 20011002
(Debian prerelease)]
And ZPsycopg is version 1.11

Thanks,
Jason.
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   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] Iron Python

2005-04-04 Thread Brian Sullivan
I am trying to digest what if anything the introduction of Iron
Python(http://www.gotdotnet.com/workspaces/workspace.aspx?id=ad7acff7-ab1e-4bcb-99c0-57ac5a3a9742)
 (and Microsoft's involvement/leadership investment) will mean to Zope
or in general.

Thoughts? Is this positive, negative or neutral?
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   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] role, user defined roles, and inclusion

2005-04-04 Thread Dieter Maurer
Chris Withers wrote at 2005-4-4 14:14 +0100:
>Florent Guillaume wrote:
>> OTOH Anonymous and Authenticated really shouldn't be roles but groups, 
>> and indeed in CPS we have special groups representing Anonymous and 
>> Authenticated. That makes things *much* more orthogonal, and local roles 
>> (local group roles actually) can be used with them to assign rights. But 
>> I digress.
>
>I find the distinction between roles and groups to be useless ;-)

A role that does not fit well into the group concept is the "Owner" role.

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


Re: [Zope] Re: login page problem

2005-04-04 Thread Dieter Maurer
prabuddha ray wrote at 2005-4-4 01:41 -0700:
> ...
>> A combination of exUserFolder and MySQL would do.
>
>i don know about them, something like mysqluserfolder or
>simpleuserfolder components ?

"exUserFolder" is something like the big brother of
"SimpleUserFolder" -- much more complex but also much more flexible...

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


Re: [Zope] getting all fields from dynamic checkboxes

2005-04-04 Thread Dieter Maurer
Dan E wrote at 2005-4-3 17:00 -0400:
>Has anyone found a way to get a list of boolean values from
>dynamically created checkboxes.
>I have created a bunch of checkboxes within a repeat loop like this:
>
>class="noborder"
>   name="cb_array:list:int"
>   tal:attributes="tabindex tabindex/next;
>   checked python:test(curr_prop, 'checked', None);">
>
>but when I access the cb_array from my python script, I only get the
>checked values (and I can no longer match the values up with the
>checkbox they came from).
>
>any help on this would be appreciated.

You may use the ":default" specifier with a hidden variable
to provide a value when the browser does not sent one.


  

briefly describes the request variable specifier.

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


Potential PythonScript bug (was: Re: [Zope] question about manipulating zcatalog query results)

2005-04-04 Thread Dieter Maurer
Ira Sher wrote at 2005-4-3 13:32 -0700:
> ... "NameError: global name _getiter_ not defined"...

>if sorton == 'id':
>   res=[(row.id.split().pop(), row) for row in results]
>res.sort()
>return res
>
>This doesn't work, either, in zope 2.7.4 or 2.7.5 with python 2.3.4
>and 2.3.5 respectively, as far as I can see.
>
>Thanks for taking a look at things--I'll file a bug report (this is
>stopping me from migrating a site into 2.7) as you suggested

The strange thing is that I can do:

return [o.id for o in container.Catalog()]

without a problem.

However, I am still using Zope 2.7.2 -- the version
before the last security shakeup...


If your script does not need security checks, than
my "TrustedExecutables" might help you. It provides
"PythonScript"s without any security restrictions -- and
especially without the need for "_getiter_".

  



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


Re: [Zope] script or external method ?

2005-04-04 Thread Dieter Maurer
[EMAIL PROTECTED] wrote at 2005-4-4 00:49 +0200:
> ...
>The code i've writed imports date object from datetime
>package: this makes it
>doesn't work like a script (python), so i adapt code
>as an external method; but
>when i run the method Zope says that he can't find
>symbol 'container'... (mumble)

You may use my "TrustedExecutables" product.
It gives you PythonScripts without security restrictions
(and you can forget about ExternalMethods).


  



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


[Zope] Re: ImportError: DBTab.ClassFactories.autoClassFactory

2005-04-04 Thread Tres Seaver
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

TERRIEN Mickael wrote:
> Hello,
>  
> i have the same problem with my zope running...
>  
> i have seen your post at the address :
> http://mail.zope.org/pipermail/zope/2004-October/154258.html  
>  
>  
> but I don't understand your response
>  
> If you can explain more your response i am really interested.

Sorry for the delay.  You would likely get quicker response if you had
replied on the list.

The DBTab product is not compatible with Zope >= 2.7.  Its functionality
has been moved into the core, and is now configured using the normal
'zope.conf' config file (note that the sessions machinery configures the
temporary storage mounted at '/temp_folder' this way).


> Thank you.
>  
> (Excuse my english)

No problem.

- --
===
Tres Seaver[EMAIL PROTECTED]
Zope Corporation  "Zope Dealers"   http://www.zope.com
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCUWdjGqWXf00rNCgRAjJzAJ9dQwaFwS/0v+zekJijWqWx9bWVcwCaA8k+
zQ5SkupTJzpRuFSo09kojOU=
=bjbE
-END PGP SIGNATURE-
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Does anyone care whether we deprecate ZClasses?

2005-04-04 Thread Lennart Regebro
On Apr 4, 2005 5:14 PM, Garito <[EMAIL PROTECTED]> wrote:
> Perhaps will be a good choice to make ZClasses as an installable product
> (I don't know if this is possible or not

Sure it is, but the problem is that supporting it in future versions
of Zope very well may need changes in Zope itself.  Changes that is
*far* from trivial. So I think it's mostly a question of "Should Zope
corp put down the effort to keep ZClasses working", because, most
likely nobody else can...

-- 
Lennart Regebro, Nuxeo http://www.nuxeo.com/
CPS Content Management http://www.cps-project.org/
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Does anyone care whether we deprecate ZClasses?

2005-04-04 Thread Garito
AM Thomas escribió:
I agree that ZClasses are not good to use.  However, I have a product 
based on ZClasses that I wrote several years ago (after reading the 
printed Zope book - doh!), and it's working well for several of my 
clients.  If future versions of Zope were to not support it, that 
would be a huge problem for me... unless there were some utility that 
would allow me to export my ZClasses to a regular file-system product.

Thanks,
AM
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )
Perhaps will be a good choice to make ZClasses as an installable product 
(I don't know if this is possible or not

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


Re: [Zope] Re: login page problem

2005-04-04 Thread Cliff Ford
I am abstracting bits of your email below in case anyone else wants to 
join in.

> I dint want to built customized login page in 1st place. Actually this
> is a Govt. stores management site used in my state only bulit all in
> ASP. I 've to convert this into a Zope and Plone version.
> So i wanted to get it converted with minimun changes.
If you are going to use Plone I can't offer advice - I have looked at 
Plone on three separate occasions, and recently read The Definitive 
Guide to Plone, and have stil decided not to use it. I only say this to 
make it clear that many applications are built without CMS and Plone.

> 1> the district name and their users come from 2 seperate Mysql
> tables. the users are unique in each district.
Two separate tables with User information is awkward! The user folders I 
know of expect user information to come from one source. So you either 
have to create two folders, each with its own acl_users (provided by one 
of the User Folder Products), or you have to hack the User Folder 
product to put in a Union select statement in place of a simple Select.

> Now the qusetion is how do build this district user folder structure
> using the database?
> Hope not manually, because there are 22 districts and about 15 users
> in each of them pluys head quarters.
You have not said whether the people in the different districts do 
completely different things with different forms, or identical things 
but specifying the district. If the former then it is no big deal to 
create the folders manually, although it can be done programmtically. 
You could set a Local Role equal to the district name and get that role 
for users from the database. That way, users can only enter their own 
district folder. If the latter, then you could retrieve the Username and 
District from the User object for use in the forms (include the District 
as a role).

> i dint get to know much about coding ZPT's and Script(Python) for
> them, from the ZPT refs and Zopebook. So wanted some simple working
> examples.
Try working on the rest of your application to build up ZPT and Python 
experience. As I said, managing users is tricky. Also, be aware that 
Zope experts advise developers to produce file system based Products. 
There are lots of simple Products that you can use and browse the code 
to see how they work.

Cliff
_
prabuddha ray wrote:
Hi list,
never before i got such a holistic advice.
thanks so much Cliff.
About the 1st mail,
On Sat, 02 Apr 2005 17:03:56 +0100, Cliff Ford <[EMAIL PROTECTED]> wrote:
Customisation of the login sequence is quite difficult for Newbies
because there are lots of different ways to approach the problem - you
have already tried some. I suspect that trying to match what was done in
PHP may be part of your problem. It would be helpful to know if your
lists of users are coming from one source, like a database table, or
multiple sources, like multiple tables or different databases, and
whether users are unique in each district

I dint want to built customized login page in 1st place. Actually this
is a Govt. stores management site used in my state only bulit all in
ASP. I 've to convert this into a Zope and Plone version.
So i wanted to get it converted with minimun changes.
But now as you say i think I should go the way Zope does it . only
that i'm finding it hard to customize it in Zope.
1> the district name and their users come from 2 seperate Mysql
tables. the users are unique in each district.

From there you decide your
zope folder structure. It could be like this:
site_home
|__acl_users
|__district1
|__district2
or like this:
site_home
|__district1
||__acl_users
|__district2
||__acl_users
In the second case you would not have to worry about asking the user for
the district name. In the first case you would get a district name or a
user defined role for that district from a supplementary data source,
like a database.

So i think 2nd structure is abetter fit.
Now the qusetion is how do build this district user folder structure
using the database?
Hope not manually, because there are 22 districts and about 15 users
in each of them pluys head quarters.

A combination of exUserFolder and MySQL would do.

i don know about them, something like mysqluserfolder or
simpleuserfolder components ?

You can get information on the logged in user (Username and Roles) from
the User object, so you don't need to expicitly use sessions at this
stage. You should certainly not store passwords - that would be a 
serious breach of confidentiality.
Maybe you should say what you do with the District parameter after the
user has logged in.

I dont need the password but do need the username and district for
following pages to decide the access rights and the stores available
inthe districts , also for some report labels.

Giving advice or examples on ZPT and Python for an
approach that is probably wrong is just too time-consumi

Re: [Zope] Does anyone care whether we deprecate ZClasses?

2005-04-04 Thread AM Thomas
I agree that ZClasses are not good to use.  However, I have a product 
based on ZClasses that I wrote several years ago (after reading the 
printed Zope book - doh!), and it's working well for several of my 
clients.  If future versions of Zope were to not support it, that would 
be a huge problem for me... unless there were some utility that would 
allow me to export my ZClasses to a regular file-system product.

Thanks,
AM
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   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] Plone/Zope on Debian Sarge

2005-04-04 Thread charlie derr
Andreas Pakulat wrote:
On 04.Apr 2005 - 14:02:43, Chris Withers wrote:
The moral of this whole story seems to shine through:
Don't install Zope from OS packages like debian, they never get it right and 
you will just end up getting confused ;-)

Yepp, especially, since Zope is that easy to install into your home...
Andreas
I (a relative zope amateur) would offer my own counter-experience.  I 
recently set up zope-coreblog and zope2.7 (using packages from debian 
sarge/testing), and it's been running with very few issues for several 
months (and I additionally was able to get ldap integration working 
using the ldapuserfolder Product)

maybe the "better" or "surer" way to do things is to install zope 
(os-agnostic) binaries, but being already familiar with debian, for me 
it's worked out fine (so far) to use the debian-packaged stuff (though 
I've admittedly not played substantially with plone yet)

	~c
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   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] Plone/Zope on Debian Sarge

2005-04-04 Thread Andreas Pakulat
On 04.Apr 2005 - 14:02:43, Chris Withers wrote:
> The moral of this whole story seems to shine through:
> 
> Don't install Zope from OS packages like debian, they never get it right and 
> you will just end up getting confused ;-)

Yepp, especially, since Zope is that easy to install into your home...

Andreas

-- 
Chicken Little was right.
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   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] Does anyone care whether we deprecate ZClasses?

2005-04-04 Thread Garito
Chris Withers escribió:
Well, you know what I'm gonna say...
+1 for their demise.
+1 for DTML going too, oops, wait, Andreas said not to bring that up ;-)
cheers,
Chris
Jim Fulton wrote:
ZClasses are a feature that support through-the-web development.
Many people have found them useful in the past, but they have some
significant deficiencies, including:
- They can't be managed with file-system tools, especially
  revision control systems like CVS and subversion.
- They don't work well with Python development tools, like
  profilers and debugger.
- They aren't being actively maintained.
Most serious Zope developers stopped using them a long time
ago and are frustrated that we still expend resources keeping them
around.  For example, the release of Zope 2.8 has been delayed
by the requirement of getting ZClasses working with Zope 2.8.
We could choose to deprecate ZClasses.  If we deprecated them in
Zope 2.8, they would still work in Zope 2.8 and Zope 2.9, but
their support would be removed in Zope 2.10.  Would anyone be upset
if this happened?
Jim

Yep!
Don't talk about DTML or you will be punished (sorry Andreas I can't 
resist myself, hehe, obviously I'm joking)

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


Re: [Zope] getting all fields from dynamic checkboxes

2005-04-04 Thread Chris Withers
Phillip Hutchings wrote:
You need to keep a server-side list of the checkboxes and check which
ones aren't there. Web browsers don't send back checkboxes that aren't
checked - it's an HTML feature.
Well, server side lists don't scale. I've found keeping a hidden html 
input with a list of the fields I'm expecting back can help, but bear in 
mind that makes it more hackable...

cheers,
Chris
--
Simplistix - Content Management, Zope & Python Consulting
   - http://www.simplistix.co.uk
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   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] role, user defined roles, and inclusion

2005-04-04 Thread Chris Withers
Florent Guillaume wrote:
OTOH Anonymous and Authenticated really shouldn't be roles but groups, 
and indeed in CPS we have special groups representing Anonymous and 
Authenticated. That makes things *much* more orthogonal, and local roles 
(local group roles actually) can be used with them to assign rights. But 
I digress.
I find the distinction between roles and groups to be useless ;-)
Chris
--
Simplistix - Content Management, Zope & Python Consulting
   - http://www.simplistix.co.uk
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   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] RSS feed: post-processing?

2005-04-04 Thread Chris Withers
Sorry Eva,
You'll need to explain your problem more succintly for people to be able 
to help. If you really do need to scrape the urls from the text, then a 
combination of python's xml handling and regular expressions is probably 
what you're after, best done in an external method and not a python 
script...

cheers,
Chris
MILLER Eva wrote:
Hello,
I've been puzzling over something but can't figure out a solution. I  
have an RSS feed providing the content behind all the links on this  
page: http://demo.plinkit.org/interestsideas/goodreads/booklists.

There's a nice bookmarklet tool in the world called LibraryLookup that  
lets you check whether a book you find on Amazon or something is in  
your library's catalog by scraping up the ISBN and launching an ISBN  
catalog search. It's a javascript, really. I thought I would adapt this

to create a little add-on for the stuff the bestsellers RSS brings back
to my site. What I need to do is pluck out the ISBNs in the links on a  
page like this one:  
http://demo.plinkit.org/interestsideas/goodreads/sinList?synmap=Hardcove
rFiction

The ISBNs are all in the URLs for the book titles  
("isbn=Some10digitNumberHere"). How would I look for a piece of text in

that shape, i.e., isbn=5893193390, then, if it's there, copy and paste  
that piece of information into the LibraryLookup javascript I have. The

end result should be that, if there's an ISBN in a feed result, an extra
link  
appears for each entry that says something like "Check the catalog,"  
which you can click to look that book up in your own library's catalog.

I've been staring at the template that formats the RSS feed to figure  
out whether any TAL expression would work for this. I've been playing  
with a short Python script, then wondering how to call it within that  
template, but I think I have to use regular expressions to do it.

I'm sorry to be so lost on this, but I guess I am. I'd love to do  
something cool like this for our little Plinkit libraries. Can anyone  
help? I'll take anything from a broad strategy to actual code snippets  
(I'm a terrible programmer but a good librarian).

Thanks
Eva the Librarian


___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )
--
Simplistix - Content Management, Zope & Python Consulting
   - http://www.simplistix.co.uk
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   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] Does anyone care whether we deprecate ZClasses?

2005-04-04 Thread Chris Withers
Well, you know what I'm gonna say...
+1 for their demise.
+1 for DTML going too, oops, wait, Andreas said not to bring that up ;-)
cheers,
Chris
Jim Fulton wrote:
ZClasses are a feature that support through-the-web development.
Many people have found them useful in the past, but they have some
significant deficiencies, including:
- They can't be managed with file-system tools, especially
  revision control systems like CVS and subversion.
- They don't work well with Python development tools, like
  profilers and debugger.
- They aren't being actively maintained.
Most serious Zope developers stopped using them a long time
ago and are frustrated that we still expend resources keeping them
around.  For example, the release of Zope 2.8 has been delayed
by the requirement of getting ZClasses working with Zope 2.8.
We could choose to deprecate ZClasses.  If we deprecated them in
Zope 2.8, they would still work in Zope 2.8 and Zope 2.9, but
their support would be removed in Zope 2.10.  Would anyone be upset
if this happened?
Jim
--
Simplistix - Content Management, Zope & Python Consulting
   - http://www.simplistix.co.uk
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   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] role, user defined roles, and inclusion

2005-04-04 Thread Florent Guillaume
Chris Withers wrote:
Florent Guillaume wrote:
When doing user.getRoles(). Because as Tres said more clearly than me,
every user can do what the Anonymous role can, so it's just being
consistent to express that in user.getRoles(). IMHO.
Well yours is the only userfolder implementation that does.
While I agree in the security short circuiting code, I think having a 
getRoles return Anonymous and Authenticated at the same time is bizarre...
I understand it could be viewed that way. Anyway we haven't found any 
problem in doing this. I'll look if it can be removed safely.

OTOH Anonymous and Authenticated really shouldn't be roles but groups, 
and indeed in CPS we have special groups representing Anonymous and 
Authenticated. That makes things *much* more orthogonal, and local roles 
(local group roles actually) can be used with them to assign rights. But 
I digress.

Florent
--
Florent Guillaume, Nuxeo (Paris, France)   CTO, Director of R&D
+33 1 40 33 71 59   http://nuxeo.com   [EMAIL PROTECTED]
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   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] Plone/Zope on Debian Sarge

2005-04-04 Thread Chris Withers
The moral of this whole story seems to shine through:
Don't install Zope from OS packages like debian, they never get it right 
and you will just end up getting confused ;-)

cheers,
Chris
Andreas Pakulat wrote:
On 01.Apr 2005 - 14:34:22, Peter Bittner wrote:
Hi there!
I am running a Debian Linux box with Debian/testing (Sarge) and I am trying to 
get Plone up and running. I have made a clean, new install of the whole 
system last week, so all packages are really up-to-date and there was no 
dirty installation that was updated.

I have noticed that the Plone package on Debian is or was somewhat broken, but 
there was a notice about that on the Plone website (download page) which has 
disappeared. For me that looked like this problem was fixed by the package 
maintainer.

Unfortunately still, after installing Plone (and implicitly thus Zope 2.7) 
Zope did not want to come up, saying:

Did you read the debconf-pages that were presented to you during the
installation of zope and plone? I guess not, because else you won't
ask that question. Short answer: create a new Zope instance using
mkzope2.7instance, check it's config and remove the '#' on the lines:
products /usr/lib/zope2.7/lib/python/Products
products /usr/lib/zope/lib/python/Products
products $INSTANCE/Products
To have Zope 2.7 find the Plone Product. The documentation of Zope and
Plone will explain why you need to do that.

 Zope starting all instances
 '*' is an old/purged instance, not started

Looks like Zope2.7 finds an old 2.6 instance, but I'm not sure...
Andreas
--
Simplistix - Content Management, Zope & Python Consulting
   - http://www.simplistix.co.uk
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   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] zygopetale.py

2005-04-04 Thread Chris Withers
Sounds like you're really after LDAPUserFolder :-)
Chris
Yahya AZZOUZ wrote:
hi,
i m looking for zygopetale.py ( it allow to interact with ldap).
could someone send me it.
thanks.
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )
--
Simplistix - Content Management, Zope & Python Consulting
   - http://www.simplistix.co.uk
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   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] role, user defined roles, and inclusion

2005-04-04 Thread Chris Withers
Florent Guillaume wrote:
When doing user.getRoles(). Because as Tres said more clearly than me,
every user can do what the Anonymous role can, so it's just being
consistent to express that in user.getRoles(). IMHO.
Well yours is the only userfolder implementation that does.
While I agree in the security short circuiting code, I think having a 
getRoles return Anonymous and Authenticated at the same time is bizarre...

Chris
--
Simplistix - Content Management, Zope & Python Consulting
   - http://www.simplistix.co.uk
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   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] Does anyone care whether we deprecate ZClasses?

2005-04-04 Thread Andreas Jung

--On Montag, 4. April 2005 10:23 Uhr +0200 Yuri <[EMAIL PROTECTED]> wrote:
Andreas Jung ha scritto:

--On Montag, 4. April 2005 9:58 Uhr +0200 Yuri <[EMAIL PROTECTED]> wrote:
 Yes, but BEFORE do a tool to convert them in a python product or
archetype similar, a tool to change base classes, a tool to convert a
zclass based on catagaware to one based on catalogPATHaware, or merge
the
two.

This would be up to the community :-)
-aj
As a right KeywordIndex? *grin* :P
??
-aj



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


Re: [Zope] script or external method ?

2005-04-04 Thread Lennart Regebro
Congratulations: You immediately ran into a limitation of Python
Scripts, and then equally quickly into one of external methods. That's
good, because that means you don't get stuck into the wrong way of
programming. :-)

The "right" way of doing Zope development is with filesystem python products.

Not Python Scripts, not External Methods, not ZClasses and not DTML.
Each of these may have their place, the best generic way is file
system products. I don't know what is the best starting point
nowadays, but I think doing the Boring Product tutorial still seems
popular:

http://www.zope.org/Members/gtk/Boring/HowTo-Boring


For Zope development there is today basicaly two and a half different
paths to go:

One: Zope2 (which is what you started with now). This gives you access
to loads of products and a huge community to support you. This is the
right way to go if you are interested in using Zope for creating a web
site. Primarily you have a whole bunch of different content management
systems to select from (CPS, Plone and several more) to get you
started. There are also blog software and wikis and stuff that can be
used with these.

Two: Zope3. If you are more interested in developing the system, and
you want a good development framework as your reference to j2ee
indicates, then Zope 3 may be the path for you. It doesn't have that
much of all this modules like Zope2 does, but the development
framework is SO much better. I sincerely doubt there is anything even
remotely this cool anywhere else in the webworld.

The drawbacks of Zope 3 is that you'll have to develop more yourself,
and it is a bit harder to get started with.

Two and a half: Five/Zope2.8. This is a way to use the Zope3 framework
under Zope2. It's mostly of interest for people who have legacy
products under Zope2.



On Apr 4, 2005 12:49 AM, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
> Hi all,
> i'm a new user of Zope; i'm studing it since two weeks
> and i think it's very
> interesting, 'cause has the same power of j2ee
> application server but it is
> much more easy to use!
> While i was developing my first Zope application i
> fell into this trouble: i
> would like to write a script that create a folder, put
> some file in it, and
> set some properties.
> The code i've writed imports date object from datetime
> package: this makes it
> doesn't work like a script (python), so i adapt code
> as an external method; but
> when i run the method Zope says that he can't find
> symbol 'container'... (mumble)
> 
> Well, 2 are the questions:
> First, what i've to do to get service variable like
> like container, context, request, etc.. ?
> Which are differences between script and external
> method coding? i remember that the zope book
> indicates only imports.
> 
> Ok, thank you for reading..
> 
> Valerio

-- 
Lennart Regebro, Nuxeo http://www.nuxeo.com/
CPS Content Management http://www.cps-project.org/
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] script or external method ?

2005-04-04 Thread J Cameron Cooper
[EMAIL PROTECTED] wrote:
Hi all,
i'm a new user of Zope; i'm studing it since two weeks
and i think it's very
interesting, 'cause has the same power of j2ee
application server but it is 
much more easy to use!
While i was developing my first Zope application i
fell into this trouble: i
would like to write a script that create a folder, put
some file in it, and 
set some properties.
The code i've writed imports date object from datetime
package: this makes it
doesn't work like a script (python), so i adapt code
as an external method; but
when i run the method Zope says that he can't find
symbol 'container'... (mumble)

Well, 2 are the questions:
First, what i've to do to get service variable like
like container, context, request, etc.. ?
Which are differences between script and external
method coding? i remember that the zope book
indicates only imports.
Python scripts (the TTW kind) have security restrictions and have 
special procedures for setting the name and the parameters of a method. 
(Via the TTW forms: notice that you don't write def methodname() et al.) 
There are also some special names bound, like context and so forth.

External methods are regular Python methods in a Python module which are 
made available to be used live in Zope. Just as in any Python method, 
you can get to the context in which it was called through the 'self' 
parameter, which you will define as the first param. This is the same as 
'context' in a Python script. So you can say::

  def getThisId(self):
return self.getId()
You can get the request like 'self.REQUEST'. The container can be found 
with self.aq_inner.aq_parent or something like that.

Alternately, you can allow modules in Python scripts. See 
zope/lib/python/Products/PythonScripts/README or 
http://svn.zope.org/Zope/trunk/lib/python/Products/PythonScripts/README.txt?rev=24563&view=auto

--jcc
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   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] Does anyone care whether we deprecate ZClasses?

2005-04-04 Thread Yuri
Andreas Jung ha scritto:

--On Montag, 4. April 2005 9:58 Uhr +0200 Yuri <[EMAIL PROTECTED]> wrote:
 Yes, but BEFORE do a tool to convert them in a python product or
archetype similar, a tool to change base classes, a tool to convert a
zclass based on catagaware to one based on catalogPATHaware, or merge 
the
two.

This would be up to the community :-)
-aj
As a right KeywordIndex? *grin* :P
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   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] Does anyone care whether we deprecate ZClasses?

2005-04-04 Thread Andreas Jung

--On Montag, 4. April 2005 9:58 Uhr +0200 Yuri <[EMAIL PROTECTED]> wrote:
 Yes, but BEFORE do a tool to convert them in a python product or
archetype similar, a tool to change base classes, a tool to convert a
zclass based on catagaware to one based on catalogPATHaware, or merge the
two.
This would be up to the community :-)
-aj


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


Re: [Zope] Does anyone care whether we deprecate ZClasses?

2005-04-04 Thread Yuri
Yes, but BEFORE do a tool to convert them in a python product or 
archetype similar, a tool to change base classes, a tool to convert a 
zclass based on catagaware to one based on catalogPATHaware, or merge 
the two.

Or you just deprecate something that is used and don't deprecate some 
code that is obsolete by year ? :)
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   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: login page problem

2005-04-04 Thread prabuddha ray
Hi list,
never before i got such a holistic advice.
thanks so much Cliff.

About the 1st mail,

On Sat, 02 Apr 2005 17:03:56 +0100, Cliff Ford <[EMAIL PROTECTED]> wrote:
> Customisation of the login sequence is quite difficult for Newbies
> because there are lots of different ways to approach the problem - you
> have already tried some. I suspect that trying to match what was done in
> PHP may be part of your problem. It would be helpful to know if your
> lists of users are coming from one source, like a database table, or
> multiple sources, like multiple tables or different databases, and
> whether users are unique in each district

I dint want to built customized login page in 1st place. Actually this
is a Govt. stores management site used in my state only bulit all in
ASP. I 've to convert this into a Zope and Plone version.
So i wanted to get it converted with minimun changes.
But now as you say i think I should go the way Zope does it . only
that i'm finding it hard to customize it in Zope.

1> the district name and their users come from 2 seperate Mysql
tables. the users are unique in each district.

> From there you decide your
> zope folder structure. It could be like this:
>
> site_home
> |__acl_users
> |__district1
> |__district2
>
> or like this:
>
> site_home
> |__district1
> ||__acl_users
> |__district2
> ||__acl_users
>
> In the second case you would not have to worry about asking the user for
> the district name. In the first case you would get a district name or a
> user defined role for that district from a supplementary data source,
> like a database.

So i think 2nd structure is abetter fit.
Now the qusetion is how do build this district user folder structure
using the database?
Hope not manually, because there are 22 districts and about 15 users
in each of them pluys head quarters.

> A combination of exUserFolder and MySQL would do.

i don know about them, something like mysqluserfolder or
simpleuserfolder components ?

> You can get information on the logged in user (Username and Roles) from
> the User object, so you don't need to expicitly use sessions at this
> stage. You should certainly not store passwords - that would be a 
> serious breach of confidentiality.
> Maybe you should say what you do with the District parameter after the
> user has logged in.

I dont need the password but do need the username and district for
following pages to decide the access rights and the stores available
inthe districts , also for some report labels.

> Giving advice or examples on ZPT and Python for an
> approach that is probably wrong is just too time-consuming.
>
> Cliff

i dint get to know much about coding ZPT's and Script(Python) for them,
 from the ZPT refs and Zopebook. So wanted some simple working examples.

About 2nd mail,

On Sun, 03 Apr 2005 09:39:01 +0100, Cliff Ford <[EMAIL PROTECTED]> wrote:
> I have been trying to think of ways of providing specific pointers, So, 
> assuming you have a custom login page and a custom python script that 
> processes that page:
> 
> In the Python script you could set a cookie for the District:
> 
> context.REQUEST.RESPONSE.setCookie('District', district)
> 
> where district is the name of the District field in the form. The 
> District parameter is then always available to your page templates and 
> scripts in the REQUEST object.
> 
> At the end of your login script you would typically redirect to some 
> specific page like this:
> 
> return context.REQUEST.RESPONSE.redirect('aURL')
> 
> in exUserFolder you don't have to do anything else - the login works by 
> magic, which is very confusing.


Are these above said things not possible in exUserFolder. how do i
customize it for my problem?

> 
> Now for the problems:
> 
> If the login is wrong the system will call /standard_error_message, so 
> you have to customise that to send the user back to the login form with 
> a Login failed message.
> 
> If the user bookmarks a protected page and tries to jump to it without 
> being logged in, the system will call the login sequence starting in 
> acl_users, so you have to customise that to call your own login page.
> 
> After the user has logged in, whenever you need to get the Username you 
> would typically use a python script like this:
> 
> from AccessControl import getSecurityManager
> return getSecurityManager().getUser().getUserName()
> 
> HTH
> 
> Cliff

So this is what can be done if I use exUserFolder ?
Hope a reply soon.
-- 
Share the vision of difference with ME
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )