[Zope-dev] ZWikiZC comments

2000-08-28 Thread Ross Boylan

Two substantive comments, and some editorial ones.

You write that you are thinking of different schemes for generating
paths and ids.  I suggest one of the things you consider is whether
your scheme will work if someone cuts the ZWikiZC and pastes it
somewhere else in the tree.

I'm not sufficiently versed in the different methods you discussed to
understand their implications--they seem to involve yet more
undocumented interfaces in Zope.


Second, I think the facility for email notification of changes is
really interesting.  It seems to me that a problem with the Wiki
concept (for some uses) is that they are very difficult to monitor for
changes.  Sending email, perhaps combined with diff, could help with
this.


Editorial comments:

"Summary" is spelled with an "a" (not summery).
"Product" is spelled with a "c" (not produkt).
Since these words are prominent in the documentation, and at least one
(summary) is to be a critical method, it would be good to clean this up.

The "!" in the paths baffled me (e.g., "!WikiPage").

Why Catalogs distinguish metadata from indices also eludes me.  It
should be explained in the Z/Catalog writeup, but since it's not, it
was there to bother me while I read your description.

It's hazardous to claim a performance advantage without benchmarks.


___
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] Why use apply(foo.__call__, ..)?

2000-09-01 Thread Ross Boylan

In looking over the code for ZWiki/ZC, I see a lot of places with the 
following construct:
apply(foo.__call__, some, arguments)
Why not just say
foo(some, arguments)?

Examples of the construct from ZWikiPage.py:
apply(self.aq_parent.standard_wiki_page.__call__,
   (None, REQUEST, REQUEST.RESPONSE))
or
apply(DTMLDocument.__call__,(self, self.aq_parent,
  REQUEST, REQUEST.RESPONSE))

[OK, in this case the question technically is why use apply(foo.__call__, 
(a, b, c)) instead of foo(a,b,c)? Hmmm...
x.foo(a, b, c) - foo.__call__(x, a, b, c).]

These requests are mostly, if not entirely, directed at 
WikiPages/Headers/etc, whose definition is, in part,
class ZWikiPage(DTMLDocument): #, CatalogAware):
 def __call__(self, client=None, REQUEST={}, RESPONSE=None, **kw):
 """Render a zwiki page, with standard header  footer
 """

I thought the use of keyword argument dictionaries in apply might explain 
this, but, as the two opening examples show, not all cases have 
keywords.  Second, even if they do one could say
aDocument(self, REQUEST, REQUEST.RESPONSE, kw).

I understand from Johan that this is "inherited" code (in the non OO 
sense), so I thought I'd throw this out as a general question.  Is there 
some subtlety of the interaction of Zope (acquisition, perhaps, or 
extension classes in general) and python that makes foo(x) and 
foo.__call__(x) have different meanings?
Is it something about standard_zwiki_page, which I notice is not a regular 
python variable?

I don't need the answer to this to do something; I'm just trying to 
understand how things work.

Thanks.




___
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] Object references from dtml

2000-10-20 Thread Ross Boylan

I have a log composed of sublogs, and so on.  I would like for people to be 
able to see some kind of summary (e.g., short versions of the logs down n 
levels) on the screen and then click on one of interest and see a fuller 
display of it.

Is there a good way to do this using dtml?

I've thought of two approaches.  The "standard" zope way seems to be to 
make each log folderish, and give each entry an id.  Then I can embed the 
address in the html.  The problem with this is that I would have to make up 
the id's and add extra machinery that the logs don't really need.

I'm leaning toward a second approach, of getting an object id and putting 
it in the html.  This also raises some issue.
   * Will the id be stable in the face of the db potentially 
dematerializing objects underneath?
   * If I use a persistent id (_p_oid, I think), will that be stable?
   * (Also, I'll need to be sure everything has persisted, but I think I 
can do that by forcing a transaction end before getting the _p_oid).
   * Can I map from object id back to object?  (_p_jar.something or other)
   * Will this be robust across database changes (minimally, from ZODB to 
ZEO)?
   * Will the object id consist of characters which can be embedded easily 
