Re: [Zope] ODBC database adapter for zope2.8.1 on windows

2005-10-11 Thread Johan Carlsson

Andreas Jung wrote:

google for mxodbc

--On 10. Oktober 2005 16:37:45 +0530 Sreekanth S Rameshaiah 
[EMAIL PROTECTED] wrote:



Dear Friends,
Is there any good ODBC database adapter for zope2.8.1 on windows?
Thanks and Regards,
 - sree


Is there any free ODBC DA?
(Not necessary rock-solid-good, rather free.)

I didn't find any open source based while searching for one last week.

Regards,
Johan

--
Johan Carlsson  Tel: + 46 8 31 24 94
Colliberty  Mob: + 46 70 558 25 24
Torsgatan 72Email: [EMAIL PROTECTED]
SE-113 37 STOCKHOLM

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] DirectoryStorage on Windows and MacOSX HFS+

2005-04-13 Thread Johan Carlsson
Is there anyone who have tried DirectoryStorage on Windows NTFS or 
MacOSX HFS+?

I'm going to try both, got a compiled readdir.dll module
if anybody's intressed in tring it on Windows.
(I'm not sure if it's necessary in the Windows release,
the documentation isn't clear about that.)
Regards,
Johan
--
Johan Carlsson  Tel: + 46 8 31 24 94
Colliberty  Mob: + 46 70 558 25 24
Torsgatan 72Email: [EMAIL PROTECTED]
SE-113 37 STOCKHOLM
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope-dev] serving BLOBs

2004-10-11 Thread Johan Carlsson
Alan Milligan wrote:
Hi,
I know serving large BLOBs is rather frowned up using Z2, but I have a
requirement to use the zope security machinery prior to serving a blob
circa 500Mb.
I thought I'd just wrap it in an ExternalFile and it would simply stream
to the client.  In fact I was even anticipating taking advantage of
chunked transfer encoding for HTTP1.1 clients.
However, I'm getting out of memory exceptions thrown by the server.
This would indicate that no intermediate buffer flushing is occuring at 
all!

What am I missing?
I've looked at the code of the latest release of ExternalFile
and I can't find the new streming interface being used at all?
I'm also intrested in this, but I haven't had the time to as
anyone about it, yet.
Regards,
Johan
PS. I'm cc:ing [EMAIL PROTECTED] because I think this is more of
an user issue.
--
Johan Carlsson  Tel: + 46 8 31 24 94
Colliberty  Mob: + 46 70 558 25 24
Torsgatan 72Email: [EMAIL PROTECTED]
SE-113 37 STOCKHOLM
___
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] Re: serving BLOBs

2004-10-11 Thread Johan Carlsson
What exactly is the filestream_iterator that the FileCacheManager uses?
As I understand it this is a new feature?
Johan
--
Johan Carlsson  Tel: + 46 8 31 24 94
Colliberty  Mob: + 46 70 558 25 24
Torsgatan 72Email: [EMAIL PROTECTED]
SE-113 37 STOCKHOLM
___
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] Re: serving BLOBs

2004-10-11 Thread Johan Carlsson
Johan Carlsson wrote:
What exactly is the filestream_iterator that the FileCacheManager uses?
As I understand it this is a new feature?
Of course the answer was in Chris' presentation you just sent :-)
--
Johan Carlsson  Tel: + 46 8 31 24 94
Colliberty  Mob: + 46 70 558 25 24
Torsgatan 72Email: [EMAIL PROTECTED]
SE-113 37 STOCKHOLM
___
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] Re: serving BLOBs

2004-10-11 Thread Johan Carlsson
Tres Seaver wrote:
Johan Carlsson wrote:
What exactly is the filestream_iterator that the FileCacheManager uses?
As I understand it this is a new feature?

For Zope = 2.7.2, ZPublisher defines an interface, 
ZPublisher.Iterators.IStreamIterator.  An application can return an 
object implementing this interface to the publisher, instead of a 
string;  if so, the publisher hands it directly to medusa, and frees up 
the application thread / database connection.  medusa will use the 
iterator to send the response back to the user, without first converting 
it to a single big string.
That's actually brilliant.
If I understand ExternalFile could benefit from using the 
IStreamIterator interface instead of RESPONSE.write?
For instance, for someone that don't want to store blobs
in the database temporarily :-)

Johan
--
Johan Carlsson  Tel: + 46 8 31 24 94
Colliberty  Mob: + 46 70 558 25 24
Torsgatan 72Email: [EMAIL PROTECTED]
SE-113 37 STOCKHOLM
___
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] NOT operator in Unindex.

2004-09-23 Thread Johan Carlsson
Andreas Jung wrote:
Why don't you use AdvancedQuery+ManageableIndes by DM?
Sure. Why would that be preferred?
And is there any chance of AdvancedQuery+ManageableIndes will
make it to the Zope Core?
My exampel extends Field- and KeywordIndex and any other index
based on Unindex without changing backward compatability.
I don't see a reason why this couldn't be included to the
Zope Core in a short term.
Regards,
Johan Carlsson
--
Johan Carlsson  Tel: + 46 8 31 24 94
Colliberty  Mob: + 46 70 558 25 24
Torsgatan 72Email: [EMAIL PROTECTED]
SE-113 37 STOCKHOLM
___
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 )


[Zope-dev] Multi-part export files

2004-09-22 Thread Johan Carlsson
Hi Y'all,
I have currently implemented a object repository which
uses dynamic Acquisition wrapping to create an illusion
of a object hierarchy.
This means that sub object isn't contained in there parents
rather in the repository and this effectively breaks export/import
behavior and other behavior that rely in it such as CopySupport.
After doing some testing I've noticed that I can stack
export files in the same file by just keeping the file
open between the calls to exportFile (and the same for importFile).
In this way I could stack a number of export files in one file
(this could be used to export a set of object in a Folder in one
file so it might be useful for Zope Core as well).
Now the problem is that the import has no way to know where
to create the object, in my case I can let the repository
handle this using meta data in the objects. The repository
has a fixed structure, but in regular OFS the structure might
vary from system to system. It could be used to import all
object to the current folder, if name collision are taken care of.
Any thought on this?
Anybody done something remotely similar?
Could this be a useful feature in Zope core someway?
Best Regards,
Johan Carlsson

--
Johan Carlsson  Tel: + 46 8 31 24 94
Colliberty  Mob: + 46 70 558 25 24
Torsgatan 72Email: [EMAIL PROTECTED]
SE-113 37 STOCKHOLM
___
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 )


[Zope-dev] manage_access patch

2004-03-24 Thread Johan Carlsson
Hi,
I've made a patch to manage_access (and 
AccessControl.Role.permission_settings)
that displays the current effective security
setting (something that have been bugging me
for ages).

It also uses a small javascript and disabled
property of the checkboxes (with potential
problems with old browsers that don't support
the disabled property).
So where should I send the patch, I'm not currently
active as a Zope contributor.
Regards,
Johan Carlsson


--
Johan Carlsson  Tel: + 46 8 31 24 94
Colliberty  Mob: + 46 70 558 25 24
Torsgatan 72Email: [EMAIL PROTECTED]
SE-113 37 STOCKHOLM Skype: colliberty


___
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] _.min and _.max still used by ZMI

2004-01-11 Thread Johan Carlsson
Dirk wrote:
Hi Johan,

maybe the patch can fix your problem.
Thanks!



--
Johan Carlsson  Tel: + 46 8 31 24 94
Colliberty  Mob: + 46 70 558 25 24
Torsgatan 72Email: [EMAIL PROTECTED]
SE-113 37 STOCKHOLM Skype: colliberty


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


[Zope-dev] Suggestion for DT_In

2003-07-18 Thread Johan Carlsson


Hi,
I found a small change that can solve a problem with
sort_expr in dtml-in.
There is no way to let the dtml-in not sort when
using sort_expr. This would be a good thing if you
want to be able to choose the default order of
the sequence:
A small patch to DT_In enables the dtml-in to
ignore sorting if the result of the expression is None.
if self.sort_expr is not None:
self.sort=self.sort_expr.eval(md)
-   sequence=self.sort_sequence(sequence, md)
-   elif self.sort is not None:
+   if self.sort is not None:
sequence=self.sort_sequence(sequence, md)
This patch needs to be done in to places:
renderwb and renderwob as far as I can see.
--
Johan Carlsson  Tel: + 46 8 31 24 94
Colliberty  Mob: + 46 70 558 25 24
Torsgatan 72Email: [EMAIL PROTECTED]
SE-113 37 STOCKHOLM


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


[Zope-dev] manage_changePropertyTypes

2003-07-13 Thread Johan Carlsson
Has any work been done on the manage_changePropertyTypes interface of 
the PropertyManager? It's appearently pending community input.

I have found and fixed a couple of bugs.

--
Johan Carlsson  Tel: + 46 8 31 24 94
Colliberty  Mob: + 46 70 558 25 24
Torsgatan 72Email: [EMAIL PROTECTED]
SE-113 37 STOCKHOLM


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


[Zope-dev] Refresh bug revisited

2003-03-25 Thread Johan Carlsson [EasyPublisher]
Now I have a scenario in which I can't get the refresh of a Python Product 
to work.
I have a Product that don't define any addable objects only base classes 
(EasyCore).
I it I have a class EasyObjectLink which inherits from Persistence import 
Persistent.

If I refresh EasyCore Persistent will be None. Because Persistent isn't a 
Product it self
it can't be explicitly added to be refreshed?

I will try to reproduce this in a smaller package (I have a refresh bug 
product I'm tryning to
pin down this problem in).

Best Regards,
Johan Carlsson


--
Easy Publisher Developers Team
Johan Carlsson
[EMAIL PROTECTED]
Mail:
Birkagatan 9
SE-113 36  Stockholm
Sweden
Phone +46-(0)8-32 31 23
Fax +46-(0)8-32 31 83
Mobil +46-(0)70-558 25 24
http://www.easypublisher.com


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


[Zope-dev] Looking for a way to override the export/import of anpersistent object

2002-12-14 Thread Johan Carlsson [EasyPublisher]

Hi,
I'm looking for someway the override the export/import for persistent Zope 
objects.

For instance having an ExtensionClass based class I could override
the the __setstate__/__getstate__ or __reduce__ methods to change
some of the attributes.
This would be useful for serializing objects that stores some parts
in the file system (for instance External Files).

But due to the persistent nature of ZODB these methods doesn't work as usual.

Is this at all possible with the current Zope/ZODB?

Regards,
Johan Carlssons


--
Torped Strategi och Kommunikation AB
Johan Carlsson
[EMAIL PROTECTED]

Mail:
Birkagatan 9
SE-113 36  Stockholm
Sweden

Visit:
Västmannagatan 67, Stockholm, Sweden

Phone +46-(0)8-32 31 23
Fax +46-(0)8-32 31 83
Mobil +46-(0)70-558 25 24
http://www.easypublisher.com
http://www.torped.se



___
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] A tip about 2GB Data.fs issues

2002-10-15 Thread Johan Carlsson [EasyPublisher]

At 22:16 2002-10-15 +0100, Phil Harris said:


On Tue, 15 Oct 2002 14:54:41 -0400
Matthew T. Kromer [EMAIL PROTECTED] wrote:

  Just FYI, the Binary Zope 2.6 betas include a Python 2.1.3 with LFS
  built in,

Does the large file support extend to Win32 systems?

yours hoping-rather-than-expecting-ly

Not until Python 2.2 :-(
But with Python 2.2 it works fine.
The downside is that Zope doesn't support Python 2.2 officially.
Regards,
Johan Carlsson


-- 
Torped Strategi och Kommunikation AB
Johan Carlsson
[EMAIL PROTECTED]

Mail:
Birkagatan 9
SE-113 36  Stockholm
Sweden

Visit:
Västmannagatan 67, Stockholm, Sweden

Phone +46-(0)8-32 31 23
Fax +46-(0)8-32 31 83
Mobil +46-(0)70-558 25 24
http://www.easypublisher.com
http://www.torped.se



___
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] Unix: Vanishing Group Ids associated with Zopeprocess ?

2002-10-11 Thread Johan Carlsson [EasyPublisher]

At 17:48 2002-10-11 +0200, Holger Blasum said:
Hello *,

I observed that under Debian woody, Zope 2.5.1 runs under the
user id 'www-data'.

The python OS command os.getgroups() gives me an empty list when called
from an external method, although I had configured the user 'www-data'
to be the member of several groups.

If, on the other hand, I run python with my user id from the command
line as a normal user, the command os.getgroups () gives me all the
groups am a member of (that's what I expected).

Please enlighten.

The way that Zope changes user under the start up sequence
doesn't change the groups.
I'm not sure if this was due to a bug in earlier Python, but there
might be a fix/more info about this in the mail archives or on zope.org
or even in the collector (haven't check).

Got the same problems a while back trying to execute Qmail
commands with external methods some while ago.

Regards,
Johan Carlsson


-- 
Torped Strategi och Kommunikation AB
Johan Carlsson
[EMAIL PROTECTED]

Mail:
Birkagatan 9
SE-113 36  Stockholm
Sweden

Visit:
Västmannagatan 67, Stockholm, Sweden

Phone +46-(0)8-32 31 23
Fax +46-(0)8-32 31 83
Mobil +46-(0)70-558 25 24
http://www.easypublisher.com
http://www.torped.se



___
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] http://cvs.zope.org/Products/Scheduler vs Xron for cron-like functionality. Advice?

2002-10-06 Thread Johan Carlsson [Torped]

At 20:40 2002-10-05 +0200, Joachim Werner said:
I've noticed that Xcron uses ZPublishers client to trigger events.
This seems a bit out-dated to me, wouldn't it be better to use
restrictedTraverse?

After looking at Xron in more detail and comparing it to the Scheduler stuff
in the Zope CVS, I guess that going the Scheduler way is probably more
promising in the long run. Xron seems to have quite a few major design
flaws. One I haven't mentioned yet is that you can only trigger DTML
methods. In a modern Zope installation, you'd probably want to call Scripts
(Python) more often, though of course you can call everything FROM DTML ..


Yes. I also see at least one pre-built events like a DBPackEvent and 
possibly more.

Events may need to be restricted to only be created in the Scehduler.
Not sure that we need this one. Just an idea that pop by :-)

Regards,
Johan Carlsson



--
Torped Strategi och Kommunikation AB
Johan Carlsson
[EMAIL PROTECTED]

Mail:
Birkagatan 9
SE-113 36  Stockholm
Sweden

Visit:
Västmannagatan 67, Stockholm, Sweden

Phone +46-(0)8-32 31 23
Fax +46-(0)8-32 31 83
Mobil +46-(0)70-558 25 24
http://www.torped.se
http://www.easypublisher.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] http://cvs.zope.org/Products/Scheduler vs Xron for cron-like functionality. Advice?

