Re: [Zope] Hiding a Zope object from URL accesses

2001-01-24 Thread Ivan Cornell

Dimitris Andrakakis wrote:

 Gerald Gutierrez wrote:
  If I have a Z SQL method set up as /query on my Zope site, how is it
  possible for me to disallow direct accesses to it via a URL (like
  http://localhost/query) ? If I cannot, then what is the convention people
  use to store objects which are not supposed to be visible directly?

 I think its as simple as revoking the access rights for anonymous (or other)
 users. I.e. it's not invisible, but rather not allowed (pardon my english).

This should work, but you will also need to assign proxy roles ['higher' than
anonymous] to any of the methods that call your /query method otherwise they
will also be refused access!

Ivan


___
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] Getting an object from it's id

2001-01-23 Thread Ivan Cornell

Geoff Armstrong wrote:

 What I'm trying to do here is avoid using dtml-in, since in order for it to
 put the object in the namespace it has to iterate over all of them (there
 could be any number).

 All I have at the beginning is the name of the object in the REQUEST part of
 the namespace as picked up from a form. My method is the action to that
 form.

 In DTML there doesn't seem to be a way of saying, "I have this string with
 the name of an object, now fetch me the object."


Hi Geoff,

Try using _.getitem(), as in:
dtml-let myObject="_.getitem(myId)"
... dtml-call myObject.foo ...
/dtml-let
or probably:
dtml-let myObject="_.getitem(REQUEST['myId'])"

If you aren't sure of the existance of the object, wrap the above in:
dtml-if "_.hasattr(this(), REQUEST['myId'])"
/dtml-if

Ivan


___
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] reindex when a zclass is edited

2001-01-10 Thread Ivan Cornell

Tim Hicks wrote:

  I can't for the
 life of me figure out or find anywhere that can tell me how to make the
 instance get reindexed when it is edited.  I'm assuming that it is similar
 to the process for reindexing when the properties are changed, but I'm just
 not sure of the details. If it's not too much trouble, could someone give me
 detailed instructions (or a link) on how to do this. I'd really appreciate
 it.


In your method which is called by your edit form, insert a dtml-call
"this().reindex_object()" after updating the properties.

Eg, in my manage_edit method I have

dtml-call "propertysheets.Base.manage_editProperties(REQUEST)"
dtml-call "propertysheets.Facility.manage_editProperties(REQUEST)"
dtml-call "this().reindex_object()"

Regards, Ivan



___
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] can't change zclass meta type

2000-12-30 Thread Ivan Cornell

Dieter Maurer wrote:

 Geoffrey L. Wright writes:
  
   I can't seem to completely change a zclass meta type.  When I make a
   change on the "basic" tab of the zclass, my change seems to take, and
   the new meta type is displayed in the form.
  
   But when I try to add an instance of this metatype, I still see the
   old meta type name in the dropdown.  When I try to reference objects
   by metatype in my code, the new name does work, so it appears that the
   new metatype is ... mostly ... applied.
  
   Is this a bug?  Or is the some other location where I also need to
   change this info?

You must also change the factory, specifically the 'add list name'. See my
previous message:
http://zope.nipltd.com/public/lists/zope-archive.nsf/47ba74c812dbc5dd8025687f0024bb5f/6163e128ae1c60db802569b400388292?OpenDocument



Ivan


___
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] PopyDA and DBMS Transactions

2000-12-18 Thread Ivan Cornell

Paolo Quaglia wrote:

 I have two DTML Documents:

 first DTML: now called D1
 dtml-var header
 ...1st sql statement: select * from customers where name='white'

As I understand it, to exclusively lock a table in postgresql, use SELECT
 FOR UPDATE, eg:

...1st sql statement: select * from customers where name='white' for update of
customers

Regards,
Ivan


___
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] multiple selects are not allowed

2000-12-15 Thread Ivan Cornell


 Diny, why do you need to execute multiple selects in one SQL-Method?
 
 Belief me, you don't want to know ;)

 I'm building a database application for the drugstore department.
 Veterinarians can find medicines by searching on animal, ingredients,
 diseases etc. When they've found one medicine all the detailed information
 about this particular medicine is being displayed. At this point i thought
 i could use the multiple selects.
 The medicine has a 1 to many relationship with animals, ingredients,
 diseases etc. all stored in different tables. When i use one single select
 statement with several where conditions, and one relationship isn't filled,
 the query returns nothing at all.

 Maybe there is another way of doing it?
 
 I'll split up one complex ZSQL method into several simple methods.


Without seeing your queries, I would say use sql's UNION command, eg,

SELECT name FROM animals WHERE id =21 UNION SELECT name FROM diseases WHERE id
=21;

regards, Ivan


___
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] default values in forms

2000-12-13 Thread Ivan Cornell

Olaf Zanger wrote:

 hi there,

 i'd like to send default values for an data update with the link to the
 form

 like
 a href="adr_change_frm?f_id=dtml-var idf_name=dtml-var name"c/a

 unfortunately name may contain spaces.

 i found out that spaces may be replaced by "+" in the link,
 but how do i get the "+" into the dtml-var ... statement?


Try
a href="adr_change_frm?f_id=dtml-var idf_name=dtml-var name
fmt=url_quote"c/a

Ivan


___
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] namespace-problem

2000-12-12 Thread Ivan Cornell

One (ugly!) way of doing it:

dtml-with "manage_addFolder ('Test1')"
  dtml-let test1Object="_.getitem(Test1')"
dtml-with "test1Object.manage_addFolder ('Test2')"
/dtml-with
  /dtml-let
/dtml-with

