[Zope-dev] Interesting namespace observation

2002-05-27 Thread Roché Compaan

I have a method in the root of my application called getProxies
that queries a catalog for a given metatype.

I have a folder in the root called Platforms with a method
called selectInstance that renders a series of checkbox tags.

I call selectInstance method from an adjacent folder with
dtml-with Platforms dtml-var selectInstance /dtml-with

This is how this method look at first:

dtml-let 
control_set=setControl(_, 'PlatformID')
control_name=control_set[0]
control_value=control_set[1]
control_type='checkbox'
num_columns=3

dtml-in getProxies('Platform') sort=Name prefix=platform
dtml-let
item=platform_item.id
display_item=platform_item.Name
dtml-var inputTag
/dtml-let
/dtml-in

/dtml-let

Doing the above gives a key error for getProxies, however if
I move getProxies into the let tag it does _not_:

dtml-let 
control_set=setControl(_, 'PlatformID')
control_name=control_set[0]
control_value=control_set[1]
control_type='checkbox'
num_columns=3
proxies=getProxies('Platform')

dtml-in proxies sort=Name
dtml-let
item=id
display_item=Name
dtml-var inputTag
/dtml-let
/dtml-in

/dtml-let

It seems like dtml-let is doing something with the namespace
that makes it impossible for the subsequent dtml-in tag to 
find the getProxies method in the root.

Any ideas why?

-- 
Roché Compaan
Upfront Systems http://www.upfrontsystems.co.za 



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



[Zope-dev] Sequencing question

2002-05-27 Thread David Williams

Ooops, sorry, sent this by mistake before I had finished  try again

Hi all
First-time posting from a Zope newbie ... hopefully someone can help 

I have defined a number of ClientProjects within Zope and I am trying to
display these in a number of ways, filtered by object property values.
So, for example, I want to display all client projects, or perhaps only
those marketing projects, ie. where the marketing property has a value.

I display the client project titles in an HTML table, 3 per row, and for all
projects this works OK - I use the sequence-number to control the table
formatting, and the index sequence is unbroken when all objects are
displayed.

My problem arises when I have a sub-set of projects to display, because the
sequence-number and sequence-index values still seem to relate to the full
set of objects. So if the sub-set only comprises objects 7  8 (eg the only
marketing projects), the sequence-number is not reset automatically to 1  2
- they remain at 7  8. The same applies to the property sequence-index. So
the way I check for the 3rd item in the collection, using sequence-number,
does not work becuase the sequence number is not guaranteed to start at 1.

I think I need a Python function to query and return a subset of objects,
but how do I go about writing such an external method ? And how does it
access my Zope ClientProject objects ?

I also looked at using dtml-let and trying to keep a separate count ticking
along, but seem to run into trouble with the variable's scope. 

Or is there an easier way around this that I have missed ?

Any ideas ?

Thanks in advance
Dave



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



Re: [Zope] Re: [Zope-dev] Interesting namespace observation

2002-05-27 Thread Roché Compaan

On Mon, 2002-05-27 at 18:31, Leonardo Rochael Almeida wrote:
 On Mon, 2002-05-27 at 11:45, Roché Compaan wrote:
  [...]
  
  dtml-in getProxies('Platform') sort=Name prefix=platform
 
 This is not a valid syntax, you should have::
 
   dtml-in getProxies('Platform') sort=Name prefix=platform
 
 Note the double quotes around the getProxies call. In order not to use
 the double quotes, you'd have not to pass any parameters to getProxies
 as in:
 
   dtml-in getProxies sort=Name prefix=platform

Oopps, I think my eyes got really tired - I was refactoring about 200
methods.

I must have known it is something like this becuase in some places it
worked, hehe :)

Apologies for the cross posting - I thought this was raly
interesting.




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



[Zope-dev] Re: ExternalEditor for Windows setup

2002-05-27 Thread Gabriel Genellina

At 09:17 a.m. 23/5/2002 +0200, Joachim Schmitz wrote:

Bill,

I try to run it on my win98 system with python 2.2.1, both with mozilla 
1.0 and opera 5.0. But I can't get it to start.

the file dialog-download dialog shows, but than nothing happens

configured

/path_to_python/python /path_to_zopeedit/zopeedit-win32.py
/path_to_python/pythonw /path_to_zopeedit/zopeedit-win32.py
/path_to_zopeedit/zopeedit-win32.py

none of them works. Could you give a short description, how you did it.

Also how would I use this with IE ?