2002-10-05 Thread Johan Carlsson [Torped]

   The Xron product release is almost a year old,
   but Scheduler seems to be only available via CVS.

   Can anyone comment as to the maturity/stability
   of these products?  Any advice would be much appreciated.

  I can't vouch for either of the products you mentioned, but I've had
  good luck with cron on linux teamed with wget :-)

  There doesn't seem to be much support in Zope for use cases
  where an action is not event driven, ie not a request/response pair.

  *** Vaporware Follows***
  What *I* want, (but haven't written yet) is a product that can do
  continuous low level scraping of legacy data sources and feed this
  data into an RDBMS or the ZODB. A kind of helper daemon. How
  each instance is scheduled would be one of many adjustable per
  instance config options :-) However, assuming that I do get around
  to building this product, I don't know where on the scale between
  ugly hack and elegant, reusable solution it will fall. This will also
  determine whether you ever see it on zope.org :-)
  Adam

Hi All,
I'm interested in starting to maintain Xron, if it has potential to be a
stable products.
 From the code it doesn't seem to do any strange things, but I would
like to know if anybody has experience of using it in a production
environment, or any other experiences and that would recommend not
using it in a production environment.

The central feature I'm interested in is the ability to setup packing
policies inside Zope.
I know many people uses Cron or Scheduler but I like to have one
platform independent solution and preferably inside the Zope process.

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] http://cvs.zope.org/Products/Scheduler vs Xron for cron-like functionality. Advice?

2002-10-05 Thread Johan Carlsson [Torped]

At 11:32 2002-10-05 +0200, Joachim Werner said:
  Hi All,
  I'm interested in starting to maintain Xron, if it has potential to be a
  stable products.
   From the code it doesn't seem to do any strange things, but I would
  like to know if anybody has experience of using it in a production
  environment, or any other experiences and that would recommend not
  using it in a production environment.

We are using it, but there seem to be some problems. One of them is that I
frequently have cases where Xron doesn't reschedule properly (I am using the
improved user interface stuff for Xron, so the bug could also be in there).
What happens is that an event that is scheduled for daily execution at
midnight will not be rescheduled for the next day after it was executed, but
reset to the year 1970, which actually means it is switched off.

The other problem is more obvious, but still it is a major issue: Xron seems
to be incompatible with ZEO at the moment. The reason why is that the Xron
process starts on every ZEO client machine, so everything is executed more
than once. I could think of two policies to get around that, both of which
should be selectable as an option on a per-event base:

- Xron just runs on one server, e.g. the one that is on the fastest machine;
this is useful for cases where you need the events to be executed on the
same machine all the time, e.g. if you want to write stuff to the server's
local file system

Seems like the most sensible to me.
This should be possible to do by splitting the product in two?
The Dispatcher and the Scheduler. The Scheduler gets installed on both
server and clients but the Dispatcher only gets installed on the server that
should run the triggers.

I also would like to have a Dispatch monitor ttw where the thread can be
start and stopped and the log could be read.
Possibly having multiple Dispatcher (for Virtual Hosting situations), which
creates another problem because the Dispatcher is started during
product instanciation there must be a registry of Dispatchers or someway
to start the distributed Dispatcher. For example if the server is restarted.

One potential problem would also be notification of failure.
I belive I've seen a zLOG email notification product what might be useful.


- Xron runs on all servers (i.e. ZEO clients), but on a first come first
serve base, i.e. the server that executes the event first blocks the others
from doing so, too.

This would need some kind of inter-process locking, which I think should be
provided by ZEO. I'm presently not aware of any such services in ZEO?


Another issue is that Xron will use the current virtual host settings when
it executes and reschedules an event. That means that the entries in the
Xron Schedule ZCatalog will have different URLs. In some cases the URL that
is used to execute an event could be important. E.g., we use Apache with
some tricky rewrite rules in front of Zope, and to get around the Apache
server the Zope server has to be called from a different URL.

I've noticed that Xcron uses ZPublishers client to trigger events.
This seems a bit out-dated to me, wouldn't it be better to use 
restrictedTraverse?
Also all events must be given by it's physicalPath, something we learned 
the hard way.
VirtualPath may be translated to PhysicalPaths when needed, something I
think we added to our version of VHM, which we would be happy to share.

Who should the events be run as? To day the are run as Anonymous even though
there are arguments for passing user name and password I can find any in 
the UI.
I think Event should be run as Owner or ProxyRole. But I'm not sure?


I am willing to help with maintaining Xron, especially the part concerning
ZEO, because we really need it ...
Joachim

Excellent! :-)

Best Regards,
Johan Carlsson


-- 
Torped Strategi och Kommunikation AB
Johan Carlsson
[EMAIL PROTECTED]

Mail:
Birkagatan 9
SE-113 36  Stockholm
Sweden

Visit:
Västmannagatan 67, Stockholm, Sweden

Phone +46-(0)8-32 31 23
Fax +46-(0)8-32 31 83
Mobil +46-(0)70-558 25 24
http://www.torped.se
http://www.easypublisher.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] http://cvs.zope.org/Products/Scheduler vs Xron for cron-like functionality. Advice?

2002-10-05 Thread Johan Carlsson [Torped]

At 10:30 2002-10-05 +0200, Jean Jordaan wrote:
  From the code it doesn't seem to do any strange things, but I would
like to know if anybody has experience of using it in a production
environment,

We have seen the following happen a couple of times: we have Reminders,
subclassed from XronDTMLMethod. When a Reminder triggers, it sends
email (using MailHost). When this fails, Xron goes into a spin,
the Reminder retriggering forever, bloating Data.fs with a Gb or more
overnight. We've started looking at the code a couple of times, but
everything looked fine ..

Can't see the reason, yet anyway.

But Client.call of the RPC will always return something correct, even if
the method that is being called fails?

Using Traversal instead, if the call would the Dispatcher would know about it.
A when I should be able to stop the event from triggering, and potentially send
an e-mail to the admin (which must not fail ;-).

I'm trying replacing RPC with restrictedTraverse right now.

I'm not sure if I have a security manage in the context of Dispatcher.
But it works.


Some thoughts:

Now it seems like XcronMethods rely on REQUEST to change timer,
because it needs it to be able to override for ZClasses.
I don't have a REQUEST object, because I'm calling from
the Dispatcher thread.

This is how I think I'm gone solve it.
Split trigger in two separate methods: trigger and reschedule.
This also means if trigger raises an exception, reschedule will not be called
preventing trigger from being called and fail again.

It will still be allowed to override trigger, but reschedule will not be 
allowed.

I think there should be a very narrow bit of code that actually can change
the settings of an event. I got a felling there maybe potential security and
stability problems here. And I'm very concerned about the ZCatalog being
safe here. Is it possible to spoof a catalogObject call from un-secure 
ttw-code?

Also I'm think the trigger time should be changed to a start time and a
recurrent setting. The next event should always be calculated from these
setting, never be written. Which mean an event could be a read only
operation, avoiding unnecessary ZODB bloating.

The recurrent setting should be iCal compatible to be able to use
Xron for managing triggers in a future Calender server, but this is
current not a prioritized feature for me. I think it will happen though
in the future.

Also, a bit of a contradiction to the read-only events above, I think
there is allot of unnecessary blather to the zLOG. I would rather
let the Event keep an history over not critical events.
It could be optional, I still want the Event to keep a volatile history log
to prevent it from being called several times for the same occurrence.
This wouldn't be perfect because volatile attributes are thread specific
but it could prevent the object from going stall.


Best Regards,
Johan Carlsson


-- 
Torped Strategi och Kommunikation AB
Johan Carlsson
[EMAIL PROTECTED]

Mail:
Birkagatan 9
SE-113 36  Stockholm
Sweden

Visit:
Västmannagatan 67, Stockholm, Sweden

Phone +46-(0)8-32 31 23
Fax +46-(0)8-32 31 83
Mobil +46-(0)70-558 25 24
http://www.torped.se
http://www.easypublisher.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] __getattr__ and Acquisition

2002-09-23 Thread Johan Carlsson [Torped]

At 16:29 2002-09-23 +, Florent Guillaume said:
You didn't look a the code I pointed to you. Look at CMFCore/Skinnable
to be precise (not everything is to be used of course).

* In __of__ you store the parent in a volatile attribute,
* in __getattr__ you lookup the volatile attribute

This works as long as your object is not used in several different
acquisition contexts.

Hi Florent,
Would you care to elaborate on that last sentence? :-)
Could you give an example when it wouldn't work?
Best Regards,
Johan Carlsson



-- 
Torped Strategi och Kommunikation AB
Johan Carlsson
[EMAIL PROTECTED]

Mail:
Birkagatan 9
SE-113 36  Stockholm
Sweden

Visit:
Västmannagatan 67, Stockholm, Sweden

Phone +46-(0)8-32 31 23
Fax +46-(0)8-32 31 83
Mobil +46-(0)70-558 25 24
http://www.torped.se
http://www.easypublisher.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 )



[Zope-dev] WebDAV Redirects or overriding IDs duing creation

2002-09-19 Thread Johan Carlsson [Torped]


Hi gurus,
I'll try this question on this list as well (a part form [EMAIL PROTECTED]).

Is it possible to make a redirect during a WebDAV request.
For instance I have a PROPFIND one an object that has been renamed
and I whan the PROPFIND to access the object with the new ID.

I have tried to return a prop result with the information from the renamed 
object,
but the client seems to ignore that (no kidding its MS Web Folder, so what 
did I expect ;-)

Is there a correct way to do this.
What I want to do is for the server to override the requested ID on any 
object or
collection that is being created with something more appropriate
like the created objects/collections meta_type.
MS WebFolders defaults to New Folder for collections.

Best Regards,
Johan Carlsson



-- 
Torped Strategi och Kommunikation AB
Johan Carlsson
[EMAIL PROTECTED]

Mail:
Birkagatan 9
SE-113 36  Stockholm
Sweden

Visit:
Västmannagatan 67, Stockholm, Sweden

Phone +46-(0)8-32 31 23
Fax +46-(0)8-32 31 83
Mobil +46-(0)70-558 25 24
http://www.torped.se
http://www.easypublisher.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] Proxy Object / __getattr__ / Acquisition

2002-08-29 Thread Johan Carlsson [Torped]