in html?


___
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] Problems with offline MS IE 5

2000-10-22 Thread Ross Boylan

Applying W2K SP1 seemed to fix up this problem.  However, the original 
problem may not have occurred instantly, so perhaps it takes a bit more to 
bring it out.

At any rate, I also upgraded to IE 5.5, so I hope that will be the end of 
the bad caching behavior.

Thanks, Jens, for your response.

At 11:09 PM 10/19/2000, Ross Boylan wrote:
I recently tried doing some Zope development on a laptop and ran into a 
problem: when I updated a product the updates did not "take."  In 
particular, when I edited the text in a .dtml file and restarted Zope, I 
still saw the old text  when I got to the appropriate point (the file was 
wrapped in an HTMLFile() and used for creating a new instance of one of 
the products in the package).

I think I checked all of the following:
* the file was getting updated
* all instances of explorer were shut down
* MSIE options set to "Check for newer version of stored page on every 
visit to the page"

A notable peculiarity was that whenever I tried to access my local zope, I 
would get a "you are offline, do you wish to go online" message (I even 
used localhost as the machine name!).  I would say yes, it would say it 
couldn't connect and ask if I wanted to try again.  I said yes, but then I 
ran into the problems described above.

Zope 2.2.2 on MS W2K with MS IE 5.0.

Does this ring any bells with anyone?  Is it an IE problem?  a Zope 
problem?  an interaction?


___
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] Appropriateness of using ZODB transactions to sync databases

2001-10-17 Thread Ross Boylan

I am working on a membership application for a voluntary organization.
The database may be updated either by the national office or local
chapters.  For security, convenience, and hosting reasons it seems
best that locals work off their own copy of the database.

Periodically changes will need to be syncronized, in both directions.
I know that ZODB logs transactions.  Is exchanging transactions a
reasonable way to accomplish the syncronization?  If so, exactly how
do I go about grabbing them (it would be all since date x) and then
replaying them?

Thanks.

___
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] Establishing root objects in ZODB under Zope

2002-01-23 Thread Ross Boylan

I have some data that will not naturally live as an item in a folder.  If 
I'm using Zope, how do I establish a root for it?  The ZODB docs talk about 
how to handle a free-standing database, but I don't see info about how to 
use the one that Zope has already set up.  I recall there's some way to get 
a handle to the open database, but I don't recall exactly what.  Can 
anybody help me out?

If I use a class variable, will that be persisted automatically, e.g.
class MyManager(Persistence.Persistent):
MyClassVariable = SomePersistentClass()
.
? (Actually, I'm not sure if it matters whether MyManager is a subclass of 
Persistent).

Or, if it is not automatically persistent, is there anything I can do to 
make it persistent so that it will obey the transaction boundaries coming 
from web requests?

