[Zope] ZClass authorization problem (You are not authorized to access manage_changeProperties)

2000-08-07 Thread Gaspard, Bradley S

I have created a new ZClass which contains a dtml method that first clones
an object and then edits it's properties:





When I fill out the 'add' form and try to create a new instance I am
presented with the error message (as a user with
a manager role):

You are not authorized to access manage_changeProperties

I am able to successfully create an instance if I am the superuser.

How do I fix this??

Brad




___
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] Newbe external method question

2000-08-01 Thread Gaspard, Bradley S

I have what I fear is a very basic question ... 

I want to write an external method that first determines all of the objects
in a folder that posses a certain property.
I know how to find the object ids but once I do that how do I then determine
which contain the property I am searching for??

Thanks for any help.

Brad




___
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] Adding an XMLDocument instance Programmatically

2000-07-24 Thread Gaspard, Bradley S

I am trying to write a python method which will programmatically create an
instance of an (existing) XML document.  (I am using Zope2.1.6 and
XMLDocument 1.0a6)  I am able to add an XML document by selecting the
XMLDocument from the available objects ... so XMLDocument is installed
correctly.

Essentially I have taken the 'add' method of XMLDocument and tried to turn
it into an external method.  [I was able to successfully do this for the
Parrot product so hopfully I am on the right track]

I can' t seem to get beyond importing Document (cannot import name
Document).  Do I need to import other modules?  Is this the best/only way to
do this??  Appreciate any help.

from Products.XMLDocument import Document

def add(self, id, title='', file='', REQUEST=None, submit=None):
"""
Add a XML Document object with the contents of file.
"""
ob=Document()
ob.title=title
ob.id=id
if file: ob.parse(file)
id=self._setObject(id, ob)
if REQUEST is not None:
try: u=self.DestinationURL()
except: u=REQUEST['URL1']
if submit==" Add and Edit ": u="%s/%s" % (u,quote(id))
REQUEST.RESPONSE.redirect(u+'/manage_main')
return ''

I appologize in advance if I have missed something obvious.

Brad


___
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] Newbe question concerning using python classes and external methods

2000-07-06 Thread Gaspard, Bradley S

All,

I am a new Zope user and I guess I'm missing something fundemental that I
haven't been able to glean from the documentation and various "How-to's".
As a learning tool I am trying to implement one of Brian Lloyd's examples I
found on the Web implementing a GuestBook.  

I suspect what I don't understand is how to write the external method that
would make use of this class (The one I have been playing with follows the
class definitions).  Anyhow, I've created an an external method and call
(e.g. ) after which the guestBookForm is displayed.  After
filling out the form and submitting it Zope does not seem able to find the
signGuestBook method.  What am I doing wrong??

Other than mostly trivial examples, I haven't been able to find many
complete (working) examples of using external methods.

Thanks in advance for any help.


"""Module guestbook: a simple guestbook application"""

class GuestBook:
  """A guestbook object that provides both the forms
 and the handling of submitted form data."""

  def __init__(self, title, filename):
self.title=title
self.filename=filename

  def guestbookForm(self):
"""Return the guestbook from to the user"""
return """
  %s
  
  %s
  Please sign our guestbook!
  
  
  Name: 
  Email: 
  
  
  
  """ % (self.title, self.title)

  def successPage(self):
"""Return a page to thank the user on success"""
return """
  %s
  
  Thank You!
  Thank you for signing %s!
  
  """ % (self.title, self.title)

  def signGuestBook(self, name, email='not specified'):
"""Handle a submitted guestbook form"""

# Open a file to save the guestbook entry
try: 
  file=open(self.filename, 'a')
except IOError:
  file=open(self.filename, 'w')
entry='Guestbook entry: %s %s\n' % (name, email)
file.write(entry)
file.close()
return self.successPage()





External method

import sys
sys.path.append('/usr/local/src/Zope-2.1.6-linux2-x86/lib/python/Shard/jscap
e/winsat')

import guestbook

def AddGuest(self):
  myGuestBook=guestbook.GuestBook('My GuestBook', 'guestbookdata.txt')
  return myGuestBook.guestbookForm()




Brad


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