At 14:28 2002-08-29 -0700, [EMAIL PROTECTED] said:
I am trying to implement a proxy class (specifically for the purposes of
multi-versioned document objects (folderish proxies that contain the object

Hi Sean,
We've been stealing some code from CMFCore.Skinnable to
do similar things (multi-language objects):
Skinnable gets the skins when the objects is being wrapped (e.g.
in the objects __of__ method) and overrides __getattr__ which
uses the skins or falls back to an unbound superGetAttr method
that points to the inherited __getattr__.
(The superGetAttr have pussled us because it seams like superGetAttr is None,
but everything still work as expected.)

We replace the skin with a VeryTinyDataWrapper which (of course) implements 
Acquisition.Implicit.

Would this work better that the way your doing it?
We currently implementing this so I don't know for sure that it
is faster, but it's from CMF (a key part to) so it shouldn't be to slow or?



 def setupCurrentLanguageData(self):
 #the request part is a rest from Skinnable, I don't think it can 
be removed.
 request=self.request
 #replace this with anything that returns
 lang_code=self.EasyLanguageService.getCurrentLanguage()
 ob = self._current_language.get(lang_code, VerySmallData())
 self._v_c_language = (request, ob, {})

 def __getattr__(self, name, marker=None):
 # OK, see if we can find the language service:
 if not name.startswith('_') and not name.startswith('aq_'):
 cl = self._v_c_language
 if cl is not None:
 request, ob, ignore = cl
 if not ignore.has_key(name):
 subob = getattr(ob, name, _marker)
 if subob is not _marker:
 # Return it in context of self, forgetting
 # its location and acting as if it were located
 # in self.
 return aq_base(subob)
 else:
 ignore[name] = 1
 if superGetAttr is None:
 raise AttributeError, name
 return superGetAttr(self, name)

 def __of__(self, parent):
 '''
 Sneakily sets up the current language then returns the wrapper
 that Acquisition.Implicit.__of__() would return.
 '''
 w_self = ImplicitAcquisitionWrapper(aq_base(self), parent)
 try:
 w_self.setupCurrentLanguageData()
 except:
 # This shouldn't happen, even if the requested current language
 # does not exist.
 import sys
 from zLOG import LOG, ERROR
 LOG('CMFCore', ERROR, 'Unable to setupCurrentLanguageData()',
 error=sys.exc_info())
 return w_self

Regards,
Johan Carlsson


-- 
Torped Strategi och Kommunikation AB
Johan Carlsson
[EMAIL PROTECTED]

Mail:
Birkagatan 9
SE-113 36  Stockholm
Sweden

Visit:
Västmannagatan 67, Stockholm, Sweden

Phone +46-(0)8-32 31 23
Fax +46-(0)8-32 31 83
Mobil +46-(0)70-558 25 24
http://www.torped.se
http://www.easypublisher.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] to __of__ or not to __of__ ?

2002-08-15 Thread Johan Carlsson [Torped]


At 23:38 2002-08-14 -0400, Casey Duncan said:
The Item class mixes in Traversable, which is probably responsible for 
making
this work TTW. It also gives you a bunch of other stuff that many Zope
classes need, like DAV support, copy support, ZMI tab support and security.
It doen't mix-in acquisition tho.

If you need support for acquistion machinery (including __of__ which creates
wrappers), then you need to mix-in Acquisition.Implicit. The SimpleItem 
class
mixes this and Persistence in for you (along with Item), so many Zope 
classes
derive form SimpleItem. You need Persistence to store instances of your 
class
in the ZODB, and implicit acquisition is the standard for Zope objects.

In short I would recommend mixing in SimpleItem or you may find that your
objects are not stored properly in the ZODB.

-Casey


You also might want to wrap the object before returning them,
because the are stored in _item and not in the AixtraTableProduct.

 def getItem(self,key): #{{{
 returns item
 data = self._items
 if data.has_key(key):
 item = self._items[key]
 if not hasattr(item,'key'):
 setattr(item,'key',key)
 return item.__of__(self)  --- wrap the item before returned

Regards,
Johan Carlsson




-- 
Torped Strategi och Kommunikation AB
Johan Carlsson
[EMAIL PROTECTED]

Mail:
Birkagatan 9
SE-113 36  Stockholm
Sweden

Visit:
Västmannagatan 67, Stockholm, Sweden

Phone +46-(0)8-32 31 23
Fax +46-(0)8-32 31 83
Mobil +46-(0)70-558 25 24
http://www.torped.se
http://www.easypublisher.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] PythonWin/Textpad, external import of Zope module and Persistence

2002-08-15 Thread Johan Carlsson [Torped]

At 10:54 2002-08-15 +0100, Chris Withers wrote:
Johan Carlsson [Torped] wrote:
I'm trying to setup to run with either TextPad, which can run external 
program like python scripts
and then parse the result and making Traceback lines linked to the 
line/file where the error occurred.

No sure exactly what you're trying to do here, can you privde more detail?

Well, I solved the problem another way, when I realized that I could parse
the Stupid Log File and make traceback's clickable in that file:

I added a small python script that only gives me the latest stuff in the SLF,
and it works quite nice. Now when I get an error I just press CTRL-1 inside
Textpad and I get the traceback, click on the error rows and it will 
automatically
open the correct file and scroll to the row where the error occured.

For anyone using TextPad on Windows this should quite a time saver.
(I know that I forgot to implement a check for if the SLF has been reseted,
something my Zope start-up script does everytime I restart the server.

http://www.zope.org/Members/johanc/Tips_and_HowTos/textpad_tooltips_howto

It's almost like having a RAD tool for Zope. Well not really, but it's an 
improvement.


It should also be possible to make a small script that takes a input file
with REQUEST information and then make the HTTP request to the development 
server
and return any traceback messages from the reply to TextPad.
(SLF only shows error messages when a product is refreshed, this way it 
should be
possible to retrieve traceback from the running code.

(Interactive debugging has to wait, but in Windows it would be terrific to 
use PythonWin
for the task. But starting Zope from within PythonWin usually has the effect of
PythonWin hangling. I might be because I have a really slow laptop :-)

Or try using Python which has an build in debugger which I like to be 
able to use.
The first problem I encounter in both scenarios is that when a file 
import Globals
which in its turn from Persistence import Persistent, this fails.
Mostly because Persistence is hot patched by ZODB.
Is there any smart way to setup a virtual Zope environment without 
importing Zope
(which mounts the Data.fs) or by importing Zope by in a light way without 
mounting
a storage or just mounting a lights storage.

'import Zope' is the only sane thing I can think you'd want to do. Zope 
has lots of magic that happens when you do that, and unless you do that, 
things won't behave as you expect.
You will need to mount the ZODB, but if you use ZEO then this isn't a 
problem as your webserver can mount the same storage.

I think I have a look at how unit test does this, when I have the time. It 
would probably solve my problems.
Running UnitTest from within TextPad or PythonWin would be a nice way to 
develop thing in.
(Unfortunately I'm not up in speed with writing UnitTests)

Thanks.
Johan

cheers,
Chris

-- 
Torped Strategi och Kommunikation AB
Johan Carlsson
[EMAIL PROTECTED]

Mail:
Birkagatan 9
SE-113 36  Stockholm
Sweden

Visit:
Västmannagatan 67, Stockholm, Sweden

Phone +46-(0)8-32 31 23
Fax +46-(0)8-32 31 83
Mobil +46-(0)70-558 25 24
http://www.torped.se
http://www.easypublisher.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 )



[Zope-dev] PythonWin/Textpad, external import of Zope module andPersistence

2002-08-14 Thread Johan Carlsson [Torped]


Hi,
I'm trying to setup to run with either TextPad, which can run external 
program like python scripts
and then parse the result and making Traceback lines linked to the 
line/file where the error occurred.
Or try using Python which has an build in debugger which I like to be able 
to use.

The first problem I encounter in both scenarios is that when a file import 
Globals
which in its turn from Persistence import Persistent, this fails.
Mostly because Persistence is hot patched by ZODB.
Is there any smart way to setup a virtual Zope environment without 
importing Zope
(which mounts the Data.fs) or by importing Zope by in a light way without 
mounting
a storage or just mounting a lights storage.
The only thing I want to do in this first phase is to be able to make 
syntax/sanity checks.

Regards,
Johan Carlsson


-- 
Torped Strategi och Kommunikation AB
Johan Carlsson
[EMAIL PROTECTED]

Mail:
Birkagatan 9
SE-113 36  Stockholm
Sweden

Visit:
Västmannagatan 67, Stockholm, Sweden

Phone +46-(0)8-32 31 23
Fax +46-(0)8-32 31 83
Mobil +46-(0)70-558 25 24
http://www.torped.se
http://www.easypublisher.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] PythonWin/Textpad, external import of Zope module and Persistence

2002-08-14 Thread Johan Carlsson [Torped]



  The only thing I want to do in this first phase is to be able to make
  syntax/sanity checks.
 

I use something like this for writing and testing external methods, 
having TextPad run the same python zope uses:


Thanks for you tips.

Here's another one I just published on the Zope.org.

Textpad tool for parsing Stupid Log files to make traceback print outs 
clickable

Additional details:
TextPad from Helios Software Solutions (http://textpad.com) is an excellent 
tool for working with Python and Zope-files. Besides support for text 
coloring of common Python and Zope syntaxes it is possible to setup Tools 
that run a program or a script. The output from such a execution can be 
conneced to a RegExp that makes lines hyperlinks to Files and Lines 
according to the output.

http://www.zope.org/Memebers

http://www.zope.org/Members/johanc/Tips_and_HowTos/textpad_tooltips_howto

Regards,
Johan Carlsson


-- 
Torped Strategi och Kommunikation AB
Johan Carlsson
[EMAIL PROTECTED]

Mail:
Birkagatan 9
SE-113 36  Stockholm
Sweden

Visit:
Västmannagatan 67, Stockholm, Sweden

Phone +46-(0)8-32 31 23
Fax +46-(0)8-32 31 83
Mobil +46-(0)70-558 25 24
http://www.torped.se
http://www.easypublisher.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] __record_schema__ of Brains (Was: Record.pyd)

2002-08-11 Thread Johan Carlsson [Torped]

At 21:28 2002-08-10 -0400, Casey Duncan said:
On Saturday 10 August 2002 11:25 am, Johan Carlsson [Torped] wrote:
  Now that I understand how the data tuples are copied to the brain
  I'm not at all sure adding a filter when copying the tuple will optimize
  thing, because of the overhead in the filter process.

This occurs lazily so the savings would be heavily dependant on the
application. For most web apps presenting small batches of records, the
savings in limiting columns returned would be pretty minimal.

But there must be some though implementing Record.pyd i C, but off course
I suppose Record.pyd was first used for ZSQL?

An easy filter would be to let __record_schema__ control which columns to
save, as it works to day __record_schema__  must point on a sequence starting
with 0, so I can't specify indexes into the tuple like this:

__record_schema__= {'hey':12, 'dude': 22}

Maybe this is easy to change in the record.pyd, or I just implement it
in a special brain base class?

After revisited Record.c I realized that the tuple from the catalogs self.data
is stored as a tuple (or as a C-array I suppose?) in a Record or as attributes
depending on what you provide to the constructor.
I suppose coping data to a C-array is much faster than creating
attributes on each brain, but if the array is large and the number attributes
needed to be set is small it might be the other way around.
I have no idea where they would break even.

Maybe I just will settle with having two different brain base classes and use
one that suits the current need.

The general usage is to put a minimal set of columns in metadata, only enough
to create a results page and load the objects in cases where either large,
dynamic or otherwise arbitrary data elements are needed.

Yes, and that is somewhat restricting.
My current applications use several different catalogs to get the
width of the meta_data down. The downside of this approach  is
that I end up with allot of catalogs and that it's a multitude time more
things to do for management, e.g. I must reindex all catalogs instead
of just one.

My primary goals are:
1. Get a general ZCatalog that can be used for all ZCatalog requirement 
(not only site searches),
2. Implement feature that removes the need for external RDBS (for instance
report generation is hard with ZCatalogs because of the lack of 
grouping/statistics).
3. Make ZCatalogs easier to manage, for instance the need of updating 
indexes and meta_data
definitions every time you change your applications data structure is 
annoying, especially at
development time. Objects could tell the ZCatalog which meta_data and 
indexes it wants removing
the need to manually add them. Off course you will need to clean up the 
ZCatalog from time to time.


  (The way that I solved the group/calc part of my project, I don't think
  it will lead to memory bloat. I'm going to implement a LacyGroupMap
  which take an extra parameter (a list of IISet). Each brain created
  in the LacyMap will have methods for calculations directly on the self.data
  in the Catalog. The data it self will not be stored.
  There will most probably be a pre calculate method that calculate all
  variables that are applicable and caches the result.)

Sounds like a pretty good solution. However, I would be hesitant in creating
direct dependancies on the internal Catalog data structures if you can help
it (sometimes you can't though).

I could soften the dependency by providing the catalog with an interface for
calculations and give the brain an reference to the catalog it self and
use the interface on that reference.


  One way to reduce memory consumption in wide Catalogs would be
  to have LacyBrains (vertical lacyness, there might be reasons
  why that would be a bad idea, which I'm not aware of)

That would pretty much require a rewrite of the Catalog as the data 
structures
would need to be completely different. It would introduce significant
database overhead since each metadata field would need to be loaded
individually. I think that would negate whatever performance benefit metadata
might have over simply loading the objects.

I'm not sure that it would be necessary to change the data structure, the 
brain could
use the same method as the LacyMap uses to load the data.
But LacyBrain would need to save all applicable data at once to be efficient.
The different would be that the brain will not fetch any data before the first
attribute has been called. When the first is called all applicable data will
be copied to the attribute according to __record_schema__.

This would probably not be more efficient for regular use of brains, but for
calculated group brains they wouldn't need to store the data at all if
they only used calculated fields.


  Another way would be to have multiple data attributes in the Catalog, like
  tables, and to join the tuples from them with a from table1, table2
  statement.
  In this way it would be possible to control the width

Re: [Zope-dev] __record_schema__ of Brains (Was: Record.pyd)

2002-08-10 Thread Johan Carlsson [Torped]

At 08:59 2002-08-09 -0400, Casey Duncan said:
__record_schema__ is simply a dictionary which maps field names to column
positions (ints) so that the record knows the index of each field in the
record tuples.

See line 154 of Catalog.py to see how it is initialized to the Metadata 
schema
plus a few extra columns for catalog rid and scores.


Hi Casey (and zope-dev),
Thanks!
After some experimenting I realized that :-)

One of the reasons I was because I am thinking about
how to implement a SELECT col1 as 'name', ... type
of feature for ZCatalogs.

I'm not entirely sure it's an good idea to start with,  but
I'm thinking in the line of large ZCatalogs (by large I mean
allot of columns in the self.data structure).
If all columns are copied the brains would grow larger as well
and by selecting explicitly which columns should be copied to
the brain they would be lighter.

Now that I understand how the data tuples are copied to the brain
I'm not at all sure adding a filter when copying the tuple will optimize
thing, because of the overhead in the filter process.

(The way that I solved the group/calc part of my project, I don't think
it will lead to memory bloat. I'm going to implement a LacyGroupMap
which take an extra parameter (a list of IISet). Each brain created
in the LacyMap will have methods for calculations directly on the self.data
in the Catalog. The data it self will not be stored.
There will most probably be a pre calculate method that calculate all
variables that are applicable and caches the result.)

One way to reduce memory consumption in wide Catalogs would be
to have LacyBrains (vertical lacyness, there might be reasons
why that would be a bad idea, which I'm not aware of)

Another way would be to have multiple data attributes in the Catalog, like
tables, and to join the tuples from them with a from table1, table2 
statement.
In this way it would be possible to control the width of the brains.
It would also be possible for the object indexing it self to tell the catalog
in which tables it should store meta data.

There have been some proposals (ObjectHub et al) which I read some
time ago. I didn't feel then that we what I was looking for.
Please tell me if there's been any proposals or discussions regarding this.

Regards,
Johan Carlsson




-- 
Torped Strategi och Kommunikation AB
Johan Carlsson
[EMAIL PROTECTED]

Mail:
Birkagatan 9
SE-113 36  Stockholm
Sweden

Visit:
Västmannagatan 67, Stockholm, Sweden

Phone +46-(0)8-32 31 23
Fax +46-(0)8-32 31 83
Mobil +46-(0)70-558 25 24
http://www.torped.se
http://www.easypublisher.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] NOT in Field and Keyword Indexes

2002-07-06 Thread Johan Carlsson [Torped]

At 11:04 2002-07-06 +0200, Johan Carlsson [Torped] said:

I intend to release my code on zope.org, but first I though I'd write some 
unit tests.

Ok, writing the UnitTest took more time that writing the Index :-)

Here it is any way:

http://www.zope.org/Members/johanc/EasyIndexes

Usage:

Not 'a' in foo:

 record = { 'foo' : { 'query'  : ['a']
, 'operator' : 'not'
}
  }


Not ( 'b' or 'e' ) in foo:

 record = { 'foo' : { 'query'  : ['b','e']
, 'operator' : 'notor'
}
  }


Not ( 'b' and 'e' ) in foo:

 record = { 'foo' : { 'query'  : ['b','e']
, 'operator' : 'notand'
}
  }




-- 
Torped Strategi och Kommunikation AB
Johan Carlsson
[EMAIL PROTECTED]

Mail:
Birkagatan 9
SE-113 36  Stockholm
Sweden

Visit:
Västmannagatan 67, Stockholm, Sweden

Phone +46-(0)8-32 31 23
Fax +46-(0)8-32 31 83
Mobil +46-(0)70-558 25 24
http://www.torped.se
http://www.easypublisher.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 )



[Zope-dev] What happend to sessionapi-prog.stx?

2002-04-27 Thread Johan Carlsson [Torped]


What happend to sessionapi-prog.stx?
I found it in the http://cvs.zope.org/Products/Sessions/help/Attic/

Is there a replacement?

Regards,
Johan


-- 
Torped Strategi och Kommunikation AB
Johan Carlsson
[EMAIL PROTECTED]

Mail:
Birkagatan 9
SE-113 36  Stockholm
Sweden

Visit:
Västmannagatan 67, Stockholm, Sweden

Phone +46-(0)8-32 31 23
Fax +46-(0)8-32 31 83
Mobil +46-(0)70-558 25 24
http://www.torped.se
http://easypublisher.torped.se



___
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] ts_regex in Zope 2.5.1

2002-04-25 Thread Johan Carlsson [Torped]

Hi,

It ts_regex that comes with Zope 2.5.1 seems to rely on regex.
Is re thread safe?

Also, Plugins from ZPatterns uses ts_regex, is there a later version
of Plugins that dones use it?

Thanks in advance,
Johan Carlsson



-- 
Torped Strategi och Kommunikation AB
Johan Carlsson -- [EMAIL PROTECTED]

Birkagatan 9   -- SE-113 36  Stockholm   -- Sweden
Phone +46-(0)8-32 31 23   -- Fax +46-(0)8-32 31 83   -- Mobil +46-(0)70-558 
25 24

http://www.torped.se -- http://easypublisher.torped.se



___
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] range:min bug in ZCatalogs fo Zope 2.3.2

2002-03-25 Thread Johan Carlsson [Torped]

At 05:45 2002-03-22 -0500, Andreas Jung wrote:
BTrees were rewritten in 2.4.0 so I assume you will run into
problems. Please check the release notes for the latest 2.3.X
version if there were some fixes for your problem since 2.3.2.

-aj

Problem solved by replacing BTree with Z 2.5.0 version.

Thanks,
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 )



[Zope-dev] Re: [Zope] range:min bug in ZCatalogs fo Zope 2.3.2

2002-03-22 Thread Johan Carlsson [Torped]

At 06:08 2002-03-21 -0500, you wrote:
Try to reproduce the same problem under 2.5.X.
Or upgrade to 2.5.X.
Andreas

The problem is reproducible in Zope 2.3.2 but doesn't appear in Zope 2.5.0.

What I have tested is a OOBTree with DateTime values (or None) as keys and
IITreeSet or integers as values (as in the case with FieldIndexes).
The OOBTrees items method gets called with one argument (a DateTime)
resulting in a list of sets containing items with keys larger than the passed
DateTime value.
When tested on Zope 2.3.2 some dates result in a empty list.

So, upgrading our software to 2.5.0 would take some time and I need
a quick fix. Would it be possible to run the BTree code from
Zope 2.5.0 in Zope 2.3.2?

Best Regards,
Johan Carlsson





  Hi,
  I have encountered a strange problem with ZCatalogs in Zope 2.3.2.
 
  We have objects having DateTime arguments effective_date and
expiration_date
  that gets indexed in different ZCatalogs. (The index is a field index).
 
  We then tries to get all published objects that have not yet been
archived:
 
  now=_.DateTime()
  Service.searchResults(
   effective_date =now, effective_date_usage='range:max'
   , expiration_date =now, expiration_date_usage='range:min'
  )
 
 
  Now this works fine, until one day when result searchResults returns an
  empty result list
  which is not expected.
  It seems to be that some days the range:min statement doesn't work
correctly.
  (I tried with different range:* combinations and the only thing I found
not
  working
  is the range:min statement (some days).
 
  If I instead use a different value for now:
 
  now2 = _.DateTime(now.Date())  # now.Date()  returns somethong like
  2002/03/21 which in turn makes the now2 equal to the DateTime value
  2002/03/21 00:00:000 GMT+1 (GMT+1 is my local TimeZone)
 
  Now using now2 in:
 
  Service.searchResults(
   effective_date =now, effective_date_usage='range:max'
   , expiration_date =now2, expiration_date_usage='range:min'
  )
 
  will always result in a list (all though it gets quantized to midnight the
  resulting list will be somewhat biased).
 
  What I don't seem to understand is that DateTime() and
  DateTime(DateTime().Date) gets so different results.
 
  Have anyone seen something like this before?
 
  Best Regards,
  Johan Carlsson
 
 
 
 
  --
  Johan Carlsson, Torped AB
 
  http://www.torped.se -- http://easypublisher.torped.se
 
 
  ___
  Zope maillist  -  [EMAIL PROTECTED]
  http://lists.zope.org/mailman/listinfo/zope
  **   No cross posts or HTML encoding!  **
  (Related lists -
   http://lists.zope.org/mailman/listinfo/zope-announce
   http://lists.zope.org/mailman/listinfo/zope-dev )
 


___
Zope-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] range:min bug in ZCatalogs fo Zope 2.3.2

2002-03-22 Thread Johan Carlsson [Torped]

At 05:45 2002-03-22 -0500, you wrote:
BTrees were rewritten in 2.4.0 so I assume you will run into
problems. Please check the release notes for the latest 2.3.X
version if there were some fixes for your problem since 2.3.2.

-aj



The interface seems to be equal with the old one?

Comparing the Components/BTree folder there doesn't seem to be
an enormous amount of changes.
Has it been rewritten or has it only been fixed?
Reading the Change files from 2.4.0 and forth indicates 3 bug fixes related 
to BTree?
It seems to be possible to compile the BTree extention module and just 
replace that.
Are there any don't thats I should be where of? Like changes in python 
extensions
between Python 1.5.2 and Python 2.1.2?

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 )



[Zope-dev] range:min bug in ZCatalogs fo Zope 2.3.2

2002-03-21 Thread Johan Carlsson [Torped]

Hi,
I have encountered a strange problem with ZCatalogs in Zope 2.3.2.

We have objects having DateTime arguments effective_date and expiration_date
that gets indexed in different ZCatalogs. (The index is a field index).

We then tries to get all published objects that have not yet been archived:

now=_.DateTime()
Service.searchResults(
 effective_date =now, effective_date_usage='range:max'
 , expiration_date =now, expiration_date_usage='range:min'
)


Now this works fine, until one day when result searchResults returns an 
empty result list
which is not expected.
It seems to be that some days the range:min statement doesn't work correctly.
(I tried with different range:* combinations and the only thing I found not 
working
is the range:min statement (some days).

If I instead use a different value for now:

now2 = _.DateTime(now.Date())  # now.Date()  returns somethong like 
2002/03/21 which in turn makes the now2 equal to the DateTime value 
2002/03/21 00:00:000 GMT+1 (GMT+1 is my local TimeZone)

Now using now2 in:

Service.searchResults(
 effective_date =now, effective_date_usage='range:max'
 , expiration_date =now2, expiration_date_usage='range:min'
)

will always result in a list (all though it gets quantized to midnight the 
resulting list will be somewhat biased).

What I don't seem to understand is that DateTime() and 
DateTime(DateTime().Date) gets so different results.

Have anyone seen something like this before?

Best Regards,
Johan Carlsson




-- 
Johan Carlsson, Torped AB

http://www.torped.se -- http://easypublisher.torped.se


___
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] The future of ZPatterns and LoginManager

2002-03-10 Thread Johan Carlsson [Torped]

Hi everybody,
(I did ask this question to the ZPatterns list, but without any answer. So 
I hope one better luck here.)

I finally got the opportunity to use ZPatterns in a project
and am quite please with the result (after the mandatory wrestling :)
Anyway, I would like to use both ZPatterns again, as well as LoginManager,
but I feel somewhat of a doubt what they will be around in the future and 
in Zope 3.
So, are they?
Or what I really want to know, is it safe to base my applications on ZP 
and/or LM or is it
something I'm going to regret?
Best Regards,
Johan Carlsson




torped strategi och kommunikation ab
johan carlsson
[EMAIL PROTECTED]
birkagatan 9
113 36 stockholm
västmannagatan 67
http://www.torped.se
http://easypublisher.torped.se


___
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] unrestrictedTraverse unable to access the root object

2001-11-09 Thread Johan Carlsson [Torped]

Hi all,
The collector seems to still be offline?

I just realized that the unrestrictedTraverse returns self
for the empty-string url: ''
I did expect it to return the root object because the empty-string
is equal to the path tuple ('',).

Is there any reason for the current behaviour?
Does anybody know any bad things that might happen if I
change this behaviour?

Best 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] RFC: Date property requiers valid date (no more)

2001-10-07 Thread Johan Carlsson [Torped]

 Johan -
 
 I have done a similiar hotfix by using None - which I think is a
 better alternative than ''.
 
 If you want to see all of the source, download the following Product,
 http://www.zope.org/Members/natsukashi/Products/CMFPropertyCore, and
 look inside the file CMFPropertyCore/LinkPropertyManager.py
 

Thanks Joseph,
Great input.
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 )



