[Zope] SELECT ... AS ... statement in ZSQL

2001-01-07 Thread Bowyer, Alex

A simple question, but I can't seem to find a simple answer in any of the
documentation...

How do you do a SELECT AS statement in a ZSQL method?

For example
SELECT FirstName + " " + LastName AS FullName

Whenever I use AS, I end up getting the SQL error "Two few parameters: x
expected" where is the number of AS expressions in my query.

I have tried the same query in Access on the same database and it works
fine.
I even tried to leave Access to do the query and then just let Zope treat
the query as a table.
SELECT * FROM MyQueryInAccessWhichUsesAsStatements
but I get the same error.

Can anyone help?

Thanks

Alex

==
Alex Bowyer
IT Consultant, Logica Australasia
Tel: +61 2 9202 8130
Fax: +61 2 9922 7466
E-mail : [EMAIL PROTECTED]
WWW: http://www.logica.com.au/
==

___
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] Advice on searching/indexing Word documents?

2001-01-02 Thread Bowyer, Alex

Our company has a repository of staff CVs (Resumes) as Word Documents and I
am about to embark on creating a new feature for our Zope Intranet to allow
project managers to search those documents for keywords such as particular
skills or projects.

I am thinking about several possibilities such as a skills/CVs database
linked in via ODBC, or some task that converts the Word documents to text
files which can then be searched by Zope (I think Zope can do this, and I
assume it can't search Word format directly?).

Has anyone ever approached a similar problem, does anyone have any tips on
how to index/search a load of documents in Zope?

Any tips/suggestions/comments would be most welcome.

Thanks,

Alex

==
Alex Bowyer
IT Consultant, Logica Australasia
Tel: +61 2 9202 8130
Fax: +61 2 9922 7466
E-mail : [EMAIL PROTECTED]
WWW: http://www.logica.com.au/
==

___
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] security

2000-11-26 Thread Bowyer, Alex

Can some one explain how the Define Permissions screen works. I really don't
understand the concept behind it, what does it mean for a permission setting
to own a permission?

All I need to do is to make certain ZClass methods have a certain level of
security and the other methods of the class have no security.

Any tips, advice or best of all EXAMPLES most appreciated!

Thanks

Alex

==
Alex Bowyer
IT Contractor, Logica Australasia
Tel: +61 2 9202 8130
Fax: +61 2 9922 7466
E-mail : [EMAIL PROTECTED]
WWW: http://www.logica.com.au/
==

___
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] security problems .. should be fairly easy...

2000-11-20 Thread Bowyer, Alex

I know I am posting quite a lot of questions to the list lately, sorry about
that, it's just that I can save myself hours of trial-and-error coding when
I get quick answers from list, so I hope you don't mind. It seems to be the
fastest way to learn.

I have a news page ZClass and a news article ZClass, both of which have
several DTML methods. All methods apart from index_html should require a
particular user role, "UAAdmin", to be held by the current user (thee
mathods are all for editing anf manging the news page and articles). The
index_html methods (which display the news article) should be available for
anonymous access.

I have been stuck with this for over a week now, I have tried all sort of
combinations of permissions, defined permissions and user roles, but I can't
figure it out and I can't find any examples in any of the Zope documentation
about how to manage permissions for class methods. Does anyone know where I
could find such documentation or examples if there are any?

The whole thing's very confusing, but here's what I've worked out so far.
Maybe someone could put me right and/or fill in the gaps?
I think what I need to do is got the Define Permissions tab for each method,
and for the View permission dropdown I should select View for the index_html
method, and some other permission X for every other method. This other
permission X should only be granted to the UAAdmin role. The question is,
what is X to put in the dropdown, and how to assign it to UAAdmin. How would
I go about creating a new permission, perhaps "Manage news pages", and how
could I then assign that to UAAdmin? Would it then appear in the drop-down?
Is this the right approach? How would I finish this off? Am I barking up the
wrong tree? 