Final question, which is distinct from the root objects issue: if I use 
Zope's Persistent List, will that avoid the problem of faulting in the 
whole list if I don't need it?  I am looking for a good way to keep a 
record of transactions.  ZODB's raw transaction recording is probably not 
quite right since it has the wrong granularity, it mixes a lot of unrelated 
transactions (it's only some I want), and I think it can get zapped if I do 
various database compactions and cleanups.

Thanks.


___
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: Establishing root objects in ZODB under Zope

2002-01-23 Thread Ross Boylan

At 09:37 PM 1/23/02 -0800, Ross Boylan wrote:
I have some data that will not naturally live as an item in a folder.  If 
I'm using Zope, how do I establish a root for it?  The ZODB docs talk 
about how to handle a free-standing database, but I don't see info about 
how to use the one that Zope has already set up.  I recall there's some 
way to get a handle to the open database, but I don't recall exactly 
what.  Can anybody help me out?

If I use a class variable, will that be persisted automatically, e.g.
class MyManager(Persistence.Persistent):
 MyClassVariable = SomePersistentClass()
 .
? (Actually, I'm not sure if it matters whether MyManager is a subclass of 
Persistent).

Or, if it is not automatically persistent, is there anything I can do to 
make it persistent so that it will obey the transaction boundaries coming 
from web requests?

I just realized that I can hang the persistent object off the item or 
folder that is my product.  I'm still curious what the other options are.


Final question, which is distinct from the root objects issue: if I use 
Zope's Persistent List, will that avoid the problem of faulting in the 
whole list if I don't need it?  I am looking for a good way to keep a 
record of transactions.  ZODB's raw transaction recording is probably not 
quite right since it has the wrong granularity, it mixes a lot of 
unrelated transactions (it's only some I want), and I think it can get 
zapped if I do various database compactions and cleanups.

Thanks.


___
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] [Partial Solution] Re: Establishing root objects in ZODB underZope

2002-01-23 Thread Ross Boylan

At 09:37 PM 1/23/02 -0800, Ross Boylan wrote:
I have some data that will not naturally live as an item in a folder.  If 
I'm using Zope, how do I establish a root for it?  The ZODB docs talk 
about how to handle a free-standing database, but I don't see info about 
how to use the one that Zope has already set up.  I recall there's some 
way to get a handle to the open database, but I don't recall exactly 
what.  Can anybody help me out?

Continuing to  talk to myself I finally found some old notes.  For the 
record (unless things have changed)
conn = aPersistentObject._p_jar
will retrieve the connection.  One can then get the root with
conn.root()

Thanks to Jim Fulton who originally explained this to me.

I'm still wondering about class variables being persistent and the 
efficiency of PersistentList, if anyone has any comments.


If I use a class variable, will that be persisted automatically, e.g.
class MyManager(Persistence.Persistent):
 MyClassVariable = SomePersistentClass()
 .
? (Actually, I'm not sure if it matters whether MyManager is a subclass of 
Persistent).

Or, if it is not automatically persistent, is there anything I can do to 
make it persistent so that it will obey the transaction boundaries coming 
from web requests?

Final question, which is distinct from the root objects issue: if I use 
Zope's Persistent List, will that avoid the problem of faulting in the 
whole list if I don't need it?  I am looking for a good way to keep a 
record of transactions.  ZODB's raw transaction recording is probably not 
quite right since it has the wrong granularity, it mixes a lot of 
unrelated transactions (it's only some I want), and I think it can get 
zapped if I do various database compactions and cleanups.

Thanks.


___
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 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] Adding Items to Object Manager and Folders

2002-07-16 Thread Ross Boylan

The Zope Developer's Guide and the API docs (Zope 2.5) present
different stories about how to add things to object managers.  I don't
really follow what the API stuff is doing.  This is a request for
clarification. 

Devguide says do
def addFunction(dispatcher, id):
   Create object and add to self
   p = SomeProduct(id)
   dispatcher.Destination()._setObject(id, p)

This makes sense, though, as commented at
http://www.zope.org//Members/michel/Projects/Interfaces/ObjectManager,
it relies on a private, undocumented method.  addFunction is in outer
scope of a module, and is hooked up wtih various calls in ___init__.py.

On the other hand, the ObjectManager API says to do
self.manage_addProduct['OFSP'].manage_addFolder(id, title).

First, what scope should that be done in?  Second, this seems to
create one product (OFSP) and then add a folder to it, so that it
creates two, nested products.

The API for Folder mentions manage_addFolder as a constructor, but
again the scope is unclear to me.  Presumably it needs to know what to
add it to, but that is not passed in.

Finally, the use of id in two places in the first code snippet (one
apparently associated with the container, the other with the object)
seems like an invitation to trouble.  Why is it done that way?

One reason I want to know this is that I'm considering having a
container that would automatically label (or set id) of its contents
(e.g., 'a' is first, 'b' is second).

Thanks for any light you can shed.



___
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] Nesting Forms

2002-07-17 Thread Ross Boylan

I have a product with a number of classes that have subclasses.  It
seems natural to make the screens for the subclasses by extending
those of the superclass.  Can anyone suggest a good way to do that?