[Zope-dev] RFC: Date property requiers valid date (no more)

2001-10-03 Thread Johan Carlsson

Hi,
We currently want to use date-properties in the regular property sheet.
The current date-property doesn't accept an empty value.
We want to be able to submit an empty string and set a NullDate value
indicating. Also a NullDate value should return an empty string when the
manage_propertiesForm is rendered, e.g. showing an empty field.

We have currently chosen a empty string , to represent the NullDate value.
(We haven't found any NullDate representation in DateTime and have concluded
that it doesn't exist?)
Choosing None as the NullDate value would have been preferred but it
generates
issues with the rendering of  manage_propertiesForm.


Question:

Is there anything better then an empty string for the NullDate value?

Best Regards,
Johan Carlsson
www.torped.se


[Here's our hot-patch]

from ZPublisher import Converters

def fixedfield2date(v):
print Fixed field2date conversion, fixedfield2date, v
from DateTime import DateTime
if hasattr(v,'read'): v=v.read()
else: v=str(v)
if v=='':
   return v
return DateTime(v)

Converters.field2date = fixedfield2date
Converters.type_converters['date'] = fixedfield2date

print ZPublisher.Converters.field2date patched.




___
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] Page Templates: Any plan how to use PT's for I18n and browser dependant templates etc?

2001-04-03 Thread Johan Carlsson

  How would this effect the page cooking and template cache?
 Cooking isn't affected.  You would naturally want to make your cache
 sensitive to the same REQUEST parameters as the switching script.

Hm. ok.
 
  PS. Page Templates are great but I have yet to figure out
  how to use them with the "Content is folderish" pattern.
 
 You can acquire a template into a content folder, then use "here/" paths to
 access bits of content.  Is that the sort of thing you mean?

You mean like having a "global" index_html template and
tal:content="here/my_content" to get the content?
That would probably work.

Now comes the tricky thing, case I want to render with the tal tags
intact. I just tested that and they are intact after render. Jippi!

The next step I want to do is to save the template back to Zope
and extract some of the tal:content tags and save them back to 
my_content.

I noticed that I can access the macros of a METAL template
after its been cooked (or used anyway). 
Is there anyway to parse a TAL template to extract part form it,
preferably from Python?

TIA/Johan

PS. All this is for my IEMethod product which would benefit 
enormously from TAL


___
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] Page Templates: Any plan how to use PT's for I18n and browser dependant templates etc?

2001-04-03 Thread Johan Carlsson

 From: "Johan Carlsson" [EMAIL PROTECTED]
  Now comes the tricky thing, case I want to render with the tal tags
  intact. I just tested that and they are intact after render. Jippi!
 
 This will be optional in ZPT 1.1, most likely.
 
  The next step I want to do is to save the template back to Zope
  and extract some of the tal:content tags and save them back to
  my_content.
 
 Wha?  You want to parse out the rendered contents of some tags and save
 them?  Will the user be editing the rendered page somehow?

Yes. With the DHTML Editing Component I can turn element
in to editable by setting the contenteditable property while
setting all non editable elements to unselectable (to not 
mess with the current selection while using the UI).
 
  I noticed that I can access the macros of a METAL template
  after its been cooked (or used anyway).
  Is there anyway to parse a TAL template to extract part form it,
  preferably from Python?
 
 You could use the same code that TAL itself does, I guess.  What are you
 trying to accomplish?

A WYSIWYG editor in IE5.5 based on DHTML Editing Component.

Regards,
Johan, whos apperently sleeping with the devil


___
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] Page Templates and nested templates

2001-04-02 Thread Johan Carlsson

 There's a Tracker linked from the main ZPT Wiki page.  You should be able to
 add it there.  On the other hand, I'd like to know how exactly you've tried
 to nest macros, and how it failed for you.
 
 Cheers,
 
 Evan @ digicool  4-am
 

Here is an examples:


ID: here/master

html xmlns:tal="http://xml.zope.org/namespaces/tal"
  xmlns:metal="http://xml.zope.org/namespaces/metal"
  metal:define-macro="master"
   head metal:define-macro="head"
 title tal:content="here/title"sss title/title
 meta something=""
   /head
   body bgcolor="#ff" metal:define-macro="body"
 div metal:define-macro="bodymacro"
   h1This is a macro 21/h1
 /div
 div metal:define-slot="bodySlot"
   h1This is a H1 Header/h1
 /div
   /body
/html





Now notice this if I state use-macro for the METAL statement
in the HTML-tag, all subsequent metal:define-macro statements
gets replaced with the use-macro="here/master/macros/master"

ID: here/Page1 (version1)

html xmlns:tal="http://xml.zope.org/namespaces/tal" 
xmlns:metal="http://xml.zope.org/namespaces/metal"
   head metal:use-macro="here/master/macros/head"
 title tal:content="here/title"sss title/title
 meta something=""
   /head
   body bgcolor="#ff"
 metal:use-macro="here/master/macros/body"
 div metal:use-macro="here/master/macros/body"
   h1This is a macro 21/h1
 /div
 div metal:define-slot="bodySlot"
   h1This is a H1 Header/h1
 /div
   /body
/html


But if I instead apply the use-macro on the body and the head
this are working perfectly, subsequent define-macros in the inner
div gets turned in to use-macro="here/master/macros/body" though.

ID: here/Page1  (version2)

html xmlns:tal="http://xml.zope.org/namespaces/tal" 
xmlns:metal="http://xml.zope.org/namespaces/metal"
   head metal:use-macro="here/master/macros/head"
 title tal:content="here/title"sss title/title
 meta something=""
   /head
   body bgcolor="#ff"
 metal:use-macro="here/master/macros/body"
 div metal:use-macro="here/master/macros/body"
   h1This is a macro 21/h1
 /div
 div metal:define-slot="bodySlot"
   h1This is a H1 Header/h1
 /div
   /body
/html

 
How I would want it to work is that if a higher level
of macro is set to use-macro the subsequent level 
would remain unchanged (e.g. as define-macro) until
I explicitly change it in to use-macro. 
I would then be able to set it to any macro definition,
e.g. use-macro="here/master/macros/bodymacro" or
use-macro="some other path/macros/some other macro" etc.

I think what would make allot of sense and that's probably how it 
supposed to work, right?

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



[Zope-dev] Page Templates: Any plan how to use PT's for I18n and browser dependant templates etc?

2001-04-02 Thread Johan Carlsson

Hi,
Are there any plan for how Page Templates would
handle Internationalization and browser dependent templates.

As fas as I can see the METAL definitions are inside the template.
That would mean one would some external service to route it
to the correct template.

For instance:

use-macro="portalskins/macros/useme"

portalskin in this case would return a template based
on the HTTP_USER_AGENT, REQUEST.portal_skin and 
HTTP_ACCEPT_LANGUAGE (and others of course).

How would this effect the page cooking and template cache?

TIA/Johan

PS. Page Templates are great but I have yet to figure out
how to use them with the "Content is folderish" pattern.



___
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] Page Templates and nested templates

2001-04-01 Thread Johan Carlsson

After playing with Page Templates I have one question/idee.

Would it be completely stupid to be able to nest Macros.
That is, you would have one MainMacroTemplate defining
several Slots/SubMacros and then make several SubMacrosTemplates
that inherents from the MainMacroTemplate, defining the Slots/SubMacros
as new Macro definitions.
This would give you an hierarcy of templates and make it possible
to factor out common stuff higher up in the hierarcy and leaving the
sub templates to handle specialisation.


Just my 25-ren,
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] Saving attributes for a DataSkin

2001-03-09 Thread Johan Carlsson

 
 Hi Johan,
 
Could you give a more complete traceback? It's hard to tell
 from just the error type.. 
 
 thanks!
 -steve

Of course, here it comes.
Regards,
Johan

Traceback (innermost last):
  File /bigshare/zopeservers/Zope-2.3.0-src/lib/python/ZPublisher/Publish.py, line 
222, in publish_module
  File /bigshare/zopeservers/Zope-2.3.0-src/lib/python/ZPublisher/Publish.py, line 
187, in publish
  File /bigshare/zopeservers/Zope-2.3.0-src/lib/python/Zope/__init__.py, line 221, in 
zpublisher_exception_hook
(Object: ProviderContainer)
  File /bigshare/zopeservers/Zope-2.3.0-src/lib/python/ZPublisher/Publish.py, line 
171, in publish
  File /bigshare/zopeservers/Zope-2.3.0-src/lib/python/ZPublisher/mapply.py, line 160, 
