[Zope] DTML difficulties

2001-01-30 Thread Nolan Darilek

I'm working on my first zope product and, while everything has gone
relatively smoothly so far, I'm having some issues.

The product is a folderish object which contains 3 subfolders, each of
which contains a specific type of object. The structure looks
something like this:
work/: Main folder, UI, etc
   jobs/: List of all jobs
   projects/:
   taskforces/:

Each folder contains a job, project or taskforce object, as well as
the UI to manage them.

Projects and taskforces are simple objects with names, descriptions,
etc. Logic will be attached to these classes so that, when instances
are viewed, they will search for jobs which are assigned to them. Each
job can be assigned to multiple projects/taskforces.

Now, the difficulty. I'm working on the UI for the job add form, which
is in work/jobs. The form needs to iterate over the contents of
projects/ and taskforces/, and I can't figure out how. Here's what
I've tried:

tr
th align="LEFT" valign="TOP"Taskforces/th
td align="LEFT" valign="TOP"
select multiple name="taskforces:list"
dtml-in "PARENTS[1].taskforces"
option value="dtml-var id"dtml-var title_or_id/option
/dtml-in
/select
/td
/tr

tr
th align="LEFT" valign="TOP"Projects/th
td align="LEFT" valign="TOP"
select multiple name="projects:list"
dtml-in "PARENTS[1].projects"
option value="dtml-var id"dtml-var title_or_id/option
/dtml-in
/select
/td
/tr


And the error I get is:

||Error Type: TypeError  |
||Error Value: unsliceable object|

Traceback (innermost last):
  File /usr/lib/zope/lib/python/ZPublisher/Publish.py, line 222, in publish_module
  File /usr/lib/zope/lib/python/ZPublisher/Publish.py, line 187, in publish
  File /usr/lib/zope/lib/python/Zope/__init__.py, line 221, in 
zpublisher_exception_hook
  File /usr/lib/zope/lib/python/ZPublisher/Publish.py, line 171, in publish
  File /usr/lib/zope/lib/python/ZPublisher/mapply.py, line 160, in mapply
(Object: ESPWorkRequestAdd)
  File /usr/lib/zope/lib/python/ZPublisher/Publish.py, line 112, in call_object
(Object: ESPWorkRequestAdd)
  File /usr/lib/zope/lib/python/App/special_dtml.py, line 120, in __call__
(Object: ESPWorkRequestAdd)
  File /usr/lib/zope/lib/python/DocumentTemplate/DT_String.py, line 528, in __call__
(Object: ESPWorkRequestAdd)
  File /usr/lib/zope/lib/python/DocumentTemplate/DT_In.py, line 672, in renderwob
(Object: PARENTS[1].taskforces)
  File /usr/lib/zope/lib/python/OFS/ObjectManager.py, line 617, in __getitem__
(Object: RoleManager)
  File /usr/lib/zope/lib/python/OFS/ObjectManager.py, line 257, in _getOb
(Object: RoleManager)
TypeError: (see above)


Can anyone offer any advice? 

___
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] Limited folderish objects

2001-01-22 Thread Nolan Darilek

The Folder class offers quite a bit of the functionality which I need
for a current project. However, what I'm attempting to create isn't a
traditional folder for DTML objects, methods, etc. Instead, I'm
creating a folder which contains subfolders which are intended for
specific objects. The "available objects" list in the parent folder
should only allow the creation of a certain type of object.

So, how can I do this? I was told that I could modify the permissions
on the folder to prevent other objects from being added, and this
seems to be confirmed by what I managed to find out about
filtered_meta_types, but I'm not sure. Can anyone offer any advice?

Thanks.

___
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] Uploading files

2000-11-15 Thread Nolan Darilek

I'm trying to write a replacement form which allows users to upload
images into a folder. I'm almost there, but not quite.

I'm having difficulties getting the file contents into the database. I
have an input type="file" field, and I'm fairly sure that the data
is being sent. When I create the Image however, I use
file=REQUEST['file'], and the resulting image stores the path to the
file, instead of the file contents. So, given that I've uploaded a
file, and that its name is in REQUEST['file'], how do I get at its
contents when creating the Image?

___
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] Folder-specific metatypes?

2000-10-25 Thread Nolan Darilek

I'm working on a product in Python which implements a folder, but
restricts the metatypes of the objects which can be added. How,
exactly, do I go about doing this? I've tried overriding the
filtered_meta_types method, but I'm returning a list, and it seems
that I should return a list of dictionaries instead, but I'm not entirely sure
how the metatype is converted into a dictionary. I also noticed the
_product_meta_types variable, but rgreps of the zope code didn't
reveal anything about this variable. Am I on the right track with
these?

