[Zope-dev] DataSkinAddons: Fix for CatalogTrigger for ZPatterns-0-4-3b1

2000-10-24 Thread Steve Alexander

John Eikenberry wrote:
> 
> The new ZPatterns has changed their NamespaceStack from a function to a
> class. It seems it no longer needs the REQUEST object to be passed to it
> manually. Simply removing the self.REQUEST from the call to NamespaceStack
> has kept it from throwing an exception, though I haven't tested it
> thoroughly.
> 
> The change is on line 83 of CatalogTrigger.py:
> 
> From...
> t = NamespaceStack(self.REQUEST)
> To...
> t = NamespaceStack()
> 
> You've probably fixed this already if you've switched to the new ZPatterns,
> just thought I'd drop you a quick note anyways.


Thanks John. I hadn't yet looked to see if DataSkinAddons needs changing
much.

Your fix looks just fine, and I'll include it in a new release soon. If
you find any other problems using DataSkinAddons with the new ZPatterns,
please let me know.

I think the change in ZPatterns is to get rid of some cruft for
supporting both Zope 2.1.x and Zope 2.2.x. Now that ZPatterns only
supports Zope 2.2.x, the code becomes clearer. Unfortunately, this
breaks other products that use ZPatterns intimately.

--
Steve Alexander
Software Engineer
Cat-Box limited
http://www.cat-box.net

___
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: DataSkinAddons: Fix for CatalogTrigger for ZPatterns-0-4-3b1

2000-10-24 Thread Steve Alexander

Steve Alexander wrote:
> 
> Your fix looks just fine, and I'll include it in a new release soon. If
> you find any other problems using DataSkinAddons with the new ZPatterns,
> please let me know.
> 
> I think the change in ZPatterns is to get rid of some cruft for
> supporting both Zope 2.1.x and Zope 2.2.x. Now that ZPatterns only
> supports Zope 2.2.x, the code becomes clearer. Unfortunately, this
> breaks other products that use ZPatterns intimately.

Looking closer, there are other places where DataSkinAddons is using
idioms that are deprecated in the latest release of ZPatterns.

I'll take a careful look at these, and make a new DataSkinAddons release
later today.

--
Steve Alexander
Software Engineer
Cat-Box limited
http://www.cat-box.net

___
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] Using LoginManager with users stored in several Specialists

2000-10-24 Thread Itai Tavor

Hi,

I have two different types of users - Customers and Resellers. Each 
one is stored in a separate ZClass and managed by a separate 
Specialist. I need to be able to authenticate users from both user 
lists, as well as a third group for people working locally on the 
site - Managers, Customer Service, etc.

So I thought I could store a 'LoginProperties' propertysheet in each 
of the two ZClasses, and use a separate UserSource to access each 
one. The local users will be handled by a PersistentUserSource.

My questions are:

- Is this a good idea? It seems better to me than storing all users 
in a PersistentUSerSource (from the Membership product) and mapping 
from it to the Customer and Reseller classes. Each type of user is 
created and managed in different ways so it won't make sense to 
manage all users from one place.

- I'm not sure how to customize a UserSource to access the 
propertysheets on the Customer and Reseller classes. The easiest way 
seems to be to define userExists, userRoles and userAuthenticate 
methods in a GenericUserSource, but I don't think it's a good idea - 
I still wouldn't know how to make changes to the propertysheet from 
the LoginManager (for example, changePassword should be a method of 
acl_users, not of the user classes, because it does the same thing 
for all user types), and there is no caching. Should I write my own 
UserSource? Or can I do it with Data Plug-ins? I'd like to keep the 
solution simple, but I do want it to be efficient (fast and cached).

TIA,

Itai
-- 
Itai Tavor"Je sautille, donc je suis."
C3Works[EMAIL PROTECTED]  - Kermit the Frog

"If you haven't got your health, you haven't got anything"


___
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: Unit testing, ZUnit

2000-10-24 Thread Butch Landingin

--- In [EMAIL PROTECTED], Lalo Martins <[EMAIL PROTECTED]> wrote:

> We first conceived it as a kind of Zope-based version of
> unittestgui.py - you create a "TestRunner" object giving it the
> package, module and name of a TestSuite object generator (see
> the PyUnit documentation) and inside it you may click on some
> widget to run the tests and produce a "TestResult" object which
> you can inspect later. Does this sound like a good design?
> 
> Then I figured in the long run a Product isn't the best
> sollution; instead, fiddling with App/Product* sounds more like
> it, to allow developers to register tests just like they
> register classes, ZClass superclasses, _misc and help. Of
> course, just like the current registerHelp and others, it
> wouldn't be mandatory and not using it wouldn't break anything.
> 
> Then, in the Product's page in the Control Panel, there would
> be a tab "Test", where you'd be allowed to run the unit tests.
> 
> What do people think of this? What does DC think of this? Can I
> go ahead and develop it in this direction?

Kewl. ;^) please do!

I've been test-infected ever since I started using JUnit about 8 months
ago so I know the value of building a unittest framework for Zope.
I even started playing around with PyUnit and integrating it with Zope...

I got to the point where I had a ZPublisher-based framework that allowed me to 
have something like a function that had a relative url as its argument 
and it would return the rendered HTML... I then stored the string
into a file and it would allow me easily build tests that compared the
string output to the one stored in the file...