in mapply
(Object: changeUser)
  File /bigshare/zopeservers/Zope-2.3.0-src/lib/python/ZPublisher/Publish.py, line 
112, in call_object
(Object: changeUser)
  File /bigshare/zopeservers/Zope-2.3.0-src/lib/python/Shared/DC/Scripts/Bindings.py, 
line 324, in __call__
(Object: changeUser)
  File /bigshare/zopeservers/Zope-2.3.0-src/lib/python/Shared/DC/Scripts/Bindings.py, 
line 353, in _bindAndExec
(Object: changeUser)
  File 
/bigshare/zopeservers/Zope-2.3.0-src/lib/python/Products/PythonScripts/PythonScript.py,
 line 330, in _exec
(Object: changeUser)
(Info: ({'script': PythonScript instance at 8a1ffc8, 'context': LoginManager 
instance at 89d56e8, 'container': LoginManager instance at 89d56e8, 'self': 
TemplateDict object at 8a1e948, 'traverse_subpath': []}, ('a', 'a', 'a', 'a', 'a'), 
{}, None))
  File Script (Python), line 3, in changeUser
  File 
/bigshare/zopeservers/Zope-2.3.0-src/lib/python/Products/PythonScripts/zbytecodehacks/VSExec.py,
 line 429, in __setattr__
TypeError: (see above)




  "JC" == Johan Carlsson [EMAIL PROTECTED] writes:
 
 JC Hi, I'm having some trouble figuring out how to write a method
 JC and a skinscript to save attributes of a DataSkin.
 
 JC Specialist is the LoginManager.
 
 JC DataSkin is:
 
 JC class EasyGroupUser(LoginUser): ...  def getRoles(self): ...
 JC def getDomains(self): ...  def authenticate(self, password,
 JC request): ...
 
 JC SkinScripts are: WITH QUERY sql_getUserFor(username=self.id)
 JC COMPUTE username, password, challenge_question,
 JC challenge_answer, admin_email
 
 JC WHEN OBJECT CHANGED STORE password, challenge_question,
 JC challenge_answer, admin_email USING sql_changeUser(
 JC username=self.id, newpassword=password,
 JC challenge_question=challenge_question,
 JC challenge_answer=challenge_answer, admin_email=admin_email,
 JC oldpassword=OLD['oldpassword'] ) SAVING oldpassword = password
 
 JC Current Attribute Handling: admin_email Getters: SkinScript,
 JC line 1 Setters: SkinScript, line 10 Deleters: SkinScript, line
 JC 10 challenge_answer Getters: SkinScript, line 1 Setters:
 JC SkinScript, line 10 Deleters: SkinScript, line 10
 JC challenge_question Getters: SkinScript, line 1 Setters:
 JC SkinScript, line 10 Deleters: SkinScript, line 10 password
 JC Getters: SkinScript, line 1 Setters: SkinScript, line 10
 JC Deleters: SkinScript, line 10
 
 
 JC The getter works alright, but when trying to set attributes
 JC (that supposedly would be handle by the setter) with the
 JC following Script (Python) I get the following error:
 
 JC ## Script (Python) "changeUser" ##bind container=container
 JC ##bind context=context ##bind namespace=self ##bind
 JC script=script ##bind subpath=traverse_subpath
 JC 
##parameters=username,password,challenge_question,challenge_answer,admin_email
 JC ##title= ## user = context.getItem(username)
 JC user.password=password
 JC user.challenge_question=challenge_question
 JC user.challenge_answer=challenge_answer
 JC user.admin_email=admin_email
 
 JC ERROR MESSAGE: Error Type: TypeError Error Value:
 JC attribute-less object (assign or del)
 
 JC So what am I doing wrong here?  Any clues appreciated.
 JC TIA/Johan Carlsson
 
 
 
 JC ___ Zope-Dev
 JC maillist - [EMAIL PROTECTED]
 JC http://lists.zope.org/mailman/listinfo/zope-dev ** No cross
 JC posts or HTML encoding!  ** (Related lists -
 JC http://lists.zope.org/mailman/listinfo/zope-announce
 JC 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] FYI. I've removed my Base64 MIME encoding

2001-03-07 Thread Johan Carlsson

FYI. 
I've removed my Base64 MIME encoding.
Thanks to Dieter for alerting me to the problem.

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 )



[Zope-dev] Saving attributes for a DataSkin

2001-03-07 Thread Johan Carlsson

Hi,
I'm having some trouble figuring out how to write a method
and a skinscript to save attributes of a DataSkin.

Specialist is the LoginManager.

DataSkin is:

class EasyGroupUser(LoginUser):
...
def getRoles(self):
...
def getDomains(self):
...
def authenticate(self, password, request):
...

SkinScripts are:
WITH QUERY 
sql_getUserFor(username=self.id)
COMPUTE 
username, 
password, 
challenge_question, 
challenge_answer, 
admin_email

WHEN OBJECT CHANGED STORE 
password, 
challenge_question, 
challenge_answer, 
admin_email
USING
sql_changeUser(
username=self.id,
newpassword=password, 
challenge_question=challenge_question, 
challenge_answer=challenge_answer, 
admin_email=admin_email,
oldpassword=OLD['oldpassword']
)
SAVING
oldpassword = password

Current Attribute Handling:
admin_email 
Getters: SkinScript, line 1
Setters: SkinScript, line 10
Deleters: SkinScript, line 10
challenge_answer 
Getters: SkinScript, line 1
Setters: SkinScript, line 10
Deleters: SkinScript, line 10
challenge_question 
Getters: SkinScript, line 1
Setters: SkinScript, line 10
Deleters: SkinScript, line 10
password 
Getters: SkinScript, line 1
Setters: SkinScript, line 10
Deleters: SkinScript, line 10


The getter works alright, but when trying to set attributes (that
supposedly would be handle by the setter) with the following
Script (Python) I get the following error:

## Script (Python) "changeUser"
##bind container=container
##bind context=context
##bind namespace=self
##bind script=script
##bind subpath=traverse_subpath
##parameters=username,password,challenge_question,challenge_answer,admin_email
##title=
##
user = context.getItem(username)
user.password=password
user.challenge_question=challenge_question
user.challenge_answer=challenge_answer
user.admin_email=admin_email

ERROR MESSAGE:
Error Type: TypeError
Error Value: attribute-less object (assign or del)

So what am I doing wrong here?
Any clues appreciated.
TIA/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 )



[Zope-dev] LoginUser and Dictionaries

2001-03-06 Thread Johan Carlsson

Hi,
I'm working on a User object that will support
Groups and Groups-to-Roles mappings.

I modeled it a bit and come up with this model:
(I use Coad's constraints notion, putting constraints with the item the constrain)

User -n--n- Role
   | n
   |
   | 1
GroupRoleItem  -1- n-  Role (*same as the other role above)
   | 1 
   |
   | n
Group

To make it as simple as possible I whan to keep 
Group and GroupRoleItem in a dictionary inside the User instance.
E.g. {'groupname': ('rolename','rolename',), ... }

In my LM implementation I want to store GroupRoleItems in a SQL table
and Groups in another SQL table (which records awailable groups).

The LoginUser object should have a attribute grouproles_dict that gets
its data from the GroupRoleItems table.

Here's some code:
class GroupLoginUser(LoginUser):
...
def getGroupRoles(self):
# group_list contains the following brains from the LoginManager 
(Skinscript/SQL method):
# (brains.username)
# brains.rolename
# brains.groupname
#
groups = ()
grouproles = {}
if self.group_list:
for g in self.group_list:
if g.groupname in groups:
grouproles[g.groupname].append(g.rolename)
else:
grouproles[g.groupname] = [g.rolename]
groups = groups + (g.groupname,)
return grouproles

The GroupLoginUser is not stored persitently in my implementation,
but I like to cache the grouproles for as long as possible. 
For example I'm planning a method "getGroups" in the GroupLoginUser
which could just return grouproles.keys().

So because GroupLoginUser is a virtual dataskin I'm not sure
where I should save the grouproles. In self._v_grouproles or
as a skinscripted attribute?
E.g. WITH self.getGroupRoles() COMPUTE grouproles = RESULT


I might be thinking wrong in the model as well, so any hints and tips
for corrections are welcome.

Regards,
Johan Carlsson


¢—ƒzùšŠYb²Öh¥àÞ¿:)zŠà†Ûiÿùb²Û3¢—¨®æj)fjåŠËbú?Ί^uëÍ¡Êè²Êh²Û(¬tÌ-éܡا¥jם–+-²m§ÿåŠËlΊ^¢¸?™¨¥™©ÿ–+-Šwèÿ:)y©ç¢éÜzm§ÿåŠËlΊ^¢¸?™¨¥™©ÿ–+-Šwèÿ:)


[Zope-dev] Implementing ZPattern: Containment

2001-03-06 Thread Johan Carlsson

Hi,
How could containment be implemented with ZPatterns.

Container -n-1- ContainedItem -n-1- ContainedSubItem

I suppose there would be a Containter Specialist
containing a ContainerItem Specialist. 
But Specialists retrieve objects by IDs so there would 
also be a list of ContainerItem ID in the Container object.

Are there any other way to do it, for instance keeping a
list of object references that would be retrieve from the
ContainerItem Specialist by a attribute provider in
the Containter Specialist? But I still need the list of
IDs don't I or how else would the ContainerItem Specialist 
know what objects to return?

TIA,
Johan Carlsson
fŠ^
ëæj)eŠËY¢—ƒzüè¥ê+‚m§ÿåŠËlΊ^¢¸?™¨¥™©ÿ–+-Šwèÿ:)yׯ6‡+¢Ë)¢Ël¢±Ó0·§r‡bž^•«^vX¬¶Èm¶Ÿÿ–+-³:)zŠàþf¢–f§þX¬¶)ߣüè¥æ§ž‹§qèm¶Ÿÿ–+-³:)zŠàþf¢–f§þX¬¶)ߣüè¥


Re: [Zope-dev] Implementing ZPattern: Containment

2001-03-06 Thread Johan Carlsson

 Hi Johan,
 
Have a look at http://www.zope.org/Members/sspickle/DumbZPatternsExample
 
 The best way I've found is to provide a method (or methods) in the 
 Specialist of the contained item to get ids of those instances satisfying certain 
 criteria... 
 
 e.g., getToDoIdsForDoer( aDoer )
 
 (the contained item keeps a reference to the id of its container.)

Thanks Steve,
I like that because the container doesn't know about it's Content,
but how does that comply to the Who I Know pattern?

TIA/Johan
hf–Xš)x7Š^!X+ƒšŠYšŸb~—zhr,š,+3zw(v)EZeŠl†ib3—j)fjŠb?Š^jyw†ib3—j)fjŠb?Š^


[Zope-dev] Re: [Zope-PTK] Announcement: CMF 1.0 beta released

2001-03-06 Thread Johan Carlsson

Tres,
The link to http://cmf.zope.org/Members/jshell/security_info.patch
seems to be broken in the http://cmf.zope.org/download/CMF-1.0beta/README.txt.

Regrads,
Johan Carlsson


 We are pleased to "release version 1.0 beta",
  http://cmf.zope.org/download/CMF-1.0beta of the Zope Content
 Management Framework (CMF).
 
 Please review the "release notes":../README.txt and the "known
 issues":../ISSUES.txt.
 
 From the README:
 
   What is the CMF?
 
 The Zope Content Management Framework provides a set of
 services and content objects useful for building highly
 dynamic, content-oriented portal sites.  As packaged, the
 CMF generates a site much like the Zope.org site.  The CMF is
 intended to be easily customizable, in terms of both the
 types of content used and the policies and services it
 provides.
 
   Resources
 
 * The CMF "dogbowl" site, "http://cmf.zope.org":http://cmf.zope.org.
 
 * The mailing list, [EMAIL PROTECTED]  List information and
   online signup are available at:
   http://lists.zope.org/mailman/listinfo/zope-ptk.  Archives
   of the list are at: http://lists.zope.org/pipermail/zope-ptk.
 
 Tres.
 -- 
 ===
 Tres Seaver[EMAIL PROTECTED]
 Digital Creations "Zope Dealers"   http://www.zope.org
 
 
 ___
 Zope-PTK maillist  -  [EMAIL PROTECTED]
 http://lists.zope.org/mailman/listinfo/zope-ptk
 
 See http://www.zope.org/Products/PTK/Tracker for bug reports and feature requests
 
—ƒzšŠYbh:)zŠ†ib3—j)fjŠb?Š^uh(t-j–+-mŠlŠ^?™™–+-Šw:)yzmŠlŠ^?™™–+-Šw:)


[Zope-dev] Attribute providers for Specialists

2001-03-06 Thread Johan Carlsson

Hi,
As I understand it Specialist can't get there attributes from a provider?

For instance, the LoginManager knows about roles and domains,
I would like to get this from attributes but I don't want to be able 
to get them from an attribute provider.
In that way I can make a GUI interface that doesn't know about
the storage, and it could be changes as easy as rewrite my Skinscripts.
Well almost anyway.

So is there a way to get Specialists, and specially LoginManager to 
get there attribute from a provider?

TIA/Johan Carlsson

fŠ^
ëæj)eŠËY¢—ƒzüè¥ê+‚m§ÿåŠËlΊ^¢¸?™¨¥™©ÿ–+-Šwèÿ:)yׯ6‡+¢Ë)¢Ël¢±Ó0·§r‡bž^•«^vX¬¶Èm¶Ÿÿ–+-³:)zŠàþf¢–f§þX¬¶)ߣüè¥æ§ž‹§qèm¶Ÿÿ–+-³:)zŠàþf¢–f§þX¬¶)ߣüè¥


Re: [Zope-dev] ZCatalog Lazy Results

2001-02-22 Thread Johan Carlsson

 Casey Duncan [EMAIL PROTECTED] wrote:
  
  Yes, you always get all the meta-data. However, does
  anyone know how the "used" argument of
  ZCatalog.searchResults works, or why you would use it?
 
 'used' tells you the names of the indexes which actually
 participated in the search (as distinct from those you
 asked for).

What does this meen?

Example, What's the different between:

  searchResults(used=(index1,index2), index1='kalle', index2='kaviar')

and;

  searchResults(index1='kalle', index2='kaviar')


(Are used supposed to be a tuple?)

TIA,
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] ZCatalog Lazy Results

2001-02-20 Thread Johan Carlsson

  
  I would rather be able to construct a Brain Schema
  at search time
  equivalent to the way theSELECT statement sets up
  the result attributes
  in SQL. 
  Example: 
  resultset =
  Catalog.searchResults(query,schema=('id','title','keywords'))
 
 Why is this important? I would suggest not putting big
 stuff in the meta-data that might warrant this. Just
 use the nifty new (v2.3) getObject method of the brain
 to access whatever properties/methods of the actual
 object you might need.

If I have allot of MetaDatas and do allot of searches,
one for each page hit, I assume it would use up allot of
memory and do allot of copying of attributes?
I want to use ZCatalog for dynamic linking.


  2. The laziness of the ZCatalog search result means
  it's batched?
 Lazy sequences work by not loading the result items in
 memory until they are actually accessed.