The naive approach is that I have a manage_edit_A.dtml that gives a
management screen for A.  If B subclasses A, I create
manage_edit_B.dtml by copying from the first file and then fiddling
with it.  Obviously, it would be desirable for a change in A to only
require changing a single file.

I would prefer a more elegant approach.  Perhaps I can define some
method in A that the dtml will reference, and then B can override the
method to add some extra stuff (the method would return a DTML
snippet).

First, I'm not exactly sure how to pick up the method from the DTML.
Second, I'm not sure if this is the best solution.  For one thing, I
would prefer to keep all my dtml in separate files, rather than
defining it into my methods.

Any suggestions?

P.S. I'd like to thank Toby Dickenson, Casey Duncan, and R. David
Murray for their very helpful responses to my previous question.


___
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] Nesting Forms

2002-07-18 Thread Ross Boylan

On Thu, Jul 18, 2002 at 02:18:43PM -0400, Casey Duncan wrote:
 On Thursday 18 July 2002 02:06 pm, Ross Boylan wrote:
  Is there a way to get inheritance, so that, for example, 
  class C(B):
sect1 = DTMLFile(CSect2,globals())+B.sect1(self)?
  
  I don't think that syntax will work, but perhaps you see what I'm
  driving at--I want to include all the  previous stuff.
 
 Please explain what you mean by include. + to me implies append, surely not 
 what you were after.
 
 Perhaps a specific use case would make this clear.
 
 -Casey
 
I think append would be OK.  In most obvious case, the screen for A
looks like
foobar
xxx
 

And for B it would be 
foobar
xxx
 
zzz
aaa

And then for C
foobar
xxx
 
zzz
aaa
qqq 


And then if I extend A by adding some more data or info on the screen
foobar
new stuff
xxx
 


C ends up looking like
foobar
new stuff
xxx
 

zzz
aaa
qqq 



___
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] Nesting Forms

2002-07-18 Thread Ross Boylan

On Thu, Jul 18, 2002 at 08:41:02PM +0200, Dieter Maurer wrote:
 Ross Boylan writes:
   ...
   I would prefer a more elegant approach.  Perhaps I can define some
   method in A that the dtml will reference, and then B can override the
   method to add some extra stuff (the method would return a DTML
   snippet).
 That sounds good. It is how the ZMI works...

ZMI = Zope Management Interface (i.e., in the core app), or is this
something else?  At any rate, I'm not sure what you're referring to,
or where to look.

 
   First, I'm not exactly sure how to pick up the method from the DTML.
 There are two cases:
 
   *  view of an existing object
   
  then the object is the client of the primary view.
  Make all you snippets attributes of the object
  and you can simply access them by name.
 
  The ZMI does this. If necessary, look how it does.

The problem isn't just accessing them, but combining them.  Say C is a
subclass of B is a subclass of A.  Each subclass has the entire user
interface of its base class (aka superclass) and some extra stuff.

Either each class implements its novel stuff with a unique name.  In
that case, I still have to make a separate dtml file for each,
referencing the appropriate names (though your suggestion below helps
on that).

Or each has the same name.  Then the problem is how to get the
subclasses method to return its unique stuff plus everything in its
base class.  For vanilla methods that's not a big deal, but if each is
a DTMLFile, I don't think it will work.  More about that at the very
bottom.

 
   *  object creation form
   
  That's much more difficult. ZMI does not reuse fragments for
  this case.
 
  There is a partial solution for DTMLFiles, but it is not nice
  and restricted to DTML.
 
  DTMLFile constructors accept a dictionary with default
  name bindings. This way, you can customize your
  DTMLFile with different bindings according to context,
  e.g.
 
   addAForm= DTMLFile('dtml/addForm', globals(),
  comp1= AComp1
  comp2= AComp2
  ...)
   addBForm= DTMLFile('dtml/addForm', globals(),
  comp1= BComp1
  comp2= BComp2
  ...)

