[Zope] Reading ZClass properties from outside the ZClass

2001-01-19 Thread Phill Hugo

I have a ZClass, "MyZClass" which contains 2 propertysheets,
"PublicInfo" and "PrivateInfo".

PublicInfo contains Selections produced from Lists in PrivateInfo. Works
wonderfully, however in the site I wish to get at the PrivateInfo items
without touching an Instance of MyZClass (Its easy that way but I cannot
be sure that instance will always be there).

Basically I need to do something like...



This works when logged in as an Administrator as the Control_Panel is
visible then, however for normal users it fails.

Is there a way to get at these details without asking an instance? I'm
assuming that the answer is no due to the security aspect but it would
be preferable in this case to have the List in the ZClass rather than in
the site content (perhaps in the root folder properties).

I've suppose I could use a Proxy role but I wonder if there is something
as simple as..

 without doing 

Phill

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




[Zope] On DTML and Python Script

2000-12-05 Thread Phill Hugo

Jason Leach pointed out that Document Template could include ASP/PHP
style Python escapes to embed code. This may seem a good idea at first
but part of the really nice thing about Zope is that it goes a fair way
to ensure you organise your work cleanly and seperate logic from the
layout.

In PHP I always use FastTemplate which offers pretty much only what
 does (that doesn't include  or anything "clever"). The benefit of having no logic in
your HTML is huge when you have multiple people working on the project.
The "creep" of template systems to hold more and more logic such as
Loops, Conditions etc is forgivable as it allows basic programming to be
done by the HTML people but strictly it isn't necessary as long a
variable insertion / tag replacement is possible.

If you are "having to [use] all those dtml tags" then you're probably at
the point where replacing that big chunk with 
is in order. This could be anything you want (Python method, External
Method, DTML method etc) which does the real logic and conditionally
returns its output to the master template (that content possibly from
another smaller, reused DTML method - it amazing how many sites use the
same text all over it (like Next 10, Prev 10 for example!).

At that point you've removed any fear of the HTML people walking over
your code with a bulldozer and it means they can update things while you
do.

What I'm suggesting is that <%, ,  and  tags could be argued to be
Bad Things but they are convenient in some cases (they are easy for HTML
writers to understand and can be used for simple things by them).

I don't really see the "convenience" of a Python code escape as its just
as easy to make a Python Method and pop  in its
place keeping things neat.

Still, I suppose it'd hardly matter if it was available, those who agree
with the above would probably ignore it, much as I ignore it in PHP and
use FastTemplate instead.

Phill

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




[Zope] HTML Widgets, In-place editing in Zope

2000-09-22 Thread Phill Hugo

Hi All,

We've been working on this for a few days now and I think its about time
it was uncovered.

If you try these two URLs in Mozilla or IE, you'll see what it does.

It works in Netscape 4 but doesn't do the stylesheet magic to the form
which looks less impressive.

www.opencookie.org/widgets/index_html

www.opencookie.org/widgets/index_html?editmode=1

widgets is an external method which will be on Zope.org next week if all
goes well.

Have fun.

Phill Hugo

Fortune Cookie (UK) Ltd.
Its nice in here

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




[Zope] GPL stuff (OT)

2000-09-13 Thread Phill Hugo

Zopistas, 

I've heard a lot of GPL issued raised recently and I want to say a
couple of things to hopefully end the subject. I don't mind you pointing
replies to me if they aren't of general interest [hint ;)]

Firstly, read the GPL. It sounds like some of you talking about it
haven't (or have forgotten its contents). That'll clear most things up.
Its ambiguousity is limited to very technical cases such as dynamic
linking etc. Even in that case, the use of the GPL'd C Header files at
compile time can be taken to be indication of agreement to the GPL (even
the use of header files produces a legally defined "derivative work" -
one look at the sql.h files MS distibute to make that clear.

The lack of court testing is irrelevent too, that hasn't happened
becuase no one has stood to gain from it - a good indication that they'd
lose. If any company found real legal fault with the GPL where they
could take code and not be force to comply, they would have done. The
legal issues surround very specfic cases, not the entire license. The
Objective C front end to GCC is there because NeXT backed down after
admitting a futile case.

The "its not been tested in court" argument applies for many many
licenses and EULAs but you can bet that the flip side is true also - the
reason its not got to court is becuase everyone seems to be agreeing to
it out of court - a precedent no court would ignore if it ever came to
it.

The compatibility issues of [MQZ]PL / GPL are generally cases where some
case is strongly demanded which the GPL strongly rejects. Things like
choice of law, the right to take patches for non Free use etc would
cause incompatibility due to the difference in the rights assigned to
the user under GPL and those not allowed under the other. This DOESN'T
stop you using the GPL in Zope though if you specifically allow it on
your side and the creators also do. As far as I know, DC hasn't forbade
modules under GPL to be used, or rather they have made the Product
interface "open" enough to allow even proprietry Products to be written
and used.

Of course, this is module authoring (even Linux kernel modules need not
be under GPL). In the case of taking ObjectManager.py and adding things
to it, that stays under ZPL like it or not (even your changes). That is
where the two are incompatible. You can take embed GPL code in BSD code
- that's why they are "compatible". To call that "pilfering" but not
mention companies who take BSD code and don't even share their
extenstions is a little harsh I think (the windows FTP command comes to
mind).

I don't think that using a GPLd product in Zope (via the Product
interface) would mean you have to give source away for _your_ Products
and site code which uses them. They are distinct and bound only by the
open interface Zope provides. If, however, you change the GPL'd Product,
then you will have to stick with the GPL. Either that or re-implement.
And yes, you will have to offer the GPL'd parts under the GPL terms if
you distribute the whole.

A real world case of this? There are many commercial products that
include GPL code. I've seen it used in firewalls and printers and in all
cases the GPL parts where distibuted under GPL of course. The distinct
parts (non linked, seperated by "open interface" - be that as seperate
processes, kernel modules etc) are not always available under GPL.
Philips' Tivo site has their changes to Linux under GPL available. You
won't find their MPEG suite though - shame ;)

The GPL has no direct stance on making money or otherwise. You can sell
GPL'd code for all you like, changes or none. It only governs the rights
assigned to those YOU distribute it to (not the world). However, that
one customer then has the right to distribute to the world. Unless you
are bloody good with your support and documentation, they won't need
you. If you are good that's a different matter.

The choice of license on an open project isn't, from the real world, an
indication of how well it'll do commercially either. Yes, apache,
XFree86, Perl, Python etc etc all use non GPL licenses and that's good
for them in some cases - their aims are DIFFERENT to FSF/GNUs. Besides,
Linux, GNOME and the GNU compiler tools get just the same amount of
commercial recognition (Mozilla is now also under GPL), if not more and
from just the same people.

That's about it. The only really clarifcation needed to clear this all
up is...

1) DC to say Products do not have to be under ZPL and to deem their
Product API an open interface akin to Linus' statement on the Linux
kernel module interface or RMS's on calling GPL'd apps through the
System() call.

2) Any GPL code that effects Zope's core will have to be deemed under
ZPL while running with Zope. I'm not sure any Products do this but in
the case of any, this would sort it out. Yes, its really just a dual
licensing scheme but many do that - Mozilla, Perl and Qt amongst them
(and all with the GPL alongside their other license).