This creates Test2 in Test1.

Ivan



 Here some experiments (don't look at the syntax):

 dtml- call "manage_addFolder (NewFolderName)"

 dtml-with "_.getitem(NewFolderName)"
dtml- call "manage_addProperty (ID,...)"
dtml- call "manage_addDocument (ID,...)"
 /dtml-with

 This looks fine to me, but ZOPE insists on creating the new document in
/OldFolder
 instead of
/OldFolder/NewFolder



___
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] Why I Love Zope

2000-12-08 Thread Ivan Cornell


 If anyone else has similar stories it would be nice to hear them.


Well, I've only been using Zope for 6 weeks now,  I've already launched
one site based totally on it in my spare time: http://www.noonsite.com ,
a site for cruising sailors.
Early days for it, but I've already got my father  sister inputting all
the information via the web in different countries, using versions not
to break the live site, etc.

I've forgotten how many times zope's blown me away, having spent my
first week fighting acquisition  the usual newbie things, I now find I
can answer about 50% of questions on this list - a very steep learning
curve (ie going from zero to zen quickly!).

Now I've just got to get to grips with it at work - I'm currently
working on converting a 500,000 row postgresql/php media database over
using ZPatterns...

Regards,

Ivan


___
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] DTML-LET problems

2000-12-08 Thread Ivan Cornell

Mohan Baro wrote:

 Why doesn't the following code work?
 How do I achieve the desired functionality?

 dtml-let the_current_user="dtml-var "AUTHENTICATED_USER.getUserName()""
 dtml-var the_current_user
 /dtml-let

 Mohan.

You can't embed dtml within dtml. Try:
dtml-let the_current_user="AUTHENTICATED_USER.getUserName()"
dtml-var the_current_user
/dtml-let

Ivan

PS, I would have replied to your previous post if it hadn't been in HTML!


___
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] Cut/copy/paste problems

2000-12-07 Thread Ivan Cornell

Dieter Maurer wrote:

 Oleg Broytmann writes:
    Cut/copy/paste problems in Zope behind Apache 
  
  To help me to resolve the problem I want to ask the helpful community
   provide me some information. Of those who run Zope behind Apache please
   tell me:
  
   1) which way do you connect? (mod_proxy, Zope.cgi, mod_pcgi2, mod_fcgi)
   2) any problem?
 We run Zope behind Apache using "ProxyPass".
 We have no problems.

I've been having problems with copy/paste/rename with my site, which is apache
proxypassing (mod_rewrite [p] actually) onto a siterooted subdir of zserver. I
haven't had time to set up a clean environment to evaluate exactly what goes
on when it fails but intend to over the next fortnight. I appear to have 2
separate issues:

1 Trying to copy objects from outside the siteroot'd hierarchy into it. The
object will appear in the wrong place [folder above]  zope will deny it
exists if I try to access it until I restart zope. Temporary solution is to
restart zope with  SUPPRESS_SITEROOT  make the changes. This breaks my
production site and so isn't ideal. My long term hack will probably to
maintain a mirrored readonly site which I switch to whilst I update the main
site so access isn't disrupted. There's so much path jiggerypokery going on
with SiteAccess/SiteRoot I don't expect a clean solution!

2. Can't do anything with my ZClasses. I've tried applying the reindex patch I
found somewhere. I think my problems might be to do with the fact that I have
catalogaware zclasses that inherit from catalogaware base classes and
something isn't quite working there.

All my problems are consistent (always happen!)  I'm running latest of
everything: Zope 2.2.4  apache 1.3.14,

Regards,

Ivan



___
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] duplicate column name

2000-12-07 Thread Ivan Cornell

Olaf Zanger wrote:

 i work with postgreSQL 7.0.2, ZPyGreSQLDA-0-0-3 and zope 2.2.2 on suse
 7.0 linux

 when i try the line

 - select adr.id,fac.id from fac, adr


You probably need to alias the columns:
select adr.id as adr_id, fac.id as fac_id from fac, adr
and then refer to adr_id  fac_id from zope.

[can't remember why, but think it is due to the way columns are addressed
in libpq]

Ivan


___
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] Disabling Services

2000-12-06 Thread Ivan Cornell

Chris Withers wrote:

 When Zope starts up, I see it starts the following:

 ZServer Medusa (V1.16.4.3)
 ZServer FTP server
 ZServer PCGI Server
 ZServer Monitor Server (V1.8.4.1)

 Which of those handles WebDAV requests?
 How do I turn any of the above 'off' permentantly, without hacking z2.py
 or anything similar (which is nasty ;-)


Not sure about WebDAV (I guess try the following  see!), but in my startup
script I have:
exec /usr/local/Zope-2.2.4-linux2-x86/bin/python \
 $PYTHONHOME/z2.py \
 -X -w 8000 "$@"

-X : turn off all servers
-w : explicitly turn on http server on port 8000
I took out -D as it is a production server  after reading the last few
digests I'm going to add -Z, though Zope hasn't crashed once on me yet!

HTH

Ivan


___
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] Checking for ID's before creating ZClass

2000-11-07 Thread Ivan Cornell

Hello from rainy England,

In my constructor for a ZClass I want to auto generate an ID consisting
of a name followed by a incrementing sequence (port0, port1, port2...).
How do I check for all existing id's in a folder? I tried doing it in a
PythonMethod (or whatever they are called now!), calling hasattr() but
failed. Another possibilty would be to loop on a
try..createInObject..raise until successful, but that doesn't seem
very zopish. In the source code for createInObjectManager I can see it
getting the folder, but can't figure how to acheive that directly,

Ivan


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