Any suggestions or advice would be most welcome.

Thanks for your patience with newbies like me!!

Alex

==
Alex Bowyer
IT Contractor, Logica Australasia
Tel: +61 2 9202 8130
Fax: +61 2 9922 7466
E-mail : [EMAIL PROTECTED]
WWW: http://www.logica.com.au/
==

___
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] security problems

2000-11-16 Thread Bowyer, Alex

I am having some problems with getting the right security settings for my
ZClass.
I have one method index_html which should be viewable by anonymous.
All other methods should only be viewable when a username/password is
entered for someone with the role I have called UAAdmin
One thing that is causing complications is that the index_html makes use of
a few dtml-vars, an external Python method, and one view method also called
index_html from another class. It may be I need to change these items'
permissions as well.

I can only seem to get full access to all pages (if I grant a proxy on
index_html) or password access required on all items (by specifying
permissions for the class instance) neither of which are the correct
solution.

Could someone tell me the right combination of permissions, define
permissions and roles I need to get this working.. it's all getting a bit
confusing.

Thanks

Alex

==
Alex Bowyer
IT Contractor, Logica Australasia
Tel: +61 2 9202 8130
Fax: +61 2 9922 7466
E-mail : [EMAIL PROTECTED]
WWW: http://www.logica.com.au/
==

___
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] modifying objectValues from an external method?

2000-11-15 Thread Bowyer, Alex

You may remember I have posted a couple of times about problems I have had
with manage_delObjects to delete a news article object from a news page
which contains several child news article objects.

I thought I would try and avoid the problem and make a Python method to
remove the item. This method takes the list of articles (i.e. objectValues)
and does the deletion on the parameter passed in.

The problem I have is, objectValues doesn't seem to exist at Python level,
only at DTML level. So instead of:

dtml-call "my_delete_function(objectValues)"

which is not valid, I have to use:

dtml-let my_list=objectValues
  dtml-call "my_delete_function(my_list)"
/dtml-let

The problem with this is that even though the parameter is passed by
reference, the changes are only being done to my_list and not passed back to
objectValues. So I lose them once my_list is out of scope.

Can anyone suggest an alternative or a workaround? I thought about returning
the modified list from the function, but DTML provides no functionality to
set objectValues equal to this result.

Any help would be appreciated!

Thanks

Alex

==
Alex Bowyer
IT Contractor, Logica Australasia
Tel: +61 2 9202 8130
Fax: +61 2 9922 7466
E-mail : [EMAIL PROTECTED]
WWW: http://www.logica.com.au/
==

___
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] How to maintain an up-to-date mirror site in Zope? (not-so-newbiequestion!) question!)

2000-11-13 Thread Bowyer, Alex

Here is the situation, can you offer advice?

Machine A is running a Zope server for a wide-area network in Company A.
This is an Intranet site which changes regularly. 
Machine B serves a separate wide-area network in Company B, and Company B
employees need access to Company A's intranet.
The link between Machine A and Machine B is too slow/low-bandwidth for all
of company B's employees to access A's intranet directly.
Therefore we want to have a Zope server on Machine B with a mirror copy of
the Company A intranet.
The problem is, how can we keep this mirror copy updated on a daily basis?

Ideally we need an automatic process to run each night and update the mirror
on B.

The ideas I had were :

1) stop B's Zope server, copy across data.fs and restart B. But can this be
done automatically?

2) somehow keep a log of changes made in A, and at the end of day, export
the changed files, import them on B, overwriting the originals. Can this be
done in Zope code? Can this be automated?

Does anyone have any thoughts/opinions on these ideas? Or does anyone know
of a better way, perhaps an existing Zope package or solution?

Thanks again,

Alex

==
Alex Bowyer
IT Contractor, Logica Australasia
Tel: +61 2 9202 8130
Fax: +61 2 9922 7466
E-mail : [EMAIL PROTECTED]
WWW: http://www.logica.com.au/
==