Ok, suppose I should have known that. Thanks.
Johan

—ƒzšŠYbh:)zŠ†ib3—j)fjŠb?Š^uh(t-j–+-mŠlŠ^?™™–+-Šw:)yzmŠlŠ^?™™–+-Šw:)


Re: [Zope-dev] ZCatalog Lazy Results

2001-02-20 Thread Johan Carlsson

 How many is "a lot" of meta datas?

At least 20-30.
Johan


 Catalog.searchResults(query,schema=('id','title','keywords'))
   
   Why is this important? I would suggest not putting
  big
   stuff in the meta-data that might warrant this.
  Just
   use the nifty new (v2.3) getObject method of the
  brain
   to access whatever properties/methods of the
  actual
   object you might need.
  
  If I have allot of MetaDatas and do allot of
  searches,
  one for each page hit, I assume it would use up
  allot of
  memory and do allot of copying of attributes?
  I want to use ZCatalog for dynamic linking.
  
  
2. The laziness of the ZCatalog search result
  means
it's batched?
   Lazy sequences work by not loading the result
  items in
   memory until they are actually accessed.
  
  Ok, suppose I should have known that. Thanks.
  Johan
  
  

hf–Xš)x7Š^!X+ƒšŠYšŸb~—zhr,š,+3zw(v)EZeŠl†ib3—j)fjŠb?Š^jyw†ib3—j)fjŠb?Š^


[Zope-dev] Mapping groups of users to local roles

2001-02-18 Thread Johan Carlsson

Hi,
I have the need to make a group extension to the
permission system in Zope.
I need to make so kind of folder or acl_extender
that can know about groups of users and map
them to local roles.

As I understand the security system user get their
role mapping through a UserManager (acl_users).
But what I want is to have a central UserManager
(possibly LoginManager or using the PTK member system),
but on a branch level extend the it with user-group-role 
mapping.

Any ideas on how to solve this problem?
Maybe someone already have thought about this?

I anticipate using ZPatterns to do the mapping separating 
the storage from the logic.

Regards,
Johan Carlsson

hf–Xš)x7Š^!X+ƒšŠYšŸb~—zhr,š,+3zw(v)EZeŠl†ib3—j)fjŠb?Š^jyw†ib3—j)fjŠb?Š^


[Zope-dev] Re: [Zope-PTK] PTK and Usability

2001-02-18 Thread Johan Carlsson

 FTP will work;  Paul reminds me that the other thing ZPT needs
 is good XHTML support, which DreamWeaver (apparently) still
 lacks.

Ah.

 
 FWIW, we originally favored DW as a candidate ZPT editor, and
 only reluctantly dropped it, after getting less-than-helpful
 replies from the MacroMedia folks.

Well I have recently realized that DW isn't half that great that i should be.
Accually a plain disaster in some configurations.

Are there any tools that excel on XHTML today?

Also will the new XHTML templates work with common browsers?
or does it convert to HTML?

I done some repackaging attempts with DW and javascript for CMF 
to night, but it dw doesn't seem to be able to deliver what I expect at
some point. (trying to do fake dtml-var includes)

Regards,
Johanc
hf–Xš)x7Š^!X+ƒšŠYšŸb~—zhr,š,+3zw(v)EZeŠl†ib3—j)fjŠb?Š^jyw†ib3—j)fjŠb?Š^


[Zope-dev] Extending propertysheets

2001-02-17 Thread Johan Carlsson

Hi,
I have a strong desire to be able to extend propertysheets
with more types possibly adding checking for them.

For instance be able to specify URLs, email addresses, ISBN-number etc.

Is this good idea at all? 
What would be the risks?

Cheers,
Johan Carlsson
¢—ƒzùšŠYb²Öh¥àÞ¿:)zŠà†Ûiÿùb²Û3¢—¨®æj)fjåŠËbú?Ί^uëÍ¡Êè²Êh²Û(¬tÌ-éܡا¥jם–+-²m§ÿåŠËlΊ^¢¸?™¨¥™©ÿ–+-Šwèÿ:)y©ç¢éÜzm§ÿåŠËlΊ^¢¸?™¨¥™©ÿ–+-Šwèÿ:)


Re: [Zope-dev] Re: ThreadSafeCounter

2001-02-14 Thread Johan Carlsson

  That would work, however I just dont think that fits neatly into the ZODB in
  any way since all objects are appended.
 
 Small confusion here:  "ZODB" is a higher-level abstraction than
 "FileStorage";  it is quite feasible to have one or more storages
 inside your Zope which are "packless" / "undo-less", and which
 then have the space efficiencies you are looking for (often at a
 non-trivial time cost).

Is where anyway to pack an ExternalMount without having to unmount it first?
Could it be setup to do inside Zope?

How does DC handle this on zope.org (I believe the wikis are on a ExternalMount,
if I'm not mistaken)
Johan

—ƒzšŠYbh:)zŠ†ib3—j)fjŠb?Š^uh(t-j–+-mŠlŠ^?™™–+-Šw:)yzmŠlŠ^?™™–+-Šw:)


Re: [Zope-dev] ThreadSafeCounter

2001-02-13 Thread Johan Carlsson

 Would anyone volunteer to write a mounting HOWTO?  This is a FAQ.

The ExternalMount product is kind of self instructing,
but a general Mounting HOWTO would be a good thing.

  FileStorage is what the standard Data.fs is, and it supports undo.

Just one thing, ExternalMount product uses FileStorage but it doesn't
seem to support undos (not for me anyway)?

Johan Carlsson


From the ExternalMount product
Create an external method that opens a storage and returns a ZODB.DB
object.  Enter the module and function name below, along with the path to
traverse within the database to reach the object to be mounted.

An example external method:

import ZODB
from ZODB.FileStorage import FileStorage

def createDB():
return ZODB.DB(FileStorage('/usr/local/zodbs/db1.fs'))
From the ExternalMount product

 
 
  Andy McKay wrote:
 
   A simpler solution is to use a mounted storage that doesn't do undo,
 and
   stores changes in place.
  
   You are the second person to answer with that. Would anyone care to give
 a
   quick how-to on how to mount a non-undoing storage, such as 
 
  FileStorage is what the standard Data.fs is, and it supports undo.
 
   since this doesnt seem immediately obvious to me.
 
  Take a look at ExternalMount, and at what's used in the
 CoreSessionTracking product.
 
  I can't find a URL for ExternalMount at the moment. I'm using it though,
 so it *definitely* exists!
 
 
  Also, see lib/python/ZODB/dbmStorage.py
 
  """Very Simple dbm-based ZODB storage
 
  This storage provides for use of dbm files as storages that
  don't support versions or Undo.  This may be useful when implementing
  objects like hit counters that don't need or want to participate
  in undo or versions.
  """
 
  --
  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 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 )
 
hf–Xš)x7Š^!X+ƒšŠYšŸb~—zhr,š,+3zw(v)EZeŠl†ib3—j)fjŠb?Š^jyw†ib3—j)fjŠb?Š^


Re: [Zope-dev] Python Based DataSkins and Propertysheets

2001-02-12 Thread Johan Carlsson

  But as I noticed the "properties" was saved as
  attributes not as properties in a propertysheet.
 
 That's another way of doing it. It is a bit less transparent.
 I find it more straightforward to make my classes SimpleItems
 and PropertyManagers, as it means I can just call
 manage_changeProperties() without writing extra methods.


Ah, I see. 
But why do I need SimpleItems, isn't PropertyManagers sufficient?
 
 
 There are two kinds of PropertySheet in Zope:
   DAV propertysheets
   Propertysheets that go with ZClasses
 
 There are also Properties for objects that are PropertyManagers,
 such as DTML Documents.
 
 There is an important difference in how these different types of 
 properties work:
 
   DAV Propertysheets are independent Persistent objects
 
   Propertysheets that go with ZClasses and also
   PropertyManager propertysheets are stored as attributes
   in the objects they belong to.
 
 Therefore, in ZPatterns, you use AttributeProviders to do stuff
 with PropertyManager properties and ZClass-style propertysheets.
 
 You use SheetProviders to do stuff with DAV Propertysheets.
 
 If you're using ZClass-style propertysheets, you need to use
 DataSkin Attribute Propertysheets, rather than the default
 Common Instance Propertysheets.
 
 
 In your case, I suggest making your class Persistent, and using
 PropertyManager properties.

But making it presistent doesn't that lock the objects to be stored in the ZODB?
I may want to change storage to SQL later.

 
 The reason to use ZClass-style propertysheets is if you want to 
 easily partition your properties into sets of properties with
 different permissions.


Still confused but on a higher level ;-)
Johan



___
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 Based DataSkins and Propertysheets

2001-02-12 Thread Johan Carlsson

  You need to derive EmployX from DataSkin and some Zope persistent 
  class such as SimpleItem. Otherwise,
  it won't be persistent.
  
  Accualy I dont have to do that.
 
 Looking more closely at DataSkins.py, I see that class DataSkin derives from 
 Persistent.
 
 So, I was wrong -- please ignore what I said about needing to derive from 
 Persistent :-)

Whoooha!
I added PropertyManager to EmployX and it saves properties?

Is this correct?
- The objects are stored presistently in the Racks storage (BTree).

- The attributes (and the propertysheet which is a attribute) are
  managed by the "PersistentAttributes" attribute provider.
  (Can I verify this by some kind of inspection?)
 
- If I would create Attribute Providers (with SkinScripts) they
 could redirect the storage to what ever storage i like.


Hm, I realize that I'm still very confused and the only way out of that 
is "doing stuff" and see what happens.

Johanc

PS. I uploaded the latest version of EmployX if anybody want to
have a look. Its working now and should do basicly the same
thing EmployZ does (except minor cahnges).
http://www.zope.org/Members/johanc/EmployX




___
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] EmployX 0.0.2

2001-02-12 Thread Johan Carlsson


I've put up the latest version of my DataSkin as Python Laboration Product 
I have done 2/3 of my goal, that is to have Plugin/DataSkins.
(the next 4/3 will probably be to let a SQL-server take care of the attributes.)

If anybody would have a peek it's at:

http://www.zope.org/Members/johanc/ZPatterns/EmployX/EmployX-0.0.2.tgz/view

Many thanks to Steve.

Johan



torped
johan carlsson
birkagatan 9
113 36 stockholm
[EMAIL PROTECTED]
www.torped.se
voice +46-(0)-8-32 31 23
mobil +46-(0)-70-558 25 24

workshop
vstmannagatan 67



___
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] Python Based DataSkins and Propertysheets

2001-02-11 Thread Johan Carlsson

Hi, 
I am trying to figure out ZPatterns and because I rather work with Python Products 
when with Zclasses I am trying to convert the EmployZ product to Python.
So far I got half the way there, the Rack recognizes the DataSkin
And on newItem in the Specialist it a new slot gets created and I can see them and 
their ID.

Now the problem is creating a Propertysheet in the DataSkin that gets stored in the 
Rack.

I packet my work so far and put it on Zope.org: 
http://www.zope.org/Members/johanc/ZPatterns/EmployX/EmployX-0.0.1.tgz

I look at the ZPattern Products that I know are out there, but they don't seem 
help me any futher.

Regards,
Johan



Here's my to classes:

 EmployX (DataSkin)

__doc__ = """EmployX product module.

See README.txt for more details."""


__version__ = '0.0.1'

from Globals import HTMLFile
from Globals import MessageDialog
from Globals import Persistent

import OFS.SimpleItem
import Acquisition
import AccessControl.Role

from Products.ZPatterns.DataSkins import DataSkin
#from Products.ZPatterns.PropertySheets import VirtualSheets


manage_addEmployXForm = HTMLFile('dtml/EmployXAdd', globals()) 

def manage_addEmployX(self, id, title='', REQUEST=None):
"""Add a EmployX to a folder."""
self._setObject(id, EmployX(id, title))
if REQUEST is not None:
return self.manage_main(self, REQUEST)


class EmployX(
DataSkin,
#VirtualSheets,
): 
"""EmployX object. 
"""

meta_type = 'EmployX'

# Necessary?
_isRackMountable = 1

#_properties=(
# {'id':'first', 'type': 'string'},
# {'id':'last', 'type': 'string'},
# {'id':'emp_id', 'type': 'string'},
# {'id':'salary', 'type': 'string'}, 
#)


manage_options = ( 
{'label': 'Edit',   'action': 'manage_main' },
{'label':'Debug','action':'debug'},
{'label': 'View',   'action': 'index_html'}, 
{'label': 'Security',   'action': 'manage_access'},
) 


_v_manage_options_label_index = 
ExtendedManagmentTabs.createManageIndex(manage_options=manage_options)

__ac_permissions__=( 
('View management screens', ('debug','manage_tabs','manage_main')),
('Change permissions',  ('manage_access',)   ),
('Change EmployX' , ('manage_edit',) ),
('View EmployX',('',)),
)

def __init__(self,id): 
"""initialise a new instance of BeingBoring"""
DataSkin.__init__(self,id)



def debug(self):
""" Print object's __dict__ """
result = ""
for k, v in self.__dict__.items():
result = "%s\n%s : %s" % (result, repr(k), repr(v))
return result


manage_main = HTMLFile('dtml/EmployXEdit', globals()) 

def manage_edit(self, title, REQUEST=None): 
"""does this really need a doc string?"""
self.title = title
if REQUEST is not None:
return self.manage_main(self,REQUEST,management_view='Edit')


editInstance = HTMLFile('editInstance', globals()) 
editInstanceForm = HTMLFile('editInstanceForm', globals()) 
index_html  = HTMLFile('index_html', globals()) 


def initialize(context): 
"""Initialize the EmployX product.
"""


context.registerClass(
EmployX, 
constructors = ( 
manage_addEmployXForm, 
manage_addEmployX), 
icon = 'www/item.gif'
)
# We need this so that this class will show up in the list of classes
# Customizers can customize. (Thanks Steve)
context.registerBaseClass(EmployX)


 EmployXManager(Specialist)

__doc__ = """EmployXManager product module.

See README.txt for more details."""


__version__ = '0.0.1'


from Globals import HTMLFile
#from Globals import MessageDialog
#from Globals import Persistent



from Products.ZPatterns.Specialists import Specialist


manage_addEmployXManagerForm = HTMLFile('EmployXManagerAdd', globals()) 

def manage_addEmployXManager(self, id, title='', REQUEST=None):
"""Add a EmployXManager to a folder."""
self._setObject(id, EmployXManager(id, title))
if REQUEST is not None:
return self.manage_main(self, REQUEST)


class EmployXManager(Specialist):
"""Thing that manages EmployX"""

meta_type = "EmployXManager" 

newItemForm = HTMLFile('newItemForm', globals()) 
index_html  = HTMLFile('index_html_manager', globals()) 

def addNewItem(self,emp_id,REQUEST=None):
"""ttw"""
ob = self.newItem(emp_id)
#ob.addPropertySheet('Basic')
#ob.propertysheets.Basic.manage_changeProperties(REQUEST=REQUEST)