In the case of the first b

[Zope] ODBC Bridge / SQL Server stuff

2000-08-25 Thread Phill Hugo

Hello,

Easysoft (www.easysoft.com) supply a simple, efficient SQL bridge which
works well with unixODBC (.org) and iodbc (.org) driver managers. We use
it on one of our PHP sites to link to an SQL Server db from Linux. It
works fine but its a close product.

So given the easy of use of XML-RPC or SOAP from Python, it may be
sufficient to create your own bridge which calls a remote DB connection
made with ASP or Zope on NT. I've set this up with a Python method
calling a remote DB connection in PHP using XML-RPC (just pass the query
over and get the records back) and it works perfectly.

Hope this helps.

Phill

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




Re: [Zope] ColdFusion->Zope converter

2000-07-17 Thread Phill Hugo

John Leach wrote:
> 
> Anyone have one of these ?
> (or tips on writing such a thing?)
> John Leach
> http://www.bosware.com.au

Ouch. As far as I know CF has a few hundred tags available. Zope/DTML
offers only about 10-20 but provides the same underlying features in
Python via the expr="" attribute. You'd really be looking to transfer CF
to python. This would probably produce code that sucked under Zope as CF
doesn't offer as many core platform features like ZClasses, Aquisition
etc.

I'd say the best conversion tool is simply someone who knows a bit of
both (or a bit of CF and a sizable chunk of Zope).

I can only imagine CF->Zope convertors which would leave you wanting to
rewrite the resultant code anyway. That said, it could at least offer a
neater way to import your CF files into Zope but import and FTP already
offer that.

Phill

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




Re: [Zope] MySQL LIKE operator

2000-07-13 Thread Phill Hugo

> > -Original Message-
> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, July 12, 2000 11:03 AM
> > To: [EMAIL PROTECTED]
> > Subject: [Zope] MySQL LIKE operator
> >
> >
> > Hello,
> >
> > I'm writing a search query to a MySQL database.  I want to keep
> > people from screwing around with my database by running searches like ";
> > delete from ... yada yada.  So I should use , right?  But
> > what if I want to use LIKE?
> >   If I say:  WHERE goo LIKE "%%"  then
> > effectively I am saying: WHERE goo LIKE "%'somestring'%".  In other
> > words, it will match only the string with the single quotes.  I hope
> > this makes sense.  Has anyone faced a similar problem?
> >   Thanks for any help
> >
> > --Aaron