___
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] Newbie question(s)

2000-11-12 Thread Bowyer, Alex

Hi,

I have what I'm sure is a very simple question about Zope programming style:
I want to count how many objects are contained in the current container
object and then do something with that value, but I can't do the bit I need
to do at the point of reading the count variable because I am in the wrong
namespace.
I can't begin a dtml-let because I would need to close dtml-if before
dtml-let, which is not allowed.

dtml-in objectValues
dtml-if sequence-end
dtml-var count-id  !-- this is the value I want to use --
/dtml-if
/dtml-in
!-- this is the scope in which I want to do something with the value. --

What is the "accepted" way of passing a value into a different scope? Do I
have do a REQUEST.set or is there a tidier way?
Also I think I read somewhere that you can use the object.subobject or
object.property syntax but I never got that to work, what's the catch?

One last thing, I sent a couple of mails to the list about problems I had
with manage_delObjects. I still haven't got it to work. Since the best way
to learn Zope is by example, I wonder if anyone could direct me to a sample
piece of code where a container of some sort deletes one of its children
subobjects?

Thanks very much for your help,

Alex

==
Alex Bowyer
IT Contractor, Logica Australasia
Tel: +61 2 9202 8130
Fax: +61 2 9922 7466
E-mail : [EMAIL PROTECTED]
WWW: http://www.logica.com.au/
==

___
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] Newbie question(s)

2000-11-12 Thread Bowyer, Alex

 I want to count how many objects are contained in the 
 current container
 object and then do something with that value, but I can't do 
 the bit I 
 need to do at the point of reading the count variable 
 because I am in 
 the wrong namespace.
 
 I would try and do it like this (untested):
 
 dtml-call "REQUEST.set('itemCount', len(objectIds()))"
 
 Regards
 
 Max M

Thanks Max, that is certainly useful in this case.

My query is really more general though, that was just an example, I need to
know what the generally accepted method is for transferring values through
the code (i.e between namespaces)

IMHO as far as Zope documentation goes, the thing that is really lacking is
a document introducing people to how to program in Zope, explaining the
overlaps between Python and Zope/DTML and explaining the different syntaxes
for calling variables, methods etc? There are a lot of references on
specific functions, methods etc but no general overview. Maybe the
forthcoming Zope book will address this better.

I am also still looking for example code using manage_delObjects.

Thanks,

Alex

==
Alex Bowyer
IT Contractor, Logica Australasia
Tel: +61 2 9202 8130
Fax: +61 2 9922 7466
E-mail : [EMAIL PROTECTED]
WWW: http://www.logica.com.au/
==

___
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] Help wanted on Zope ZClasses/DTML please.

2000-11-06 Thread Bowyer, Alex

Thanks for the e-mail Seb. I am afraid I am still having problems here, so I
will show my code again, and hopefully you or someone else will be able to
help.

To recap : I am creating a news page and an interface to edit it using two
custom ZClasses, Article and Page. A Page object contains several Articles.
The following code is from a script that allows the user to delete an
Article from the Page. This method belongs to the Page class, so we are
currently in the scope of the Page. This script is supplied with the title
of a news article to be deleted, it should then delete the Article from the
Page and report back.

dtml-var standard_header
!-- set this flag to null so I can tell if/when matching article found --
dtml-call "REQUEST.set('id_to_delete','NULL')"
!-- retrieve the title of the article to delete --
dtml-let the_match="REQUEST['article_to_delete']"
!-- start cycling through Articles looking for a match --
dtml-in objectValues
  dtml-with sequence-item
  dtml-with propertysheets
  dtml-with UAArticleClassPropertySheet
  !-- now we are looking at the properties of one of the Articles --
  dtml-if expr="article_title==the_match"