Sorry about the delay, I was out of town for a while.
Perhaps you have managed to work it, but this is how I've set it up:

- Using Opera:
Go to File | Preferences | File Types, press New, and enter:
 Mime ContentType: application/x-zope-edit
 Action: Open with another app: /path_to_python/python 
/path_to_zopeedit/zopeedit-win32.py

- Using IE:
Open My Computer, go to View, Folder Options, tab File Types, press New Type.
Description: Zope External Edit
Extension: . (just a dot)
ContentType (MIME): application/x-zope-edit
Press New:
 Action: Open
 App: /path_to_python/python.exe /path_to_zopeedit/zopeedit-win32.py
 OK
Uncheck 'Confirm open after download'


Gabriel Genellina
Softlab SRL



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



[Zope-dev] [OPINIONS SOLICITED] Adding Batch Factory to ZMI Add menu OK?

2002-05-27 Thread Craeg K Strong

Hello:

I am about to release a new version of the ExternalFile and CVSFile products

http://www.zope.org/Members/arielpartners/ExternalFile

They are Zope objects that behave like standard Zope objects but retrieve
their content from files anywhere in the file system. (kind of like a windows 
shortcut or UNIX symbolic link)

I would like to include a way to automatically create an instance for every
file within a directory:  a batch flavor.

Previously, one would have to select ExternalFile from the Add menu in ZMI
for each and every file, one at a time.  For large directories, this is a major
pain.

The way I have implemented this is to create a new pseudo object -- basically
a factory for creating batches of ExternalFiles: ExternalFileBatch

You select External File Batch from the Add menu in ZMI and you get a form
that allows you to specify the directory.

Here is the code for ExternalFileBatch.py:


def manage_batch_add(self, target_dir, basedir='', REQUEST=None):
 
 Factory method to actually create a batch of instances of
 ExternalFile.
 
 message = h2External File Batch Create Results:/h2

 try:
 filelist = dirlist(os.path.join(basedir,target_dir))

 if len(filelist) == 0:
 message = message + No files found.

 for fileid, filepath in filelist:
 message = message + Object instance ' + \
   fileid + \
   ' successfully created, pointing to file:  + \
   filepath + br/

 self._setObject(fileid, ExternalFile(fileid, '', '', filepath))
 self._getOb(fileid).reindex_object()

 except OSError, e:
 message = message + str(e)

 return MessageDialog(title   = 'results',
  message = message,
  action  = 'manage_main')


# ExternalFileBatch class


class ExternalFileBatch:
 
 ExternalFileBatch is a factory for creating instances of
 ExternalFile a batch at a time
 
 meta_type = 'External File Batch'


As you can see, ExternalFileBatch is not much of a class.   It is really just
a Factory for creating instances of another class, namely ExternalFile.

An alternative would have been to create an additional tab in the ZMI for 
Folders which allows you to create instances of ExternalFile.  I could do this
by monkeypatching Folders, or by creating an ExternalFileFolder class.

There are advantages and disadvantages either way.  I don't like 
ExternalFileFolder b/c ExternalFiles are not supposed to be anything special. 
The whole point is to be able to use them in ANY context in which you would use 
a standard Zope object.

Thoughts?

--Craeg



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



Re: [Zope-dev] [OPINIONS SOLICITED] Adding Batch Factory to ZMIAdd menu OK?

2002-05-27 Thread Leonardo Rochael Almeida

Hello Craeg

I particularly prefer the factory aproach. Zope users are already used
to that approach because of the Z Search Interface. I think you
shouldn't need a dummy class just to be able to create such a factory,
but right now I don't know how you'd go about creating a factory without
a class.

As for an ExternalFileFolder, it would be useful if it automatically
created objects when they are added to the respective directory
(automatically as in, it checks for new objects when you look at the
object list (manage_main), or when you try to access a previously
inexistant (sp.) object. Although, because of Data.fs write-on-read
concerns, you might want this automation to be configurable on a folder
by folder basis). An ExternalFolder might also provide a view or tab to
configure default attributes of newly discovered objects. The objects
created this way would obviously be regular ExternalFile objects, and
you could copy/cut and paste them outside of the ExternalFileFolder
object.

Cheers, Leo

On Mon, 2002-05-27 at 17:32, Craeg K Strong wrote:
 Hello:
 
 I am about to release a new version of the ExternalFile and CVSFile products
 
 http://www.zope.org/Members/arielpartners/ExternalFile
 [...]

-- 
Ideas don't stay in some minds very long because they don't like
solitary confinement.



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