This suggests one semi-refined strategy: the file defines the maximal
interface, and then parts of it are guarded by dtml-if ...  tests on these
extra variables I pass in. I could even pass the class in, but I
suppose if I try to do issubclass(PassedInClass, MyApplicationClass)
in the dtml-if I will find that I lack security to access
PassedInClass, issubclass, or MyApplicationClass.


 
   Second, I'm not sure if this is the best solution.  For one thing, I
   would prefer to keep all my dtml in separate files, rather than
   defining it into my methods.
 You can have separate files and do something like:
 
 class YourProduct:
   
   mySnippet= DTMLFile('dtml/mySnippetFile',globals())
   
 

The problem comes if I stick the different interface segments in
different files, so A.dtml has the user interface for A and B.dtml has
just the added interface for B, a subclass of A.  But I want the user
interface for B to be the combination of the A and B parts.

 
 Dieter
 


___
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] Extension class and __init__

2002-07-22 Thread Ross Boylan

I had the bright idea of defining a mixin class whose methods I
thought I could use in my regular Zope product classes:

class AMixin:
  def __init__(self):
 blah, blah blah

class B(AMixin, Persistent, Folder, ):
  def __init__(self):
# do some of my own stuff
AMixin.__init__(self)

This fails with the warning (as I recall) that the unbound method
AMixin.__init__ needs to be called with an instance as its first
argument.  (I've stripped the example down to give what I think are
the essentials).

self in the context of B is an Extension class, and I'm guessing this
is making AMixin unhappy because it's not.  I assume I'll have the
same problem with other methods that I attempt to access using
AMixin.foo(self).

Can anyone confirm this diagnosis?  And what's the best solution?

I have redefined things
class AMixin:
  def _mixin_init(self):
#stuff

class B(AMixin, .):
   def __init__(self):
#my own stuff
self._mixin_init(self)

and this seems to work, but I wonder if there's a way to get the
classes to play together better (maybe class AMixin(ExtensionClass):?
though since ExtensionClass is a type I guess that's not exactly it).

This was after already discovering that isinstance doesn't work with
ExtensionClass (which I see confirmed on the list, along with the fact
that ExtensionClass generally has a lot of rough spots and may be on
the way out).  This is with Zope 2.5.1.


___
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] Refresh trashes acquisition

2002-07-23 Thread Ross Boylan

I find that when I refresh my product it destroys some of the
containment relationships.  Things start failing, and as far as I can
tell the only recovery is to completely rebuild the object.

This is a big problem, and if anyone could explain what is going on
and how to avoid it I would appreciate it.

Here is the result of aq_chain before the refresh:
[RankQuestion instance at 8dd5620,
OriginalSuborder instance at 8c9f8d8, EMailBallot instance at
8dfc870, __FactoryDispatcher__ instance at 8e73770,
ProductDispatcher instance at 83f0618, Folder instance at 8d5733

and after
[RankQuestion instance at 8dee2d0]

Interestingly, and object inside this retained some context:
Before: [RandomSuborder instance at 8df6248, RankQuestion instance at 8dd5620, 
OriginalSuborder instance at 8c9f8d8, EMailBallot instance at 8dfc870, 
__FactoryDispatcher__ instance at 8e73770, ProductDispatcher instance at 83f0618, 
Folder instance at 8d57330, Application instance at 8e44ae0, RequestContainer 
instance at 8ed53e8]

After: [RandomSuborder instance at 8be7128, RankQuestion instance
at 8dee2d0]

Notice that the new RandomSuborder instance (new, judging by the
address, though it should be the same object) points to the new
RankQuestion.  Unfortunately, I need to go a little further than that
to get the variable I'm looking for :(.

It may be relevant that I am explicitly wrapping objects uses
a.__of__(b). I did this because I thought things weren't being wrapped
at all, but the results above show the problem is different: the
wrappers are lost on refresh.  The refresh changes nothing structural,
just some method code.

One thought that occurred to me is that it is not the changes to my
product classes that is causing the trouble, but the inclusion of some
of the items higher up the chain.

___
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: Refresh trashes acquisition

2002-07-25 Thread Ross Boylan

On Thu, Jul 25, 2002 at 12:09:35PM -0700, Gary Speer wrote:
 Dear Ross - 
 I strongly encourage you to switch to the [EMAIL PROTECTED] mailing list as this one is 
dedicated to next-generation product enhancement as opposed to peer user assistance.

I thought this list was for developers, including product developers,
while the other was for zope users.  Isn't that the case?

 
 The approach you are taking seems a bit convoluted and I, for one, do not understand 
the business/project objectives reason to construct the objects as you do and create 
the acquisition cvhallenge you hope to solve.  Perhaps you can elaborate on the goal 
you hope to accomplish so others can suggest the better tools and object containment 
structure to use.  It seems earlier design decisions have taken you to solving issues 
that might not exist with an alternative, more-naturally-zope-like approach.
 
 Gary
 

I suspect you are right that I may be going about this in an un-Zope
like way, so let me describe the goals at a slightly higher level.  My
immediate goal is to be able to do votes for a non-profit organization
I'm in.  Existing tools that I have found (include both non-Zope
things and the Zope Poll product) are not quite flexible enough.  For
example, I want to have several question in one poll (eliminatess most
of the non-Zope things) and I want to be able to have people rank
alternatives for some of the questions (Poll product doesn't have
this).