I was planning to do more (e.g. get to the point where I have a function with
a relative url as its argument which would return me the actual object -- this
would then allow me to run its methods and check its properties, check assertions, 
etc., etc... but then, my "real" work interfered and I had to put my plans in the 
backburner for  a while...(I might get back to this in a month or so, so I'm very 
interested in your project...keep us posted) 

I had envisioned it as something that ran on the commandline (not as a TTW thing) and
the context in which I was using it for was that I would be developing a lot of python
code and that running my test suite on the commandline would return the familiar 
"" 
output that the commandline versions of Junit and PyUnit provide... it would also 
allow me
to run the GUI version without changing any of my unittests... My intention was that
most of the testing would be the testing of the application, so I didnt intend to test
the ZServer part of Zope (I assumed that ZServer would be passing the right URL to the 
ZPublisher)
 -- instead, everything would be run locally and single-threaded...(of course, this 
framework
is limited and can't do the testing of ZServer-related stuff -- e.g. virtual hosting 
stuff 
like ZServer -- but since I was more focused on the 'application', this wasn't such a 
big
deal compared to the benefit of being able to run my tests locally and with the 
flexibility
of running them either thru the commandline or thru a GUI...

So I do have some questions about how you intend the ZUnit to be used... e.g. -- lets 
say I'm
developing a Zope Application... I begin by writing the Python code interface, 
then I start writing the PyUnit test... in the the Setup section, I put in the code 
that hooks
me into the Zope ZODB, installs the product, sets the properties, etc.; in the test 
section, I
can get to the object, test my assertions, etc... and in the TearDown -- I back out my 
changes,
etc... Then I add this test to my Test suite...etc., etc...Then to run this test, 
I...do...what?

Also one coding caveat: when I started building my ZPublisher-based framework, I 
encountered
a bug I couldn't easily solve: I could run my PyUnit tests fine using the commandline
but when I tried to run them via the PyUnit GUI they failed : as far as I could tell,
the GUI version of PyUnit did something esoteric with the "import" function (which
would allow automatic reloading whenever you started it -- allowing you to leave the 
GUI
up all the time and you could modify your python code and it would reload correctly 
(this is equivalent to JUnit's LoadingTestRunner) -- unfortunately, it reacted badly
with Zope's 'esoteric' use of the "import" function as well ;^)...

HTH.

Butch Landingin
[EMAIL PROTECTED]
http://squishdot.org

PS. Sorry for the rambling, its been a while since I last posted to the list and
I wanted to get a lot of things off my chest ;^)


__
Do You Yahoo!?
Yahoo! Messenger - Talk while you surf!  It's FREE.
http://im.yahoo.com/

___
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.or

[Zope-dev] Security requires Acquisition?!

2000-10-24 Thread Chris Withers

Toby Dickenson and Brian Lloyd wrote:

> >> list.append(DisplayClass(name,self))
> 
>list.append(DisplayClass(name,self).__of__(self))
> 

> >
> >> class DisplayClass(Globals.Persistent):
> 
>class DisplayClass(Globals.Persistent, Acquisition.Implicit):

Okay, this did the trick, but I'm not very happy with the result :-(

I don't want the DisplayClass to be acquiring and I don't really see
(from a moral standpoint ;-) why I should need to mix in an Acquisiton
class to make security work :-S

That said, I think Shane said that Zope security is predicated a lot on
Acquisition. Now, can I get the solution I'm looking for by mixing in
Aquisition.Explicit, still have the security stuff work and not have the
DisplayClass acquiring attributes I don't want it do?

cheers,

Chris

___
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] Unit testing, ZUnit

2000-10-24 Thread Simon Coles

>What do people think of this? What does DC think of this? Can I
>go ahead and develop it in this direction?

For our XP endeavors, we've developed a testing framework we call 
SimpleTest, which tests our systems using HTTP requests. Tests are 
written in XML, along the lines of:




   
 This is a very simple tests
 http://my.server.name/somewhere
 
   magicroundabout
   1
 
 
   ... various  blocks to test if the
   returned HTML contains or doesn't contain stuff,
   or the return code was xxx
 
   
   
   ... you can have lots of tests in a test run
   



You can set authentication for a test run, and (crudely) pass 
variables from one test to another.

Tests are stored as XML files and we use CVS to control them.

Our feeling is we will probably need to use PyUnit at some point, but 
for the moment this is serving our needs OK. Using this we have been 
able to unit test most of the bits of the Zope applications we write, 
including where those applications link into other web-accessible 
systems. The framework is written in Python and we've been adding 
bits to it as needed.



Simon
-- 
- My opinions are my own, NIP's opinions are theirs --
Simon J. Coles Email: [EMAIL PROTECTED]
New Information Paradigms  Work Phone: +44 1344 753703
http://www.nipltd.com/ Work Fax:   +44 1344 753742
=== Life is too precious to take seriously ===

___
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 Users in Python

2000-10-24 Thread Andre Schubert

Hi,

I'am using the following code in one of my Products.

obj =
Kunde.Kunde(id=row['name'],modem=row['modem'],db_id=row['id'],adress_id=row['adresse'])

folder = AccessControl.User.UserFolder()
obj._setObject('acl_users', folder)
obj._addRole('Kunde')
rechte = ['Access contents information','View']
for recht in rechte:
p = AccessControl.Permission.Permission(recht, '',
obj)
p.setRole('Kunde', recht in rechte)
obj.acl_users._addUser(name="test", password="passwort",
confirm="passwort", roles=['Kunde'], domains=[''])

I'am adding an obj of the Class Kunde in any Folder. The Class Kunde
should consist of an UserFolder, and has a Role named Kunde with the
Permissions Access contents information and View.
This all works fine, but inside the UserFolder a should should be added
with a name test and the password passwort.

Now the problem is, the user will be added, but the password does not
work. i have added a function test to User.py the returns the password
of the current user object.

def test(self):
   """ doc string """
   return self.__

If i call the function test from a dtml document it returns "passwort"
as the password, but when the browser opens the authentication request
window and i write test as the username and passwort as the password i
get the message returned that the username or password is wrong. But
when i open the user-object in the acl_users and open the user test and
fill in in the password and confirm field the value of "passwort"
everything works fine.
No where is the problem. is it in my _addUser() function or somewhere
else?

Please Help.

as


___
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] Writing my own request-handler

2000-10-24 Thread Thomas Weholt

Hi,

I want to write my own request in Zope. I want a specially formatted 
request or a command to be intercepted and processed by my own modules. If 
the user tries to access a url like
http://www.myserver.org/myhandler or using a specific port on the server 
Zope traps this and my request_handler sends data back to the user based on 
the url .

Why? I got a PostgreSQL database as a backend for a huge information 
organization project. I want to serve xml using a fast and stable solution 
like Zope or Medusa to do this, since I also need ftp for object-uploads, 
allthough these are not stored in ZODB. A normal ftp-server is used, and 
hopefully I could set up a normal medusa kind of ftp-server on a given port 
to do this, and avoid all the files being stuffed into the ZODB. I got a 
lot of non-Linux ( therefore as far as a know, non-postgresql-python users 
) so I want to give them xml to process using a know protocol like HTTP.

How can I write my own class/handler that traps this and serves my data ? I 
really want to use Zope cuz I use it for the rest of the site. I cannot 
serve all the postgresql data using plain zope-database methods cuz I want 
to write several clients in other programming languages that can receive 
and process the xml-format I use. The thing I want isn't xml-served as 
html, it's xml served to non-browser apps using HTML and ZOPE as means of 
delivery.

Of course all of this is to be written in old-fashioned python, no 
Zope-products.

Any hints, tips or guides is highly appreciated. I've looked at the Medusa 
source and found a couple of things that nearly does what I want them too, 
especially in the script_handler_demo-folder, but I'd like to get the whole 
thing into Zope if I could.

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 )




Re: [Zope-dev] Task, Job or Operation?

2000-10-24 Thread mmillikan

Pylet?
Perlet?
Xlet?


___
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] Task, Job or Operation?

2000-10-24 Thread Rik Hoekstra

Some name suggestions

- block has been suggested before

What about

- ZopeCodeBlock


from there:

Internal Python ZopeCodeBlock
External Python ZopeCodeBlock

Internal Perl ZopeCodeBlock

Safe Python ZopeCodeBlock


Alternatively something like

ZopeBrainBlock 

might be considered, though I do not particularly like it

my 2 cents

Rik

___
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] WriteLocking RiskFactors Updated