dtml-call "REQUEST.set('id_to_delete',title_or_id)"
!-- this is the point where we have located the article to delete.
Ideally we should delete it now, 
 but we are still in the scope of the property sheet --
  /dtml-if
  /dtml-with/dtml-with
  !-- now if we have found a match, we are back in the scope of the
objectValues of the Page, 
   so we want to do the deletion. --
  dtml-unless expr="REQUEST['id_to_delete']=='NULL'"
dtml-let the_id="REQUEST['id_to_delete']"
  !-- this is the problem line --
  dtml-call "manage_delObjects(the_id)"
/dtml-let
  /dtml-unless
/dtml-in
!-- this last bit just generates HTML to say if deletion done or article
not found --
dtml-if expr="REQUEST['id_to_delete']=='NULL'"
  h2Article not found/h2
  PCould not find the article to delete./PPA HREF=editReturn to
maintenance page/A/P
dtml-else
  h2Article not deleted/h2
  PDeleted article 'dtml-the_match;' (id='dtml-the_id;')./PPA
HREF=editReturn to maintenance page/A/P
/dtml-if
/dtml-let
dtml-var standard_footer
!-- end of code --

Basically I think I am somehow passing the wrong parameters to
manage_delObjects

The line
  dtml-call "manage_delObjects(the_id)"
causes an error 'loop over non-sequence'

This made me think that the argument has to be a sequence so I tried
  dtml-call "manage_delObjects('the_id')"
but this fails because as you say it looks for an object called the_id and I
need to pass in the value of the_id not the name of it.

Ideally I want to say
dtml-call "manage_delObjects(REQUEST['id_to_delete'])"
but again this fails to find the object.

Any ideas?

Thanks for helping,

Alex

 -Original Message-
 From: Seb Bacon [mailto:[EMAIL PROTECTED]]
 Sent: Monday, November 06, 2000 8:50 PM
 To: Bowyer, Alex; [EMAIL PROTECTED]
 Subject: RE: [Zope] Help wanted on Zope ZClasses/DTML please.
 
 
 
  I have worked out thanks to Seb's comments that the problem I
  have with the
  use of manage_delObjects is (I think) that I am passing in 
 the title or id
  of the object to be deleted rather than the object itself.
 
 Not quite... manage_delObjects takes a string which is the id 
 of the object
 to be deleted.  Your example
 
 dtml-call "manage_delObjects('the_id')"
 
 was passing a string 'the_id' to the method.  I might have 
 interpreted what
 you were trying to do wrongly, but I believe you actually 
 wanted to pass the
 _value_ of the_id.
 
  I want to put the object into the REQUEST so I can still 
 access it from a
  different namespace - at the point I want to do the 
 deletion, my target
  object is out of scope.
 
 In fact you just have to put the correct string into the 
 REQUEST and then
 make sure you have the object you're trying to reference in 
 your current
 namespace, e.g. by using dtml-with foo_namespacedtml-var
 "manage_delObjects(the_id)"/dtml-with.  If you need more 
 help, post the
 snippet you're working on again.
 
 seb.
 

___
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] insert but updates don't work

2000-11-05 Thread Bowyer, Alex

 but get an authentication challenge that I can not pass.
 Is there something special about sql updates?

I haven't used SQL in Zope but I experienced the same thing, an
authentication request that cannot be satisfied even by the superuser
account. For me I found that it happened when I was in a particular
dtml-with block and I referred to the id property of the current object. I
changed my dtml-var id to dtml-var title_or_id and the problem went
away. 
I think there may be a bug in Zope regarding accessing the id properties of
certain objects.
I hope this is some use to you, it may be that you have a completely
different problem though.
I would be interested to hear the outcome once you get it working and work
out what the problem was.

Good luck

Alex

==
Alex Bowyer
IT Contractor, Logica Australasia
Tel: +61 2 9202 8130
Fax: +61 2 9922 7466
E-mail : [EMAIL PROTECTED]
WWW: http://www.logica.com.au/
==

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