I'm trying to make something that has lots of little bits that can be
combined flexibly.  For example, one can combine a particular style of
question (yes/no vs ranking) with a way of tabulating the votes
(instant-run-off vs ranked pairs for ranked questions).

The part that's giving me trouble relates to how subitems are
handled.  Questions are subitems of a Ballot, and Response are
subitems of Questions.  There are two choices
1) what order should the items be presented in (e.g., original order
or a random order)?
2) how should they be labelled?  This in turn has two parts: do you
want arabic, roman, or letters for the labels, and what decoration
around that do you want--e.g., Question xxx: vs Issue xxx).

It seems natural to allow some of these options to be specified at a
high level of containment.  For example, one might have a preferred
numbering style for questions and another for responses that are set at
the level of the Ballot (or even higher, possibly).  Then, if you
wanted to, you could override these lower down.

Specifically, each question determines how to number its responses,
but the style it uses for numbering the responses will typically come
from a higher level.

This style of containment and optional overriding seemed to me exactly
what acquisition was all about, so I tried to do it with acquisition.
But it didn't work.  Based on previous responses, I've implemented a
containment hierarchy by hand.  This works.  Almost surely there is a
better way.

___
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] Re: Refresh trashes acquisition

2002-07-29 Thread Ross Boylan

On Mon, Jul 29, 2002 at 07:58:22AM +0100, Toby Dickenson wrote:
 On Saturday 27 Jul 2002 12:32 am, Ross Boylan wrote:
  On Sat, Jul 27, 2002 at 12:26:04AM +0200, Lennart Regebro wrote:
   From: Ross Boylan [EMAIL PROTECTED]
  
I don't follow that last paragraph.  Does it mean
1. acquisition created by a.__of__(b) doesn't survive transactions.
  
   Correct.
 
  Just to be sure I understand: so if c is persistent, and I say
  c.d = a.__of__(b)
 
 This is storing an acquisition wrapper as an attribute of c. 
 
 acquisition wrappers are not persistent. This will raise an exception if you 
 try to store c in ZODB.
 

I was able to store these things without raising an exception, though
not with the ability to reconstitute them reliably.

My case was, however, subtly different.  a.__of__(b) got put in a
PersistentList, which is essentially [] with a little extra help:
-
# This code is a copy of the Python UserList.py, updated to support
# persistence.

from Persistence import Persistent


class PersistentList (Persistent):

isAPersistentList = 1

def __init__(self, lst=None):
if lst is None:
self.data = []
else:
self.data = list(lst)
--