2000-10-24 Thread Jeffrey P Shell


The WriteLocking RiskFactors artifact has had some new work done on it and
I'm interested in some editorial comments and review before work begins on
Architecture and UseCases.
 

Make any comments you have at:
 


___
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] WriteLocking RiskFactors updated

2000-10-24 Thread Jeffrey P Shell


The WriteLocking RiskFactors artifact has had some new work done on it and
I'm interested in some editorial comments and review before work begins on
Architecture and UseCases.
 

Make any comments you have at:
 

--
Jeffrey P Shell, [EMAIL PROTECTED]
http://www.zope.org/ | http://www.digicool.com/


___
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] Python 2.0 and Zope Status?

2000-10-24 Thread Ty Sarna

In article <[EMAIL PROTECTED]>,
Toby Dickenson  <[EMAIL PROTECTED]> wrote:
> > - Problem with ExtensionClasses and 2.0's circular reference GC.
> >   Can someone elaborate on this? Is configuring python2.0 with
> 
> That used to be a problem with some early cvs release, but it seems to
> have gone away now.

Yep... I tried it before you replied and it seems to work just fine.

> Note that ExtensionClasses do not yet participate in the gc machinery,
> so cycles involving them can still not be collected.

However, Zope code should be fine because that's always been the case :)

> There are several places where Zope is not defending against objects
> which raise an exception inside str(). This has not been a problem up
> to now, but 2.0's unicode objects expose the problem.

But again, not something that should effect existing code (which should
never generate unicode objects)

___
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] extending objectValues() and objectIds() or ?

2000-10-24 Thread Dennis Nichols

I have developed a flock of Python products that have attributes 
'first_date', 'last_date', and 'ok_to_publish' with the intention that 
these attributes will be set by the content managers. Each product also has 
an 'isPublishable' method that returns true if 'ok_to_publish' is true 
_and_ today >= 'first_date' _and_ today <= 'last_date'. This all works fine 
but I find myself writing DTML in many places to retrieve a list of objects 
with objectValues() and then looping over them making yet another list of 
only the objects that are publishable.

What I would really like is an objectValues() and an objectIds() that 
return only publishable objects/ids. It looks like this could be easily 
accomplished by {tremble} adding an additional parameter to those two 
routines, say chkPub=None so that I could do a call such as 
objectValues('Poll',1) when I wanted just the publishable Poll items 
returned. However...

1. modifying ObjectManager.py doesn't seem like the best move I've ever 
thought of
2. I'm confused about the ObjectManager internals - can I call my 
isPublishable methods on objects that ObjectManager keeps in its lists? How?

I guess a better question, rather than asking about this one possible 
solution, would be:

How can I extend Zope to give me a list of objects qualified by more than 
just the meta_type?

Guidance gleefully gathered. Thanks!

--
Dennis Nichols
[EMAIL PROTECTED]


___
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] Unique and Contant object IDs

2000-10-24 Thread Ty Sarna

In article <000701c03d28$63f28c00$[EMAIL PROTECTED]>,
Johan Carlsson <[EMAIL PROTECTED]> wrote:
> Hi Zen-guys,
> 
> Is there an unique object ID in the ZODB that remains constant in all times
> through out the life time of the ZODB?
> And if so, where is it created and how do I access it? In other word how do I use it?
> 
> I can vaguely recall seeing something called OID.

You can (from python) access the _p_oid attribute of an object to get
it's OID, but not all that useful. Given an oid, there's no way to get
back to a useful object. I've thought about patching _setObject to store
a "hard" parent pointer, thus making it possible to walk back up the
tree and figure out how to create a properly wrapped version of the
object as it it had been accessed via it's canonical path. There are
complications like mountable storages though.

Unfortunately there are a lot of things that Zope just can't do because
there is no way to get a persistent "ticket" for an object that can be
handed out to some external system, and then later redeemed for the
(properly wrapped) object. Pathnames are not useful, because they don't
last for the object's lifetime.

I haven't tried it, but I'm almost positive the semantics of ZServer's FTP
are a bit wonky because of this. For some other things I'd like to do,
it's a fatal blow.

> I need it to track discussions related to an object, but stored in a
> SQL-database. I been pondering a traversal interface in the "commentable"
> objects, that would give the illusion that the discussion items really are object
> agregated in the "commentable".
> 
> I also guess this could be something ZPatterns could solve in the future?

For this type of use, ZPatterns can easily solve the problem.

One way to do this: Make your objects DataSkins-derived, and set up
SkinScript rules so that when the sql_key property is accessed, a new
key is generated and the object's sql_key is set to it.  Now, anytime
you ask for object.sql_key, you either get one it was assigned
previously (the SkinScript attribute providers are only used if a
persistent attribute can't be found) or a new one is generated and
stored in the (persistent) object for future use. 

Now you can write other SkinScript that keys off of self.sql_key to
provide access and storage of whatever other attributes from/to SQL.

___
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] Unit testing, ZUnit

2000-10-24 Thread Dan L. Pierson

Lalo Martins <[EMAIL PROTECTED]> writes:

> Then I figured in the long run a Product isn't the best
> sollution; instead, fiddling with App/Product* sounds more like
> it, to allow developers to register tests just like they
> register classes, ZClass superclasses, _misc and help. Of
> course, just like the current registerHelp and others, it
> wouldn't be mandatory and not using it wouldn't break anything.
> 
> Then, in the Product's page in the Control Panel, there would
> be a tab "Test", where you'd be allowed to run the unit tests.

I like the idea a lot, but would like to suggest that unit tests ala
PyUnit really have three parts that call for separate treatment.

1. Test environment setup: construct the data structure(s) a test
needs to run against.  This wants to be separate because different
tests can frequently share the same data structures and data structure
setup can be non-trivial in systems like Zope.  Since Zope is a
persistent object space, there would also need to be code to tear down
a test environment.  Let's just lump that in here since it will be
automagically invoked by the unit test facility.

2. Test definition and execution: pretty obvious :-)

3. Test results reporting: a small number (1?) of standard reporters
plus the ability to define and register new reporters.

Given the above, the task of writing most tests would consist of:

1. Select test environment.

2. Select default reporter.  Optionally list which other reporters can
be selected at test execution time?

3. Write and test the test.

4. Register the test so that it appears on the Test page.

Dan Pierson



___
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] Using LoginManager with users stored in several Specialists

2000-10-24 Thread Ty Sarna

In article ,
Itai Tavor  <[EMAIL PROTECTED]> wrote:
> - I'm not sure how to customize a UserSource to access the 
> propertysheets on the Customer and Reseller classes. The easiest way 
> seems to be to define userExists, userRoles and userAuthenticate 
> methods in a GenericUserSource, but I don't think it's a good idea - 
> I still wouldn't know how to make changes to the propertysheet from 
> the LoginManager (for example, changePassword should be a method of 
> acl_users, not of the user classes, because it does the same thing 
> for all user types), and there is no caching. Should I write my own 
> UserSource? Or can I do it with Data Plug-ins? I'd like to keep the 
> solution simple, but I do want it to be efficient (fast and cached).