Thanks.

___
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] Z class complexities

2000-10-01 Thread Nolan Darilek

I'm having a kinda complex problem, and hopefully my explanation can
do it justice. :)

I'm using zope to construct an XML document from the contents of a
folder. Basically, the folder's index.xml iterates through the
folder's contents, rendering each object to produce the final
document. The objects are separate z classes which combine various
properties into a small snippet of the larger XML document.

The z class has a render() method which combines the properties into
the XML snippet. I have a Render view configured to run this method,
and it works. (Though for some reason it adds a htmlhead..., which
I'd really like to get rid of. How can I?)

I've written the index_html to collect the individual objects and
concatenate their contents into an XML document. The code for the
method is below:

?xml version="1.0"?
espsetup-list
dtml-in "PARENTS[0].objectValues('ESPPackage')" sort=title   
dtml-var "_[_['id']].render()"
/dtml-in 
/espsetup-list

This almost gives me what I want (I say "almost" because everything
works, short of the render() call.) Viewing this results in:



++
||Zope Error |
||   |
||Zope has encountered an error while publishing this resource.  |
||   |
||Error Type: KeyError   |
||Error Value: title |
||---|
||   |
||Troubleshooting Suggestions|
||   |
||   o This resource may be trying to reference a nonexistent object or  |
|| variable title.   |
||   o The URL may be incorrect. |
||   o The parameters passed to this resource may be incorrect.  |
||   o A resource that this resource relies on may be encountering an error. |
||   |
||For more detailed information about the error, please refer to the HTML|
||source for this page.  |
||   |
||If the error persists please contact the site maintainer. Thank you for|
||your patience. |
++


Traceback (innermost last):
  File /usr/local/zope/e1/lib/python/ZPublisher/Publish.py, line 222, in publish_module
  File /usr/local/zope/e1/lib/python/ZPublisher/Publish.py, line 187, in publish
  File /usr/local/zope/e1/lib/python/Zope/__init__.py, line 221, in 
zpublisher_exception_hook
(Object: Traversable)
  File /usr/local/zope/e1/lib/python/ZPublisher/Publish.py, line 171, in publish
  File /usr/local/zope/e1/lib/python/ZPublisher/mapply.py, line 160, in mapply
(Object: index.xml)
  File /usr/local/zope/e1/lib/python/ZPublisher/Publish.py, line 112, in call_object
(Object: index.xml)
  File /usr/local/zope/e1/lib/python/OFS/DTMLMethod.py, line 172, in __call__
(Object: index.xml)
  File /usr/local/zope/e1/lib/python/DocumentTemplate/DT_String.py, line 528, in 
__call__
(Object: index.xml)
  File /usr/local/zope/e1/lib/python/DocumentTemplate/DT_In.py, line 691, in renderwob
(Object: PARENTS[0].objectValues('ESPPackage'))
  File /usr/local/zope/e1/lib/python/DocumentTemplate/DT_Util.py, line 337, in eval
(Object: _[_['id']].render())
(Info: _)
  File lt;stringgt;, line 0, in ?
  File /usr/local/zope/e1/lib/python/OFS/DTMLMethod.py, line 168, in __call__
(Object: render)
  File /usr/local/zope/e1/lib/python/DocumentTemplate/DT_String.py, line 528, in 
__call__
(Object: render)
KeyError: (see above)

--

I have a title variable in the z class which this index.xml method is
referencing. And, as previously stated, the render() method runs
without errors when invoked via the view. Yet, trying to display this
document from within another doesn't work. Can anyone please advise?

Thanks a bunch in advance.

___
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] Site search

2000-05-24 Thread Nolan Darilek

I followed the helpful instructions in the Z Catalog tutorial
concerning adding searching to my site, and it works, though not in
the way that I'd like. I've added the raw field to the list of
searched indices, and chosen to only index DTML documents. Yet, all of
my searches seem to be case sensitive, and they all seem to be 'and'
searches. I'm not particularly interested in supporting boolean
keywords, but since my site isn't that large, it might make more sense
to treat searches as 'or' searches by default.

How difficult is it to implement case insensitive searches in this
manner?

Also, I've noticed that DTML documents don't appear to automatically
add themselves to the Z catalog. My understanding is that all Z
catalog-aware classes automatically notify the catalog when they are
created; are DTML documents and methods not catalog-aware?

Thanks.

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