Here's a sample of some larger scale SQL with just the thing your
looking for in it.

SELECT *
FROM users

 
 
 
 user_name LIKE 
 

 
 user_firstname LIKE 
 

 
 user_lastname LIKE 
 

 
 user_age LIKE 
 

 
 user_town LIKE 
 

 
 user_email LIKE 
 

ORDER BY
user_name

Hope this helps

Phill

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




Re: [Zope] Is Zope slow?

2000-07-06 Thread Phill Hugo

Firestar wrote:

> I have been programming with PHP and PERL, and they are quite fast, even when 
>serving dynamic pages. Of course, they do not provide all the features of Zope, but 
>they are able to handle things like sessions, authentication, database API...which is 
>quite adequate for most small-to-medium websites. (although sometimes it's quite 
>frustrating putting the modules together:)

Yes, Zope is slower than Apache but so is a bus compared to a porsche.
However, you can do things with buses that would take forever with a
sports car, and some that are impossible (moving furniture ;)

If you want the best of both worlds, map out the images and large static
files from apache's config to go to itself and forward the rest over
PCGI to Zope (read up on mod_rewrite). This way, the dynamic stuff is
served by zope and the static stuff is handled by apache, both doing
what they are good at. You can add LocalFS to Zope to allow
administration of the static files too. This is what PHP does, that is
just a module which handles php files, everything else is handled by
Apache. PHP itself isn't that fast (it doesn't even cache compiled
code).

A decent 500Mhz PIII will knock out about 80 pages per second under Zope
(~40 for complex things) but given that many sites where speed is
important are very graphical, the ratio of a zope hit to an apache one
is reasonable  - on the site I'm working on this is about 1:10 and
current traffic (not yet under Zope) is 18Million hits per month. 

If ever you run out of power (or reach the halfway point) you can start
thinking of adding some caching or migrate to ZEO. In fact, if that
happens, you'd be stupid not to have some sort of cluster - you'd have a
very busy site!

Phill

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




Re: [Zope] FOR loops?

2000-06-30 Thread Phill Hugo

Andy Gates wrote:
>
> 
> 
>   
> 
>    
> 
> 
>   
> 
> 
> So where does Zope hide its FOR loop?  Can't find the bugger anywhere!

You already did.  is FOR. As in Python's "for v in list". Use
 

Phill

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




[Zope] Post method redirection / Core changes

2000-06-14 Thread Phill Hugo

Hello all,

We recently had a "sales engineer" from Allaire come and talk to us
about Spectra and were quite surprised at how similar it is to Zope. To
be honest the only thing I left with any "ooh, thats neat" feeling about
was their general style of building objects with the admin view
optionally identical to the user view but with icons inserted below
images, content etc to allow immediate altering of the content.

The same stuff is simple to acheive in Zope, almost. Make a ZClass, add
index_html which adds a header, footer and puts render_html in the
middle. Then use render_html to embed it in other docs and index_html to
view it standalone. Add a check to see if the user is logged in and has
View management screens rights, if so give them little icons "in place"
to edit the content and images.

This works fine..


 
 


Now, this part is simple enough but it leads to a problem. The default
methods for updating ZClass properties and images all redirect back to
manage_main by the look of things.

I propose that two things be added to this to allow simple management of
redirection from the update/edit/change methods.

1) All instances of manage_main be changed to manage_workspace so the
default view if given rather then contents_html.

2) That an optional redirect url can be supplied to everywhere this
happens to override the redirect.

Then once a user logs into the site, leaves the admin view after perhaps
joining a version and travels through the site, it has extra icons
immediately allowing them to edit the contents of certain things. The
redirection would take them back to the extended user side view after
pressing submit.

I've looked at Image.py in OFS and this is fairly simple but I thought
I'd suggest it so we could perhaps form some standard on the redirect
url variable that would be passed about.

Any thoughts?

Phill

ps. I've not looked at the DestinationURL stuff properly to see if it
does anything like I'm asking.

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




Re: [Zope] ZSQL method broken on 2.1.6

2000-06-09 Thread Phill Hugo

Umesh Soni wrote:
> 
> (using zope 2.1.6 with ZMySQLDA-2.0.0a1 and MySQLdb-0.2.1)
> 
> Hi there,
> 
> I had this ZSQL method (simplified for clarity) working on 2.1.4
> 
> select id, nickname  from bboard
> where id<=50
> order by id desc
> limit 30

Remove either the limit 30 or the LIMIT 1000 Advanced property of the
ZSQL method (advanced tab). To speed things up, the limit 1000 appended
to the query to stop MySQL giving Zope lots of lines when it only wants
1000 anyway. Its not too clever though. There should maybe be a check to
see if "limit x" exists in the query.

Phill

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