Generic User Source is basically for people who are familar with GUF and
want some degree of backward compatability. There was also a time where
it was the only choice :-)

Now there is "User Source", which is to LoginManager what Rack is to
Specialist. It's completely general, defaulting to storing things
persistently, but overrideable with SkinScript and the "load from
existence of attribute blah" to do anything you want. It's much more
Generic than Generic User Source, actually :)

Have a look at the SkinScript reference for the "Object Remapping"
example (last one under WITH ...  COMPUTE ...) of how to make a Rack
that retrieves proxyies for objects from a different Specialist. You
can direcly apply this same technique to have a User Source provide
users based on objects in other Specialists.

___
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] Migrating from ZClasses to Python Products

2000-10-24 Thread Jason Spisak

And now the big question...

How do you migrate and existing application from ZClasses to Python
products?  I've got about 50,000 objects.  Can it be done or am I stuck
with ZClasses?

Hopefully,

Jason Spisak
CIO
HireTechs.com
6151 West Century Boulevard
Suite 900
Los Angeles, CA 90045
P. 310.665.3444
F. 310.665.3544

Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email
address may not be added to any commercial mail list with out my
permission.  Violation of my privacy with advertising or SPAM will
result in a suit for a MINIMUM of $500 damages/incident, $1500 for
repeats.

___
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] Unique and Contant object IDs

2000-10-24 Thread Johan Carlsson

> > 
> > Is there an unique object ID in the ZODB that remains constant in all times
> > through out the life time of the ZODB?
> > And if so, where is it created and how do I access it? In other word how do I use 
>it?
> > 
> > I can vaguely recall seeing something called OID.
> 
> You can (from python) access the _p_oid attribute of an object to get
> it's OID, but not all that useful. Given an oid, there's no way to get
> back to a useful object. I've thought about patching _setObject to store
> a "hard" parent pointer, thus making it possible to walk back up the
> tree and figure out how to create a properly wrapped version of the
> object as it it had been accessed via it's canonical path. There are
> complications like mountable storages though.
> 
> Unfortunately there are a lot of things that Zope just can't do because
> there is no way to get a persistent "ticket" for an object that can be
> handed out to some external system, and then later redeemed for the
> (properly wrapped) object. Pathnames are not useful, because they don't
> last for the object's lifetime.
> 
> I haven't tried it, but I'm almost positive the semantics of ZServer's FTP
> are a bit wonky because of this. For some other things I'd like to do,
> it's a fatal blow.
> 
Thanks Ty,
It really works for what I intend to do (at the moment anyway).

> > I need it to track discussions related to an object, but stored in a
> > SQL-database. I been pondering a traversal interface in the "commentable"
> > objects, that would give the illusion that the discussion items really are object
> > agregated in the "commentable".
> > 
> > I also guess this could be something ZPatterns could solve in the future?
> 
> For this type of use, ZPatterns can easily solve the problem.
> 
> One way to do this: Make your objects DataSkins-derived, and set up
> SkinScript rules so that when the sql_key property is accessed, a new
> key is generated and the object's sql_key is set to it.  Now, anytime
> you ask for object.sql_key, you either get one it was assigned
> previously (the SkinScript attribute providers are only used if a
> persistent attribute can't be found) or a new one is generated and
> stored in the (persistent) object for future use. 
> 
> Now you can write other SkinScript that keys off of self.sql_key to
> provide access and storage of whatever other attributes from/to SQL.

I was think more in the line of ObjectAttributes aggregated in a DataPlugin
(which in it's turn could use a RDBS for persistent storage).
The reason why I really want this is for letting write intensive persistent objects.
I'm not sure if this solve the problem but it one idea I been thinking about.

Regards,
Johan Carlsson






___
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] extending objectValues() and objectIds() or ?

2000-10-24 Thread Itamar Shtull-Trauring

Write a Python Method (install the PythonMethods product first) called say,
publishableObjectValues that does that:

self

# functions that returns publishable objects
result = []
for o in self.objectValues():
   if o.isPublishable(): result.append(o)
return result

-- 
Itamar S.T.  [EMAIL PROTECTED]
Fingerprint = D365 7BE8 B81E 2B18 6534  025E D0E7 92DB E441 411C

___
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] Writing my own request-handler

2000-10-24 Thread Andy McKay

http://www.zope.org/Members/4am/SiteAccess2

Site Access handles the incoming request and fiddles with it. Whilst this
isnt what you want, looking at the source might give you some ideas.

- Original Message -
From: "Thomas Weholt" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, October 24, 2000 6:10 AM
Subject: [Zope-dev] Writing my own request-handler


> Hi,
>
> I want to write my own request in Zope. I want a specially formatted
> request or a command to be intercepted and processed by my own modules. If
> the user tries to access a url like
> http://www.myserver.org/myhandler or using a specific port on the server
> Zope traps this and my request_handler sends data back to the user based
on
> the url .
>
> Why? I got a PostgreSQL database as a backend for a huge information
> organization project. I want to serve xml using a fast and stable solution
> like Zope or Medusa to do this, since I also need ftp for object-uploads,
> allthough these are not stored in ZODB. A normal ftp-server is used, and
> hopefully I could set up a normal medusa kind of ftp-server on a given
port
> to do this, and avoid all the files being stuffed into the ZODB. I got a
> lot of non-Linux ( therefore as far as a know, non-postgresql-python users
> ) so I want to give them xml to process using a know protocol like HTTP.
>
> How can I write my own class/handler that traps this and serves my data ?
I
> really want to use Zope cuz I use it for the rest of the site. I cannot
> serve all the postgresql data using plain zope-database methods cuz I want
> to write several clients in other programming languages that can receive
> and process the xml-format I use. The thing I want isn't xml-served as
> html, it's xml served to non-browser apps using HTML and ZOPE as means of
> delivery.
>
> Of course all of this is to be written in old-fashioned python, no
> Zope-products.
>
> Any hints, tips or guides is highly appreciated. I've looked at the Medusa
> source and found a couple of things that nearly does what I want them too,
> especially in the script_handler_demo-folder, but I'd like to get the
whole
> thing into Zope if I could.
>
> 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] Large file support

2000-10-24 Thread seant

I have been building an "ExternalFile" class which stores the body of
the file in an external file, mirroring the Zope path/hierarchy.  This
will allow easy integration with servers that can mount the external
representation of the content and serve it with a consistent namespace.

To make life zimple, I tried to move all file manipulation to Zope,
including upload/download/copy/cut/paste/delete and permissions.  These
external files are transaction aware, blah blah..

Working with files > 20MB I notices some serious performance/scalability
issues and investigated.  Here are the results.

A diff with my changes against version 2.2.2 is available at



Concerns:

Zope objects like File require data as a seekable file or as a
coherent block, rather than as a stream.  Initializing/updating
these objects *may* require loading the entire file into memory.

In memory buffering of request or response data could cause
excessive swapping of the working set.

Multi-service architecture (ZServer->ZPublisher) could limit the
reuse of stream handles.

Creating temporary files as FIFOs buffers between the services
causes signficant swapping.


Modifications:

Using pipes I found that FTPServer.ContentCollector was using a
StringIO to buffer the uploads from FTP clients.  I changed this
into a TemporaryFile for a while which revealed the leaked file
descriptor bug (see below).  This intermediary temp file caused 1
extra file copy for each request.  The goal is to not have any
intermediary files at all, and pipeline the content directly into
the Zope objects.

To remove this FTP upload file buffer, I converted the FTP collector
again from a TemporaryFile into a pipe with a reader and writer file
objects.  The FTPRequest receives the reader from which it can
process the input on the publish thread in processInputs.

Since we are dealing with blocking pipes it is OK to have a reader
on the publish thread and a writer on the ZServer thread.  The major
considerations were regarding the proper way to read from a pipe
through the chain of control, especially in cgi.FieldStorage.

Stdin is treated as the reader of the pipe throughout the code.  All
seek()s and tell()s on sys.stdin type objects (a tty not a seekable
file) should be considered illegal and removed.


Usage of FieldStorage from FTP (Unknown content-length)

To gain access to the body of a request, one typically calls
REQUEST['BODY'] or REQUEST['BODYFILE'].  This returns the file
object the FieldStorage copied from stdin.

To prevent FieldStorage from copying the file from stdin to a
temporary file, we can set the CONTENT_LENGTH header to '0' in the
FTP _get_env for a STOR.

In this case, FieldStorage creates a temporary file but doesn't read
any data from stdin so we can return stdin directly when BODYFILE is
requested and 'content-length' is '0'.  However, BODYFILE could be a
pipe which doesn't support 'seek' or 'tell'.  The code used to suck
the data off the BODYFILE needs to be modified to adapt to the
possibly of being passed a pipe.


Updating Image.File to play with pipes

The _read_data method of Image.File pulls the data out of the
BODYFILE and sticks it in the instance as a string, pdata object, or
a linked list of pdata objects.  The existing code reads and builds
the list in one clean sweep back-to-front.  I belive this keeps the
pdata.data chunks out of memory, quickly (sub)committing then
deactivating (_p_changed = None) them.

Since we can no longer safely assume 'seek' is valid for BODYFILE, I
tried to read and build the list front-to-back.  This kept the data
in memory, even though I tried to deactivate the objects quickly. 

As a tradeoff, I read the data front-to-back then built the list
back-to-front taking another pass to reverse the list so it is in
the correct order.

Memory usage appears to be steady, meaning the whole file is not
loaded into the working set.  This also prevents unecessary reading
into a temporary FieldStorage file during an FTP upload.


Web based uploads...

...suck.  I do not recommend doing a web based upload for files 
> 1mb.  First, a content-length is known, so we don't get the
advantage of pipelining the data directly from the socket, a
temporary file must be created, written and read.  Second, I believe
the content is encoded so the transferred bitcount is much higher
than using FTP.

Plus, most browsers today do not support a progress bar 

Re: [Zope-dev] Unique and Contant object IDs

2000-10-24 Thread Steve Waterbury

Ty Sarna wrote:

> Unfortunately there are a lot of things that Zope just can't do because
> there is no way to get a persistent "ticket" for an object that can be
> handed out to some external system, and then later redeemed for the
> (properly wrapped) object. Pathnames are not useful, because they don't
> last for the object's lifetime.

Hmmm ... what you describe sounds a lot like an ILU "string 
binding handle" -- see

http://www-db.stanford.edu/~testbed/ilu/ilu20doc/manual_1.html#SEC10

ILU does have a Python binding, and I've been thinking that ILU 
and Zope might have a lot of potential if used together ... it 
could make Zope "multi-lingual"  :^)  Has anyone thought of 
doing anything with the two together?  

Cheers,
-- Steve.

   oo _\o
\/\ \
  /
 oo _
"Sometime you're the windshield; sometime you're the bug."
- Knopfler

Stephen C. Waterbury   Component Technologies
Code 562, NASA/GSFC  and Radiation Effects Branch
Greenbelt, MD 20771   Engineering Web/Database Specialist
Tel: 301-286-7557  FAX:  301-286-1695
WWW:  http://misspiggy.gsfc.nasa.gov/people/waterbug.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] Migrating from ZClasses to Python Products

2000-10-24 Thread Andy McKay

> And now the big question...
>
> How do you migrate and existing application from ZClasses to Python
> products?  I've got about 50,000 objects.  Can it be done or am I stuck
> with ZClasses?

Well the number of objects doesnt really matter, but migrating it from
ZClass to Python - Ive never heard of that happening. It would be a cool
project though.

> Hopefully,
>
> Jason Spisak
> CIO
> HireTechs.com
> 6151 West Century Boulevard
> Suite 900
> Los Angeles, CA 90045
> P. 310.665.3444
> F. 310.665.3544
>
> Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email
> address may not be added to any commercial mail list with out my
> permission.  Violation of my privacy with advertising or SPAM will
> result in a suit for a MINIMUM of $500 damages/incident, $1500 for
> repeats.
>
> ___
> 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 )




Re: [Zope-dev] Migrating from ZClasses to Python Products

2000-10-24 Thread Jason Spisak

Andy McKay writes:

Cool Project...
That means I'm screwed. :)

> > And now the big question...
> >
> > How do you migrate and existing application from ZClasses to Python
> > products?  I've got about 50,000 objects.  Can it be done or am I stuck
> > with ZClasses?
> 
> Well the number of objects doesnt really matter, but migrating it from
> ZClass to Python - Ive never heard of that happening. It would be a cool
> project though.
> 
> > Hopefully,
> >
> > Jason Spisak
> > CIO
> > HireTechs.com
> > 6151 West Century Boulevard
> > Suite 900
> > Los Angeles, CA 90045
> > P. 310.665.3444
> > F. 310.665.3544
> >
> > Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email
> > address may not be added to any commercial mail list with out my
> > permission.  Violation of my privacy with advertising or SPAM will
> > result in a suit for a MINIMUM of $500 damages/incident, $1500 for
> > repeats.
> >
> > ___
> > 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 )
> >
> 


Jason Spisak
CIO
HireTechs.com
6151 West Century Boulevard
Suite 900
Los Angeles, CA 90045
P. 310.665.3444
F. 310.665.3544

Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email
address may not be added to any commercial mail list with out my
permission.  Violation of my privacy with advertising or SPAM will
result in a suit for a MINIMUM of $500 damages/incident, $1500 for
repeats.

___
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] Migrating from ZClasses to Python Products

2000-10-24 Thread Shane Hathaway