Either this case is different, or it is not the case that attempting
to store and acqusition wrapper raises an exception (in Zope 2.5.1).

___
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] Re: Refresh trashes acquisition

2002-08-08 Thread Ross Boylan

I missed this in all the excitement, and have a follow-up below.
On Tue, Jul 30, 2002 at 04:57:07PM +, Florent Guillaume wrote:
 Ross Boylan  [EMAIL PROTECTED] wrote:
  My case was, however, subtly different.  a.__of__(b) got put in a
  PersistentList, which is essentially [] with a little extra help:
  # This code is a copy of the Python UserList.py, updated to support
  # persistence.
  
  from Persistence import Persistent
  
  
  class PersistentList (Persistent):
  
  isAPersistentList = 1
  
  def __init__(self, lst=None):
  if lst is None:
  self.data = []
  else:
  self.data = list(lst)
 
 This is not a correct PersistentList. Your object won't get stored to
 ZODB upon l.append(xx) or l.update.
 
 There is a correct PersistentList in the ZODB package of Zope 2.6 (in
 CVS).
 
 Florent
 

That was just the first few lines of the class definition to give a
flavor.  Was your remark that it was wrong based on the assumption it
was the entire implementation, or is there something obviously wrong
with the part you see?

___
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] Re: Refresh trashes acquisition

2002-08-10 Thread Ross Boylan

On Sat, Aug 10, 2002 at 10:25:32AM +0100, Chris Withers wrote:
 Ross Boylan wrote:
 
 That was just the first few lines of the class definition to give a
 flavor.  Was your remark that it was wrong based on the assumption it
 was the entire implementation, or is there something obviously wrong
 with the part you see?
 
 Nothing wrong with the visible parts, how did you implement the append 
 (and other) methods?
 
 cheers,
 
 Chris
 
I didn't implement it, though I can't remember where I got it from.  I
think it's OK.  For example, here's append

def append(self, item):
self.data.append(item)
self._p_changed = 1


I hope that's not a ZODB 2 ism also!


___
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] How to trigger Zope externally (mail)

2003-02-26 Thread Ross Boylan
I am working on a poll/survey type product and want to handle
responses by email as well as the web.  If you have any advice about
the best architecture, I would appreciate it.  I'm currently using
Zope 2.5 on Linux, though it would be nice if the solution weren't too
platform dependent.

Here are some options I have thought of.

1. Incoming mail goes to a pipe, which is a program that processes the
message.

I think the main drawback of this approach is that I would need to run
Zope on top of ZEO so that multiple processes could access the
database safely.  I'm also not sure how hard it would be to
reestablish the context of my product outside of regular Zope.

Aside from these concerns, this seems the most natural approach.

2. Incoming mail goes to mbox; via the regular zope web interface I
periodically point to the mbox and request that it be processed.

Ugly, but relatively simple.  Some locking and concurrency issues.
Likely to result in much slower response to mail.  Also, there could
be some problems distinguishing message boundaries; in practice,
probably not a problem.

3. Incoming mail goes to temp file or temp named pipe*.  The running
zope is tickled via http: with the name of the file/pipe, and
processes it from there.

*By temp named pipe I mean each mail would need a unique pipe name.
I think if I try to use a single named pipe I may have trouble if
multiple emails go down it around the same time.

4. Deliver the email to the running zope via some other protocol,
e.g., ftp.

I'm not sure how to set this up.

--

I welcome comments on these approaches, or others that are even
better!

Also, I would like the approach to be reasonably secure.

Thanks.

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


Re: [Zope-dev] How to trigger Zope externally (mail)

2003-03-07 Thread Ross Boylan
On Wed, Feb 26, 2003 at 05:37:17PM -0800, Andy McKay wrote:
 Or just write a simple HTTP post using Python. Have a look around for 
 the MailIn Product, or CMFMailIn which does this very simply and works 
 fine for low volume traffic (eg: fine listening to [EMAIL PROTECTED]).

Thanks.  I borrowed from CMFMailIn; I couldn't find the MailIn product.

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