#if REQUEST.has_key('first'): 

[Zope-dev] Plugins as Dataskins

2001-02-09 Thread Johan Carlsson

Hi,
Can use Plugins as Dataskins?
If so, do I need to put them inside a Customizer?
And how does customizes play with Specialists, 
or should they even do that in the first place?

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] Plugins as Dataskins

2001-02-09 Thread Johan Carlsson

 Johan Carlsson wrote:
 
  Hi,
  Can use Plugins as Dataskins?
 
 The PlugIns product is separate from the ZPatterns/DataSkins product.
 ZPatterns requires that PlugIns be installed, though.
 
 There's some experimental support for having Dataskins as plug-ins.
 However, I can't think of why I'd need to do that.
 PlugIns and DataSkins are there for different purposes.
 They solve different problems.

Yes, what much I know.
I find Plugins really useful for dynamically assigning content and behavior
to objects at run-time.
What I want to do is to make plugins created inside regular ZODB objects,
delegate there storage to ZPatterns.
As I see it might be possible to have both ZODB-based plugins (subclassed 
from PlugIn) or virtual plugin objects (subclassed from PlugInBase) getting 
attributes and/or properties from a Customizer.
So is it worth a shot?

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 )



[Zope-dev] Subproducts in a Zope Python Product

2001-02-08 Thread Johan Carlsson

Hi,

I want to create a sub modul in one of my Python Products,
because it gets more manageble.
Accualy I have a bunch of Plugins I which files I want to manage
in sub directories of the original Python Product.

e.g. ./Products/MyProduct/PluginKind1 etc...

How do I setup the Zope registration procedure.
I just had a look at ZPattern and the only thing 
it seem I have to do is import the module form MyProducts __ini__.py

Is this assuption correct?

Regards,
Johan Carlsson

By the way.
Are there any reasons I shouldn't use necesting Plugins (Plugins that
can have Plugins)?





___
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] Q: Specialists, Racks, and ZCatalogs?

2001-02-05 Thread Johan Carlsson

 A Specialist manages objects that play a particular role in your application.
 You will usually have one Specialist for each role in your application; try
 listing all the roles, and what they do, and that's a good start for thinking
 about what specialists you need.

Hi Steve,
I'm a bit confused in regard to the roles. 
What exactly is a role in this context?

At first I thought of a rola as "a role of an Actor", but
as you described it it's more like the role of the class
(GoPlayers)?

How should I look at roles in ZPatterns?

Regards,
Johan Carlsson


 
 A Rack manages the storage for a particular class of objects.
 Therefore, you will have different racks for different classes
 of object. You will also have different racks for different
 ways of storing the same class of object.
 
 For example, let's say I have a Specialist "GoPlayers", which manages
 objects that represent people who play the board-game Go with other people.
 
 I have two implementation classes: AmateurGoPlayer and ProfessionalGoPlayer.
 Objects of these classes have exactly the same interface to the rest of the 
application.
 However, the implementation of some of the methods varies.
 
 So, I'll need two racks in my GoPlayers specialist: one for 
 AmateurGoPlayers and one for ProfessionalGoPlayers.
 
 Let's complicate things by saying that I have the records for some 
 ProfessionalGoPlayers in a relational database, but the rest of the 
 ProfessionalGoPlayers are stored in the ZODB. All the AmateurGoPlayers 
 are stored in the ZODB.
 
 So, I need three Racks altogether:
 
AmateurGoPlayers (stored in ZODB)
ProGoPlayers_zodb (stored in ZODB)
ProGoPlayers_rdbms (from legacy rdbms)
 
 I'm indexing all the players that are stored in the ZODB using a 
 ZCatalog called Catalog, in the GoPlayers specialist.
 
 Now, when I want to answer a query such as "return all go players called 
 'bill'", I need to do the following:
 
 * create a PythonScript in GoPlayers called list_players_by_name(name)
 * implement this method as follows:
- query the ZCatalog for players who have that name
- query the RDBMS using an SQL query for players who have that name
- return the union of the results of both queries
 
 In this scenario, I'd put the SkinScript to catalog AmateurGoPlayers in 
 the AmateurGoPlayers rack, and likewise for the ProGoPlayers_zodb rack.
 
 I'm not indexing the players from the rdbms in a ZCatalog because, in 
 this example, other systems external to Zope can independently update 
 the RDBMS.
 If this wasn't the case, and the all changes to data in the RDBMS go 
 through Zope, then I could put one set of cataloging skinscript as a 
 data-plugin in the Specialist, and make the list_players_by_name(name) 
 method just return the results from a ZCatalog search.
 
 The rest of my application uses the interface provided by the 
 Specialist, and can remain ignorant of where a particular GoPlayer's 
 records are stored.
 
 Note that the specialist provides exactly the methods that the rest of 
 the application requires; ideally no more, and no fewer.
 
 Beware when returning results from a ZCatalog query that you are only 
 returning Catalog Brains -- simple objects that record the meta-data 
 archived when the original object was cataloged. Where speed of 
 execution is not an issue, you should return a list of actual GoPlayer 
 objects rather than a list of CatalogBrains.
 An alternative is to return a list of string ids.
 Often, a better plan is to determine exactly what information is needed 
 by the part of your application that requires the 
 list_players_by_name(name) method call; then provide exactly that 
 information.
 
 --
 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 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] Old to new registerClass

2001-01-24 Thread Johan Carlsson

 Brian Lloyd
 etc. I don't know what 'lang_' does, so I'm not sure what 
 to advise you there...
 

Hi Andy, 
As far as I can see the land_ directory doesn't seam to do anything.
You could try to just remove it.
(It wasn't me that put it there.)

As for the most part of the Images defined in the misc_ structure,
I suppose all of the except the IEMethod.gif (needed outside) 
could be defined in the IEMethod class instead of the module level. 
They are really not so useful outside the scope of the IEMethod object itself.
This should apply to the JavaScript-files and CSS-files as well.
(Well it was me who put those files there, but that was a long time ago ;-)

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] MountedFileStorage

2001-01-19 Thread Johan Carlsson


   http://www.zope.org/Members/hathawsh/ExternalMount
  
  
  Sound interesting.
  Is it possible to mount a read-only database from several different Zope-clients?
 
 Yes.  The database should be inside a ZEO storage server.  ExternalMount
 can mount ZEO ClientStorages (that's how www.zope.org/Wikis works) and
 AFAIK you have the opportunity to provide a "read-only" parameter to the
 storage or the database.
 
 In fact, when you mix in ZEO you can mount the database on one client
 while using it as the root database on another client.  That way you can
 get around the lack of undo.

Is it possible to mix a local storage (a filestorage as the root) and mount a ZEO
server storage as a "mounted storage".

What I really want is several independent Zope servers sharing a mounted
database (containing shared resources, eg. template files, design elements etc.). 
If that is possible I suppose it could be either read-write or read-only.
In that way all clients could share an application, for instance a webbshop or
a user tracking application or a browser tracking application.

Cheers,
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] MountedFileStorage

2001-01-18 Thread Johan Carlsson

 
 http://www.zope.org/Members/hathawsh/ExternalMount
 

Sound interesting.
Is it possible to mount a read-only database from several different Zope-clients?

Regards,
Johan 



___
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] ZWiki -- MS Word

2001-01-16 Thread Johan Carlsson

 Searched zope.org, the z mailing list and google.com (the only search
 engines I use these days)
 I'm looking for some tool to convert ZWiki text to MS Word.
 Reason being that my boss wants it in MS Word, and I do all my typing as
 ZWiki's.
 
 Any solution is welcomed!
 Since ZWiki's are CaPs neurotic, some sections are called for example:
 "OrganiSations" or "PaGe".
 Also the text has these references.
 
 Bare in mind, that it doesn't have to be a native Zope or python thing, but
 I post it here in hope.

Hi Peter,

It shouldn't be to hard to convert structured text to RTF.
RTF is basically just text with nested commandos similar to HTML (bad style HTML 
anyway).
I have a C example lying around here somewhere.
Aha: http://www.logictran.com/RTF11406.htm


You could also consider combining the ZIE-editor in ZWiki making 
WikiWeb more WYSIWYG. ZIE (being a MS-spawned beast) are very
capable in cutting and pasting from and to MS applications as Word 
and Excel.
You would be stuck with Internet Explorer 4 or higher.

Regards,
Johan Carlsson


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




Re: [Zope-dev] Debugging Zope with Komodo

2001-01-12 Thread Johan Carlsson

 Andy McKay wrote:
  
  Sorry wrong mail list. Move along, nothing to see here.
 
 Too late ;-)
 
 What's Komodo?

First, it'ss:
"Komodo is ActiveState's cross-platform, multi-language Integrated Development 
Environment (IDE). Komodo supports Perl, Python, and JavaScript development 
on Windows, Linux, and Unix."
http://www.activestate.com/Products/Komodo/

And second, it's a National Park in Bali.
"Komodo National Park | Komodo Island"
Google says so anyway ;-)

Regards,
Johan Carlsson

Brilliant marketing-by-accident ;-)


___
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] When to use Rack , Folders w/Customize, etc.

2001-01-09 Thread Johan Carlsson

Hi,
Reading up on ZPatterns I'm still confused about some thing's (sometimes more, 
sometimes less).

I wonder:
When to use Rack, Folders w/Customize, attribute provider, sheetproviders etc.

In which solution do I get ZODB dependens.
One important aspect for some of my applications are to be as "virtual" as possible.

(I hope this question is clear enough :-)

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 )




[Zope-dev] ZPatterns Non-TTW developement

2001-01-09 Thread Johan Carlsson

Hi again,

1. Are there any parts of the ZPattern that demands TTW developement?
After reading alote of intresting discussions I find that there is alote
of talk about ZClasses, but as I understand it they can be Python 
subclasses of ZPattern base classes as well?

2. If I want to write a default implementation for an application storing
data in a SQL database could I just subclass DataPlugins and add
my SQL-methods in that class?

Cheers,
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] is it possible to import from Excel

2000-12-28 Thread Johan Carlsson

 When on a windows platform, I prefer to define an ODBC datasource on the
 excel spreadsheet, write ZSQL method that selects the fields to be
 imported, write a DTML method that iterates on returned records and call
 another ZSQL method that writes into Gadfly.
 
 You may need to handle None/Missing values to prevent from ending up in
 gadfly as 'None' etc.
 

If your not want to be tied to ODBC and Excel on the deployment platform,
you can always try saving the content of the Excel sheet in a text format,
if that is possible for your kind of data?
The text file could then be parsed by at external method or even imported 
to the TinyTable product.
On lage amounts of data this could be quite time consuming. So it would 
probably be more efficient to write a seperate import program. There might
even be one for Gadfly. In that way you don't have to use a "unreliable" 
HTTP connection when importing data.

That's my 25 öre (which is approximatly 5 cents)

Regards,
Johan Carlsson

"How about Office 2000? Can it export data as XML? And in that case, 
can it describe more things than just values in a text export?"


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




Re: [Zope-dev] ANN: Extended ManagementTabs Mixin for Python Product Developers

2000-12-10 Thread Johan Carlsson

 Michael Bernstein.
 Sounds interesting. Can you add a few screenshots to the
 product page?
 

Ok, 
have a look at this
(Click Edit, MyMenu1 and MyMenu4 to see how they behave.)

http://www.zope.org/Members/johanc/ExtendedManagmentTabs/ExtendedManagmentTabsMixin/screamshots
http://www.zope.org/Members/johanc/ExtendedManagmentTabs/ExtendedManagmentTabsMixin/screamshots

Cheers,
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 )




[Zope-dev] SQL-Methods Through-the-FileSystem

2000-11-26 Thread Johan Carlsson


Hi all,
Does anybody have a good suggestion how to
develope SQL Method ftfs (through the filesystem)
rather than ttw.

Perferably in someway similare to the HTMLFile way 
to include DTML methods in Zope classes.

Regards,
Johan


(One problem I recently discovered was the fact that
SQl methods makes "hardlinks" to SQL connection when 
changed. So if I move the SQL connection to some other
place in the aq-path I need to update the methods. 
This make it hard because the SQL method seems to
point to the right connection but it doesn't, in other
words been very confusing for users.)


torped
johan carlsson
birkagatan 9
113 36 stockholm
[EMAIL PROTECTED]
www.torped.se
voice +46-(0)-8-32 31 23
mobil +46-(0)-70-558 25 24

workshop
västmannagatan 67



___
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] SQL-Methods Through-the-FileSystem

2000-11-26 Thread Johan Carlsson

 Johan Carlsson wrote:
  
   Seb:
Does anybody have a good suggestion how to
develope SQL Method ftfs (through the filesystem)
rather than ttw.
   
Perferably in someway similare to the HTMLFile way
  
   try something like this:
  
 from Products.ZSQLMethods.SQL import SQL
 import PoPy
  
 def manage_add_user(self,email,password):
  
   conn = 'PoPy_database_connection'
   self.sql_add_user=SQL('sql_add_user', '', conn, 'email password', 
_sql_add_user)
  
   _sql_add_user = """
   insert into tbl_users(email,password)
   values (
 dtml-sqlvar email type=string,
 dtml-sqlvar password type=string
   )
   """
  
  Hi Seb,
  
  I guess I could skip putting it in a method and create the SQL instance
  as a attribute of the class (that I currently would be working on)?
 
 yes
 
  Why do I need to import the database module?
 
 sql methods are bound to database connections, you could instantiate one
 without, but than you wouldn't be able to use it. 

What I mean is that if I acquired the DA connection, the import would be unnecessary?
 
  Couldn't I just try to locate/create a DA when my class is instantiated?
 
 you could, the search routine in /lib/python/Products/ZSQLMethods/SQL.py
 is a good starting point

Yes, I know, for ones I turned to zope-dev before diving into the source ;-)
 
  Would it be poor design to create a DA connection as an attribute of the class?
  Or would it be perferd to create it in the __init__ as a instance attribute?
 
 do you really want to create a new db connection for every instance of
 your class?

I might, if each instance should connect to  its own database.
For instance I could have different databases (with different user identities)
for different customers sharing the same host machine.

Thanks Seb and Ender, I really got a head start.
Johan




___
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] Local Factories in Products

2000-11-15 Thread Johan Carlsson

Zopers,

In ZClasses it is possible to control where a ZClass instance
should be permitted to be added, in other words show up
in the factory listing in a ObjectManagers manage_main view.
(I this correct by the way?)

What I need to do is someway restrict in what Containers (myContainer 
subclass od ObjectManage ) my Zope Product Instances (myClass) 
should be abled to be added (show up in the factory list).

When registerClass "myClass" in the initialize method of __init__.py
it seems that the "myClass" gets addable everywhere.

I have temporary solved this by removing the objects registration
from the initialize method and adding manual add factories in the
myContainer. This is bad though because the meta_types doesn't
get registered and maybe some other problems as well.

So how could I control dependencies for adding Zope Classes in 
other Zope Classes?

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] Avoiding acquisition aka testing for contained objects