Jason Spisak wrote:
> > > And now the big question...
> > >
> > > How do you migrate and existing application from ZClasses to Python
> > > products?  I've got about 50,000 objects.  Can it be done or am I stuck
> > > with ZClasses?
> >
> > Andy McKay writes:
> >
> > Well the number of objects doesnt really matter, but migrating it from
> > ZClass to Python - Ive never heard of that happening. It would be a cool
> > project though.

The hard part (which probably isn't very hard after all :-) ) is writing
the product that performs the same function as the ZClass. Once that's
done, a fifteen-line external method (that doesn't use any special
voodoo) can convert all instances.

Shane

___
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] Migrating from ZClasses to Python Products

2000-10-24 Thread Jason Spisak

Shane:

> Jason Spisak wrote:
> > > > And now the big question...
> > > >
> > > > How do you migrate and existing application from ZClasses to Python
> > > > products?  I've got about 50,000 objects.  Can it be done or am I stuck
> > > > with ZClasses?
> > >
> > > Andy McKay writes:
> > >
> > > Well the number of objects doesnt really matter, but migrating it from
> > > ZClass to Python - Ive never heard of that happening. It would be a cool
> > > project though.
> 
> The hard part (which probably isn't very hard after all :-) ) is writing
> the product that performs the same function as the ZClass. Once that's
> done, a fifteen-line external method (that doesn't use any special
> voodoo) can convert all instances.
> 
> Shane


Perhaps what I should do is just get the data out, and create new instances
all via an external method.  The migration isn't really a 1 for 1
situation. I am trying to address shortcomings like not having a
"dictionary" type property in Zope properties, etc.. So the implementation
will be different anyway.  I guess an export to XML gives me all the data
in the objects, right?  Then I could use that as a map to construct new
instances in a different implementation.


Thanks for all the answers,

Jason

___
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] Getting all objects matching a given meta_type and more

2000-10-24 Thread Morten W. Petersen

I've managed using the ZCatalog now.  However, I have a small problem:

When I instansiate a ZCatalog at the root of a tree, and search
for all objects matching a given meta-type, all the objects in
the entire tree are returned.

Is there a way to instruct the ZCatalog instance that it should only
return objects from within a certin part of the tree, without instansiating
a new ZCatalog instance in the given subtree?

I.e.:

Zope

Catalog (meta-type ZCatalog)

Folder1

Folder2

Object1 (meta-type test)

Folder3

Object2 (meta-type test)

Folder4

Object3 (meta-type test)

FolderA

FolderB

ObjectA (meta-type test)

FolderC

ObjectB (meta-type test)

FolderD

ObjectC (meta-type test)


Now, is there a way I can tell the ZCatalog instance at the root
folder to only return the objects mathing meta-type test in
thee FolderA folder?

Thanks in advance.

-Morten

___
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] DataSkinAddons 0-0-2 released

2000-10-24 Thread Steve Alexander

DataSkinAddons 0-0-2

http://www.zope.org/Members/stevea/DataSkinAddons

Changes:

DataSkinAddons 0-0-2, 24 October 2000

DataSkinAddons 0-0-2 works with ZPatterns-0-4-3b1 and Zope 2.2 only

Various changes to CatalogTrigger to bring it in line with the
new Expressions module from ZPatters 0-4-3b1, and to tidy up some
cruft.
Thanks to John Eikenberry for contributing to this.

Note that CatalogTrigger does not cause a ZPatterns transaction to
abort, but instead logs an error, if an object cannot be catalogued
or uncatalogued. In some cases, this may be wrong behaviour.
Some checkboxes might appear for this in the next release of
DataSkinAddons. Until then, use SkinScript if you want to abort
the transaction if there is a problem cataloguing or uncataloguing.

--
Steve Alexander
Software Engineer
Cat-Box limited
http://www.cat-box.net

___
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] Getting all objects matching a given meta_type and more

2000-10-24 Thread Steve Alexander

Morten W. Petersen wrote:

> I've managed using the ZCatalog now.  However, I have a small problem:
> 
> When I instansiate a ZCatalog at the root of a tree, and search
> for all objects matching a given meta-type, all the objects in
> the entire tree are returned.
> 
> Is there a way to instruct the ZCatalog instance that it should only
> return objects from within a certin part of the tree, without instansiating
> a new ZCatalog instance in the given subtree?

Yes.

Create a keyword index in your catalog called "path_kw_for_catalog".

Create an external method called "path_kw_for_catalog" that, for an 
object, returns a list of strings that uniquely represent the physical 
path to that object, and to each of its parents by containment.

Create an external method "path_kw" that, for an object, returns a 
string that uniquely represents the physical path to that object.

Then, query your catalog using that keyword index, and the results 
path_kw for the path you want results from under.

As an example, path_kw_for_catalog might return

   ['foo_bar_baz', 'foo_bar', 'foo']

for an object at http://your.server.net/foo/bar/baz

In the same example, path_kw would return 'foo_bar' for the object at 
http://your.server.net/foo/bar


I don't know whether you can use the results of 
string.join(getPhysicalPath(), '/') as a keyword in a KeywordIndex in a 
ZCatalog. In the following methods, I'm assuming that you can't. They 
can be simplified if it turns out you can.

I'm also assuming that space characters are bad in keyword indexes. 
Again, I might be completely wrong. I guess I should check.

Anyhow, these methods should give you the general idea:

from string import join, replace

def kw_path_for_catalog(self):
 keywords=[]
 pp=self.getPhysicalPath()
 for p in range(2, len(pp)+1):
 keywords=keywords+[join(map(fix_bad_chars, pp[1:p]), '_')]
 return keywords

def kw_path(self):
 return join(map(fix_bad_chars, self.getPhysicalPath()[1:]), '_')

def fix_bad_chars(s):
 return replace(s, ' ', 'x')

--
Steve Alexander
Software Engineer
Cat-Box limited
http://www.cat-box.net



___
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] Migrating from ZClasses to Python Products

2000-10-24 Thread Jason Spisak

Brett Carter writes:

The only problem I am dealing with is size.
What kind of a transaction will that be?
Huge, no doubt.

I would run out of space to buffer it.  Does Zope do subtransactions now,
or is that still just the ZCatalog?

Also, I am running on stock RH6.2 linux and to double my ZODB puts me near
the 2 gig file limit.  Not as much of a concern as a pain in my neck.  Is
it faster to modify my installation to allow > 2GB or create from
xml/export?

Jason
> 
> It should be Really Easy (TM) to write an external method that grabs
> the data from your zclasses, and then creates a new instance of your
> python object with the zclass data.  It's just a big for loop.
> -Brett
> 
> > "Jason" == Jason Spisak <[EMAIL PROTECTED]> writes:
> 
> Jason> Shane:
> >> Jason Spisak wrote:
> >> > > > And now the big question...
> >> > > >
> >> > > > How do you migrate and existing application from ZClasses to Python
> >> > > > products?  I've got about 50,000 objects.  Can it be done or am I stuck
> >> > > > with ZClasses?
> >> > >
> >> > > Andy McKay writes:
> >> > >
> >> > > Well the number of objects doesnt really matter, but migrating it from
> >> > > ZClass to Python - Ive never heard of that happening. It would be a cool
> >> > > project though.
> >> 
> >> The hard part (which probably isn't very hard after all :-) ) is writing
> >> the product that performs the same function as the ZClass. Once that's
> >> done, a fifteen-line external method (that doesn't use any special
> >> voodoo) can convert all instances.
> >> 
> >> Shane
> 
> 
> Jason> Perhaps what I should do is just get the data out, and create new 
>instances
> Jason> all via an external method.  The migration isn't really a 1 for 1
> Jason> situation. I am trying to address shortcomings like not having a
> Jason> "dictionary" type property in Zope properties, etc.. So the implementation
> Jason> will be different anyway.  I guess an export to XML gives me all the data
> Jason> in the objects, right?  Then I could use that as a map to construct new
> Jason> instances in a different implementation.
> 
> 
> Jason> Thanks for all the answers,
> 
> Jason> Jason
> 
> Jason> ___
> Jason> Zope-Dev maillist  -  [EMAIL PROTECTED]
> Jason> http://lists.zope.org/mailman/listinfo/zope-dev
> Jason> **  No cross posts or HTML encoding!  **
> Jason> (Related lists - 
> Jason>  http://lists.zope.org/mailman/listinfo/zope-announce
> Jason>  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 )




Re: [Zope-dev] Migrating from ZClasses to Python Products

2000-10-24 Thread Ender

Jason Spisak wrote:
> 
> The only problem I am dealing with is size.
> What kind of a transaction will that be?
> Huge, no doubt.
> 
> I would run out of space to buffer it.  Does Zope do subtransactions now,
> or is that still just the ZCatalog?

zope has done subtransactions for a while, i'm not sure if this predates
zcatalog or not ( i assume'd it does).

just call get_transaction.commit(1) to save work. and call 
get_tranaction.commit() when you're done. i'm in the process of writing
an advanced transaction how-to which will hopefully give some more
enlightenment on this process, but i've been busy with work so i don't
expect to have it public for another week.

> Also, I am running on stock RH6.2 linux and to double my ZODB puts me near
> the 2 gig file limit.  Not as much of a concern as a pain in my neck.  Is
> it faster to modify my installation to allow > 2GB or create from
> xml/export?

you could create the python product instances in a mounted db.

Kapil

> Jason
> >
> > It should be Really Easy (TM) to write an external method that grabs
> > the data from your zclasses, and then creates a new instance of your
> > python object with the zclass data.  It's just a big for loop.
> > -Brett
> >
> > > "Jason" == Jason Spisak <[EMAIL PROTECTED]> writes:
> >
> > Jason> Shane:
> > >> Jason Spisak wrote:
> > >> > > > And now the big question...
> > >> > > >
> > >> > > > How do you migrate and existing application from ZClasses to Python
> > >> > > > products?  I've got about 50,000 objects.  Can it be done or am I 
>stuck
> > >> > > > with ZClasses?
> > >> > >
> > >> > > Andy McKay writes:
> > >> > >
> > >> > > Well the number of objects doesnt really matter, but migrating it from
> > >> > > ZClass to Python - Ive never heard of that happening. It would be a cool
> > >> > > project though.
> > >>
> > >> The hard part (which probably isn't very hard after all :-) ) is writing
> > >> the product that performs the same function as the ZClass. Once that's
> > >> done, a fifteen-line external method (that doesn't use any special
> > >> voodoo) can convert all instances.
> > >>
> > >> Shane
> >
> >
> > Jason> Perhaps what I should do is just get the data out, and create new 
>instances
> > Jason> all via an external method.  The migration isn't really a 1 for 1
> > Jason> situation. I am trying to address shortcomings like not having a
> > Jason> "dictionary" type property in Zope properties, etc.. So the 
>implementation
> > Jason> will be different anyway.  I guess an export to XML gives me all the 
>data
> > Jason> in the objects, right?  Then I could use that as a map to construct new
> > Jason> instances in a different implementation.
> >
> >
> > Jason> Thanks for all the answers,
> >
> > Jason> Jason
> >
> > Jason> ___
> > Jason> Zope-Dev maillist  -  [EMAIL PROTECTED]
> > Jason> http://lists.zope.org/mailman/listinfo/zope-dev
> > Jason> **  No cross posts or HTML encoding!  **
> > Jason> (Related lists -
> > Jason>  http://lists.zope.org/mailman/listinfo/zope-announce
> > Jason>  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 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: Using LoginManager with users stored in several Specialists

2000-10-24 Thread Itai Tavor

Ty Sarna <[EMAIL PROTECTED]> wrote:

>Itai Tavor  <[EMAIL PROTECTED]> wrote:
>>  - I'm not sure how to customize a UserSource to access the
>>  propertysheets on the Customer and Reseller classes. The easiest way
>>  seems to be to define userExists, userRoles and userAuthenticate
>>  methods in a GenericUserSource, but I don't think it's a good idea -
>>  I still wouldn't know how to make changes to the propertysheet from
>>  the LoginManager (for example, changePassword should be a method of
>>  acl_users, not of the user classes, because it does the same thing
>>  for all user types), and there is no caching. Should I write my own
>>  UserSource? Or can I do it with Data Plug-ins? I'd like to keep the
>>  solution simple, but I do want it to be efficient (fast and cached).
>
>Generic User Source is basically for people who are familar with GUF and
>want some degree of backward compatability. There was also a time where
>it was the only choice :-)
>
>Now there is "User Source", which is to LoginManager what Rack is to
>Specialist. It's completely general, defaulting to storing things
>persistently, but overrideable with SkinScript and the "load from
>existence of attribute blah" to do anything you want. It's much more
>Generic than Generic User Source, actually :)
>
>Have a look at the SkinScript reference for the "Object Remapping"
>example (last one under WITH ...  COMPUTE ...) of how to make a Rack
>that retrieves proxyies for objects from a different Specialist. You
>can direcly apply this same technique to have a User Source provide
>users based on objects in other Specialists.

I guess I still don't understand enough about object remapping... I 
got a CustomerUserSource with this SkinScript:

 WITH Customers.getCustomerByName(self.id) COMPUTE login_name, 
password, roles, original_object=RESULT

NOTE: I use getCustomerByName rather than getItem because I use 
auto-generated codes for the customer objects id's, this lets me 
allow users to change their login name - but it means that finding a 
user is a more expensive operation than getItem, which is another 
reason I worry about speed and caching.

Now I need to set the 'loaded by accessing attribute' bit, because 
the UserSource has no persistent items in it, right? What do I set it 
to? I tried to set it to 'id' but it does nothing - 
CustomerUserSource.getItem(some_user) always returns None. Also, if a 
Rack is using object remapping, can I still use 
getPersistentItemIDs() on it?
-- 
Itai Tavor"Je sautille, donc je suis."
C3Works[EMAIL PROTECTED]  - Kermit the Frog

"If you haven't got your health, you haven't got anything"


___
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: Unit testing, ZUnit

2000-10-24 Thread Lalo Martins

On Tue, Oct 24, 2000 at 04:35:58AM -0700, Butch Landingin wrote:
> 
> So I do have some questions about how you intend the ZUnit to be used... e.g. -- 
>lets say I'm
> developing a Zope Application... I begin by writing the Python code interface, 
> then I start writing the PyUnit test... in the the Setup section, I put in the code 
>that hooks
> me into the Zope ZODB, installs the product, sets the properties, etc.; in the test 
>section, I
> can get to the object, test my assertions, etc... and in the TearDown -- I back out 
>my changes,
> etc... Then I add this test to my Test suite...etc., etc...Then to run this test, 
>I...do...what?


Well, I imagine it like this:

Setup:
  You create an object in the ZODB and set properties etc

Test:
  Make the assertions

Teardown:
  Only necessary if you make other unrelated changes, because
ideally ZUnit would already discard your objects after the
test is run

In your Product, you would (like usual with PyUnit) implement a
function (in the place of your choosing) which returns a
newly-allocated TestSuite. Let's call this the "creator
function".

As for your question, how do you run it, this is exactly the
difference between the two ZUnit sub-proposals.

ZUnit Product:

  You create a TestRunner object somewhere (anywhere) in your
ZODB. One of its properties, "suite", is the full Python
module/object path of the creator function.

When you click "run the tests" in the TestRunner, it creates
an instance of TestResults, which runs the tests and
accumulates the results; clicking on it later will format the
results for you.

ZUnit mods to the Product-related classes:

  On your Product's __init__, you give the creator function as
the argument of a new function context.registerTests.

Then on the Product object in the Control Panel, there will
be a new tab "Unit test" or something. Clicking on it will
give you a list of existing TestResults objects and a button
to run the tests and create a new TestResults (more or less
the same semantics as the TestRunner, but on the Control Panel).

The big difference is (creating the TestRunner in an arbitrary
location in the ZODB then setting the name of the creator
function) versus (passing the creator function on Product
initialization and running in the Control Panel).

[]s,
   |alo
   +
--
  Hack and Roll  ( http://www.hackandroll.org )
News for, uh, whatever it is that we are.


http://zope.gf.com.br/lalo   mailto:[EMAIL PROTECTED]
 pgp key: http://zope.gf.com.br/lalo/pessoal/pgp

Brazil of Darkness (RPG)--- http://zope.gf.com.br/BroDar

___
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: Security requires Acquisition?!

2000-10-24 Thread Toby Dickenson

> Okay, this did the trick, but I'm not very happy with the result :-(
> 
> I don't want the DisplayClass to be acquiring and I don't really see
> (from a moral standpoint ;-) why I should need to mix in an Acquisiton
> class to make security work :-S

I suspect that was a rhetorical question, but ill answer anyway.

Zope security is context based: Users can be defined in a subfolder and only
have access under that folder, they can also be given local roles for a
given folder. The role:permission mapping is set per-folder. Any security
aware object needs to know its context.

> That said, I think Shane said that Zope security is 
> predicated a lot on
> Acquisition. Now, can I get the solution I'm looking for by mixing in
> Aquisition.Explicit, still have the security stuff work and 
> not have the
> DisplayClass acquiring attributes I don't want it do?

Yes, you will need to set Acquisition.Acquired for the necessary attributes.

Alternatively there may be other ways of avoiding an object using some
specific acquired attributes: I often define an index_html=None to avoid a
class using its container's default view.

Wanting to make an object non-acquiring may be a danger-sign of some other
problems. If the correctness of your program depends on the absence of
certain attributes (acquired or otherwise) then you need to take extra care
over PropertyManager-like features, which might allow a user to add the
critical attribute.

hth,



___
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] Unique and Contant object IDs

2000-10-24 Thread Toby Dickenson

On 24 Oct 2000 15:14:24 GMT, [EMAIL PROTECTED] (Ty Sarna) wrote:

>Unfortunately there are a lot of things that Zope just can't do because
>there is no way to get a persistent "ticket" for an object that can be
>handed out to some external system, and then later redeemed for the
>(properly wrapped) object. Pathnames are not useful, because they don't
>last for the object's lifetime.

How come? because you want the identity to remain unchanged even after
the object is moved? or duplicated?

Toby Dickenson
[EMAIL PROTECTED]

___
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] ZGDChart product...

2000-10-24 Thread zope

Hi.

This is really a great product.

Unfortunately, I'm not able to create a chart with multiple columns using a 
ZSQL Data Method.
Multiple columns with a DTML-Method works fine.

Do I miss something. Any ideas?

Thanks for any help. Regards, Marc Ludwig ([EMAIL PROTECTED])


___
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: [Zope] The Great Python (and Perl) Method Renaming Poll

2000-10-24 Thread Michael Bernstein

Michel Pelletier wrote:
> 
> We will be conducting a community poll to decide what to call Python
> (Perl, insert your language here) Methods.
> [snip]
> So, before the poll, we are calling for nominiations from the
> community.  Please send me an email containing one or more candidate
> names.  These names will be added to the list.  No pre-screening will be
> done, so please exercise some discretion if your favorite name is more
> tounge-in-cheek than practical (you never know what the masses will
> decide though!).
> 
> Later this week, I will create a web poll where you can vote for your
> favorite.

I would like to suggest that instead of a plurality vote, we
use a 'Borda count', also known as an 'preferential' or
'single-transferable' ballot. Those of you who followed the
recent ICANN election should be familiar with it.

It works like this:

All votes consist of ranking the availble choices according
to desireability (if there are six choices, you would number
them 1-6, each choice must be uniquely ranked, not all
choices must be ranked).

All voters first choices are tallied. If, at this point, one
choice has achieved over 50% of the vote, the vote is over.

If no choice has achieved 50%, the choice with the fewest
votes is removed, and the voters who voted for that choice
have their second choice counted and distributed. If at this
point one of the choices acheives 50%...etc. Lather, Rinse,
Repeat.

This method has the advantage of better representing peoples
true choice, since no one is tempted to vote for a choice
that they simply disapprove of less, because 'otherwise
they're throwing away their vote'.

In a five-way race for example, a plurality may consist of
25% of the vote, thereby ensuring that 75% of the voters
will be pissed off. With a Borda count though, the winner
could be everyone's second-favorite choice, thus better
representing what people want.

There's a few other wrinkles to this, such as situatuions
where not all choices have been ranked. If a voter has only
ranked four choices and a fifth runoff phase is neccessary,
their ballot is discarded, and the 50% mark is recalculated
for that phase to account for the reduced number of ballots.

Cheers,

Michael Bernstein.

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