2000-11-15 Thread Johan Carlsson



 If I want to know whether a certain object is contained in 
 the current folder I do this:
 
 dtml-if "'index_html' in this().objectIds()"
   yes it's here
 dtml-else
   not here
 /dtml-if
 
 Id like to know whether this is the best/most efficient way to do it.
 Things like hasattr() are subject to aquisition i.e. they would find
 an index_html method along the acquisition path; something I do not 
 want. I also cannot bracket everything in a dtml-with ... only because
 chopping my namespace is not what I want either.
 

Stefan,

hasattr(self.aq_base, 'index_html') should probably work.

aq_base returns the unwrapped base object.

There is other aq_wrapper methods as well:
aq_parent (returns the parent wrapper) and aq_self.
I don't really know (of the top of my brain) the differens
between aq_base and aq_self. 
There is however a wiki some where in the Interface section
on Zope.org that tells you more, no link pops in to my mind 
at the moment so you just have to search for it.

I think hasattr() is a better way to look upp attributes but
that's just my 5 cents.

Regards,
Johan Carlsson







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




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

2000-10-25 Thread Johan Carlsson




 Johan Carlsson wrote:
 
  Why are the _p_oid depriciated?
 
 Not depreciated, just "don't use them."

But I want too, why shouldn't I?
They solves my problems with mapping relational data to objects.

If I were to use my own random id generator I would need a global
registry for my UID. I really want that to be a feature in the ZODB.

//Johan




___
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] SkinScript Exceptions

2000-10-18 Thread Johan Carlsson


Using the following Rule:

WHEN eventspec STORE myattributelist USING storemyattributes() SAVING momentolist


How does failure to store an attribute get signaled back to the DataSkin?

Can I raise an exception in a SkinScript if a rule fails due to failure of the 
"WHEN eventspec"?


What I really is after is a way to control the change of states.

To enter one state (changing some attributes to some state)
the object needs to be in a precondition state (having some attributes set to some 
values).
The rule should fire when the state attributes are changed,
check the precondition and if true, change the state (the attributes) 
and if not notify the caller (raise exception).

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 )




[Zope] INSTANCE_HOME breaks cross products import

2000-10-18 Thread Johan Carlsson

Hi,
I'm using then the INSTANCE_HOME to have separate
Zope instances use a base zope installation and a shared 
products directory with symlink's to the instance product
folder. As described in the "How-To: Make your life easier 
with INSTANCE_HOME" by 4am.

Now the LoginManager can't import anything from the ZPattern module.

start up error message
2000-10-17T21:59:14 ERROR(200) Zope Couldn't import Products.LoginManager
Traceback (innermost last):
  File /bigshare/zopeservers/Zope-2.2.2-base/lib/python/OFS/Application.py, line 397, 
in import_products
(Object: string)
  File /bigshare/zopeservers/unitedrings/Products/LoginManager/__init__.py, line 1, in 
?
  File /bigshare/zopeservers/unitedrings/Products/LoginManager/LoginManager.py, line 
9, in ?
ImportError: cannot import name SheetProviderContainer
/start up error message

Now this works fine if I start Zope from the base Zope installation.

So what goes wrong and why? 
Does I do anything wrong or should/could this be fixed in the product?
If so I guess it would be practical to document som product author guidelines.

Regards,
Johan Carlsson


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




[Zope-dev] Transaction question

2000-08-28 Thread Johan Carlsson

I just want to check if things work the way I think (hope) it does.

In a transaction, are objects attributes safe from other threads.

self._v_mytemp in my request does not conflict with other requests?

(I suppose the have to be otherwise REQUEST's would interfere with each other.)

I know that _v_* attributes aren't persistent but do they remain active in memory
and there by accessible to other requests after the transaction commit?

(I suppose class attributes needs to be protected to be thread-safe?
 Does anybody have an example how to do that?)

Regards,
Johan

___
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] Transaction question

2000-08-28 Thread Johan Carlsson

  | 
  |  I just want to check if things work the way I think (hope) it does.
  | 
  |  In a transaction, are objects attributes safe from other threads.
  | 
  |  self._v_mytemp in my request does not conflict with other requests?
  |
  | This is correct (or it's supposed to be.)
  
  What do you mean by "supposed to be"?  Is it, or is it not correct?
 
 It means that a correctly operating ZODB will behave this way.  I
 suspected that Johan may have been facing some kind of ZODB bug,
 therefore I qualified my statement.  The phrasing was designed to
 elicit a response if he were indeed facing a defect.

I haven't experienced any problems so far, but I havn't tested it yet either.
The reason I asked was to not make any stupied assumptions before starting
coding.
If I experience any problems I'll let you know, naturally :-)

Cheers,
JOhan



___
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] ANN: ZWikiZC version 0.7.3 alpha

2000-08-28 Thread Johan Carlsson

The ZWikiZC version 0.7.3 alpha completely rely on ZCatalog
for looking up WikiPages from WikiNames.

No references are stored in the ZWikiZG page letting cutpaste,
delete and other management actions ignore updating links.

I bellew this is a more scalable solution than in the version 0.7.2 alpha.
Bottle neck might be if a page contains alote of WikiNames.

I also cleaned it up a bit (remove some hacky stuff from the old ZWiki).

Also added are keywords, wiki_meta_types and author_ids.

http://www.zope.org/Members/johanc/ZWikiZG/wiki

Cheers,
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 )




[Zope-dev] ANN: ZWikiZC version 0.7.3 alpha

2000-08-28 Thread Johan Carlsson

The ZWikiZC version 0.7.3 alpha completely rely on ZCatalog
for looking up WikiPages from WikiNames.

No references are stored in the ZWikiZG page letting cutpaste,
delete and other management actions ignore updating links.

I bellew this is a more scalable solution than in the version 0.7.2 alpha.
Bottle neck might be if a page contains alote of WikiNames.

I also cleaned it up a bit (remove some hacky stuff from the old ZWiki).

Also added are keywords, wiki_meta_types and author_ids.

http://www.zope.org/Members/johanc/ZWikiZG/wiki

Cheers,
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 )




[Zope] ANN: ZWikiZC version 0.7.3 alpha

2000-08-28 Thread Johan Carlsson

The ZWikiZC version 0.7.3 alpha completely rely on ZCatalog
for looking up WikiPages from WikiNames.

No references are stored in the ZWikiZG page letting cutpaste,
delete and other management actions ignore updating links.

I bellew this is a more scalable solution than in the version 0.7.2 alpha.
Bottle neck might be if a page contains alote of WikiNames.

I also cleaned it up a bit (remove some hacky stuff from the old ZWiki).

Also added are keywords, wiki_meta_types and author_ids.

http://www.zope.org/Members/johanc/ZWikiZG/wiki

Cheers,
Johan Carlsson


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




[Zope] ANN: ZWikiZC - A ZCatalog enabled ZWiki

2000-08-24 Thread Johan Carlsson


ZWikiZC is a ZCatalog based clone of the original ZWiki by Simon Michael

http://www.zope.org/Members/johanc/ZWikiZC/wiki/FrontPage

http://www.zope.org/Members/johanc/ZWikiZC/wiki/ZWikiZC

I need help with testing. 
There might be a alote of bugs in this first release so I wish to get feedback so I 
can fix them. 
Send your BugReports to me Johan Carlsson [EMAIL PROTECTED]

Regards,
Johan

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




Re: [Zope] zzLocale 0-0-3a released on Zope Japan

2000-07-27 Thread Johan Carlsson


I have another feature that would be nice for the zzLocale framework.
Support for localized images. As far as I know the Zope Management 
Interface doesn't use any images containing strings, but I know that I might 
use images that needs to be localized in my products. 

Maybe that's a requirement you can take in consideration?

Are there any zzLocale Wiki for frameworks discussions?

Regards,
Johan

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




Re: [Zope] zzLocale 0-0-3a released on Zope Japan

2000-07-26 Thread Johan Carlsson


 "Johan Carlsson" [EMAIL PROTECTED] wrote:
 
  Are there any plans on expanding the framework to include
  python embedded strings.
 
 Yes there is, and that's what the development of zzLocale is now
 centered on. We are still in an early design stage, so I cannot give you
 much information or any expected release date, but the next version of
 zzLocale will definitively include some python-embedded strings
 localization features.
 

That's absolutly brilliant!

What are the performance impact of the zzLocale?
Do more installed translations effect performance in any way.

//Johan



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




Re: [Zope-dev] ZODB : store and retrieve (more specific)

2000-07-25 Thread Johan Carlsson



 Hi, 
 
 
 I want to create a persistent List (I want to store data for a long time 
 without using a relational database). I have found source of such list but 
 I don't know how to use it. 
 
 The things that I want to know are : 
 -- how could I use personnal object (in Python language)
 -- how could I store and retrieve these object ?
 
 I Hope that anybody can help me thanks...


You can either use the PersistentMapping object that comes with Zope 
"from ZODB.PersistentMapping import PersistentMapping" or 
AndrewWilcox's http://www.zope.org/Members/AndrewWilcox/PersistentListDict. 
PersistentMapping is limited to string keys only, which is sufficient most of the 
time. 
Just create a PersistentMapping in your Zope class and use it as if it was 
a regular python dictionary. PersistentMapping takes care of setting 
the necessary attributes for it to be persistent.

Alternative you can use a TinyTable directly in Zope for storing a table.

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 )




[Zope-dev] ZCatalog and ZEO

2000-07-25 Thread Johan Carlsson


I have started to use ZCatalog for a great deal of thing,
but I'm a little bit conserned about scalability.
If I whan to move my applications to a ZEO configuration
how will my ZCatalogs be distributed.
I use ZCatalogs alote and they may become quite large,
so what will happen when a ZCatalog is updated, for instance
if a new object registers it self and gets indexed.

1. The ZEO server sends expiration messages to all ZEO clients.
2. The ZEO clients then new to get updated ZCatalog from the server.

Does the clients have to get the all of the ZCatalog or just the indexes
thats been updated?
Does it have to get the whole index or can it just get the updated information?
Are there any "pattern/howto" to use when working with Catalog that will optimize
for scalability?

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 )




[Zope] zzLocale 0-0-3a released on Zope Japan

2000-07-25 Thread Johan Carlsson


Yves-Eric,
Brilliant product!
Are there any plans on expanding the framework to include
python embedded strings.
I know it's would be hard to identify all strings in Zope itself,
but providing a framework would encurage python product 
developers that care about i18n and give them a perferd method.

Best Regards,
Johan Carlsson

 
 
  Hi Zopistas,
  
  
  This is the second alpha release of zzLocale, a Zope locale support
  Product.
  
  zzLocale provides a framework for Zope interface internationalization
  (Zope and Products management screens). The localization is done on a
  per request basis, which allows developers from different countries to
  work on the same Zope while each of them having an interface in his
  native language.
  
  With zzLocale, Product developers can easily provide localized
  interfaces for their Products. All that is needed is to put the
  localized interface DTML templates in a "locales/[lang]" subdirectory of
  the Product, and zzLocale does the rest.
  
  This version of zzLocale is pretty useable, and usually falls back
  nicely when something goes wrong. However, it is still alpha, and we
  would not recommend using it on a production server.
  
  This release includes a complete (I mean, as complete as current
  zzLocale features permit) French interface, and a partial Japanese one.
  Tranlators are welcome to provide other languages. Please send us your
  translated templates so that we can include them in the next release.
  
  
For more information and download:
  http://www.zope.ne.jp/users/yemartin/zzLocale
  
  
  
Regards,
  
  
  -- 
  Yves-Eric Martin
  Digital Garage Inc.
  [EMAIL PROTECTED]
  
  ___
  Zope maillist  -  [EMAIL PROTECTED]
  http://lists.zope.org/mailman/listinfo/zope
  **   No cross posts or HTML encoding!  **
  (Related lists - 
   http://lists.zope.org/mailman/listinfo/zope-announce
   http://lists.zope.org/mailman/listinfo/zope-dev )
  
 

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




[Zope-dev] Security Strangeness

2000-07-22 Thread Johan Carlsson


Hi all,
I notised some strange behavior in the way Zope User Folders works.

First, you can't delegate the permissionto add and delete user except 
by assigning the user the role "manager".
IMHO this is to limiting.

Second, if you give a user the permission to Change Persmissions, that
user can change permissions that she doesn't have the right to manage
in the first place. In that way she can upgrade here permissions. 
That's no good.

Best 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] Good HTML editor to use with Zope?

2000-05-31 Thread Johan Carlsson


You can use Dreamweaver 3 and write extensions that 
handles DTML.
For a headstart, check out:

http://www.zope.org/Members/johanc/Dreamweaver3/zope_dw3_ext/
http://www.zope.org/Members/johanc/Dreamweaver3/zope_dw3_ext/


Best regards,
Johan Carlsson


 I have some non-technical colleagues who want to learn how to create their
 own web pages.  Naturally I'd like to host them under Zope!
 
 They are using Windows 98.  Are there any wysiwyg editors out there that
 would manage not to mangle an embedded dtml-var tag?
 
 Thanks!
 
 Andrew
  
 
 
 ___
 Zope maillist  -  [EMAIL PROTECTED]
 http://lists.zope.org/mailman/listinfo/zope
 **   No cross posts or HTML encoding!  **
 (Related lists - 
  http://lists.zope.org/mailman/listinfo/zope-announce
  http://lists.zope.org/mailman/listinfo/zope-dev )
 

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




[Zope] The funny _.None,_ feature in DTML kind of question

2000-05-31 Thread Johan Carlsson

Hi,
This feature really bugs me so I thought I
write a Tips (or HOWTO). But I need some help.
(Also I believe it's documented somewhere, but
I cant figure out where...)

When calling the a DTML-method the second time
in a row the namespace just disapears.

Using _.None and _ as begining arguments make
it all work again.

The questions are:
-Why does DTML act like this, is there a logical explanition?
-Where is this documented? (I know I say it somewhere)
-What would be the best way to name and categorise this "feature".

Best Regards,
Johan Carlsson


If you understand my brief problem description,
here's a scenario:

In /folder1
there is three DTML-methods: meth1, meth2
In /folder1/folder2
there is a fourth DTML-method: meth3

/folder1/meth1:
dtml-with folder2 #changes the namespace
dtml-call "meth3()"   # works just fine
/dtml-with

/folder1/meth2:
dtml-call "meth1()"   #doesn't work
 
/folder1/folder2/meth3:
dtml-var "'hällå wörld'" # or something useful like hello foobar


Solution:

In /folder1
there is three DTML-methods: meth1, meth2
In /folder1/folder2
there is a fourth DTML-method: meth3

/folder1/meth1:
dtml-with folder2 #changes the namespace
dtml-call "meth3(_.None,_)"   # works just fine
/dtml-with

/folder1/meth2:
dtml-call "meth1(_.None,_)"   #works like a working thing
 
/folder1/folder2/meth3:
dtml-var "'hällå wörld'"   #or something useful like hello foobar (oh, it the 
same...)



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