[Zope-dev] Redirect Exception and Five

2006-03-07 Thread Santi Camps
Hi all,

I have a problem developing a Product using Five.When a Redirect
Exception is raised from a PluggableUserFolder inside my product, it
is not handled by the publisher, and I have an error message instead a
browser redirect. The same test inside a normal Folder works fine.

I'm using Zope 2.9.0, and tried to add this ZCML statements, but I've
no luck, and I can't find any other message talking about this.

 five:traversable class=OFS.Application.Application/
 five:traversable class=OFS.Folder.Folder/
 five:traversable class=zExceptions.Redirect/
 five:traversable
class=Products.PluggableUserFolder.PluggableUserFolder.PluggableUserFolder/
 five:traversable class=.folder.APWebFolder/

Anybody knows what could happen ?

Thanks
--
Santi Camps
Earcon S.L. - http://www.earcon.com
  - http://www.kmkey.com
___
Zope-Dev maillist  -  Zope-Dev@zope.org
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] Re: DateTime, strftime and TimeError

2005-05-13 Thread Santi Camps

The local machine's default timezone, including applicable Daylight
Savings / Summer Time rules, is used if no explicit time zone is given.
Tres.
 

Thanks very much for your answer, Tres.   Now I've been able to 
understand what's doing and provide a patch.  

I've created a new Issue in the Collector and attached the patch with 
some unittests there:  http://www.zope.org/Collectors/Zope/1780

Hope this help
Santi Camps
___
Zope-Dev maillist  -  Zope-Dev@zope.org
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] DateTime, strftime and TimeError

2005-05-12 Thread Santi Camps
En/na Andreas Jung ha escrit:

--On Mittwoch, 11. Mai 2005 16:08 Uhr +0200 Santi Camps 
[EMAIL PROTECTED] wrote:

  d = DateTime('2045/30/01')
  d.strftime('%d/%m/%Y')
DateTime.DateTime.TimeError: The time 2369343600.00 is beyond the
range of this Python implementation
I've read that the reason was a validation to avoid int overflows.   I
think this could be fixed using datetime module (new in python 2.3)
instead of old time.localtime
After some testing: datetime has the same problems and it is unlikely 
that we can solve
this problem in Zope as long as the underlying implementation in the 
libc sux (or better is
constrained on 32 bit systems).

-aj
At least is possible to fix the problem in strftime method.   I attach a 
patch that works for me.   Hope this can be commited.

Santi Camps

Index: lib/python/DateTime/DateTime.py
===
--- lib/python/DateTime/DateTime.py	(revision 30324)
+++ lib/python/DateTime/DateTime.py	(working copy)
@@ -18,6 +18,7 @@
 import re, math,  DateTimeZone
 from time import time, gmtime, localtime
 from time import daylight, timezone, altzone, strftime
+from datetime import datetime
 
 default_datefmt = None
 
@@ -1481,7 +1482,12 @@
 
 def strftime(self, format):
 # Format the date/time using the *current timezone representation*.
-return strftime(format, safelocaltime(self.timeTime()))
+lt = safelocaltime(time())
+ltz = self.localZone(lt)
+zself = self - _tzoffset(self._tz, ltz)/86400.0
+microseconds = int((zself._second - zself._nearsec) * 100)
+return datetime(zself._year, zself._month, zself._day, zself._hour,  
+   zself._minute, int(zself._nearsec), microseconds).strftime(format) 
 
 # General formats from previous DateTime
 def Date(self):
___
Zope-Dev maillist  -  Zope-Dev@zope.org
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] DateTime, strftime and TimeError

2005-05-12 Thread Santi Camps
En/na Andreas Jung ha escrit:

--On Donnerstag, 12. Mai 2005 18:34 Uhr +0200 Santi Camps 
[EMAIL PROTECTED] wrote:

En/na Andreas Jung ha escrit:

--On Mittwoch, 11. Mai 2005 16:08 Uhr +0200 Santi Camps
[EMAIL PROTECTED] wrote:
  d = DateTime('2045/30/01')
  d.strftime('%d/%m/%Y')
DateTime.DateTime.TimeError: The time 2369343600.00 is beyond the
range of this Python implementation
I've read that the reason was a validation to avoid int overflows.   I
think this could be fixed using datetime module (new in python 2.3)
instead of old time.localtime
After some testing: datetime has the same problems and it is unlikely
that we can solve
this problem in Zope as long as the underlying implementation in the
libc sux (or better is
constrained on 32 bit systems).
-aj

At least is possible to fix the problem in strftime method.   I attach a
patch that works for me.   Hope this can be commited.

If you provide some unittests then this would make a perfect patch :-)
-aj
I'm trying to do it, but one test fails.  I can't understand this behaviour:
 DateTime('2004/01/01')._tz
'GMT+1'
 DateTime('2000/06/16')._tz
'GMT+2'
Why different time zones are assigned ?   I was thinking that the 
machine time zone was always used when not specified

Santi Camps
___
Zope-Dev maillist  -  Zope-Dev@zope.org
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] DateTime, strftime and TimeError

2005-05-11 Thread Santi Camps
Hi all,
I think its known that using strftime method of DateTime module with 
dates = 1900 or = 2038, a TimeError is raised.   For instance:

 d = DateTime('2045/30/01')
 d.strftime('%d/%m/%Y')
DateTime.DateTime.TimeError: The time 2369343600.00 is beyond the 
range of this Python implementation

I've read that the reason was a validation to avoid int overflows.   I 
think this could be fixed using datetime module (new in python 2.3) 
instead of old time.localtime

Do you think its a good idea ?   Can I provide a patch that way ?
Thanks
Santi Camps

___
Zope-Dev maillist  -  Zope-Dev@zope.org
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] DateTime, strftime and TimeError

2005-05-11 Thread Santi Camps
En/na Andrew Langmead ha escrit:
On May 11, 2005, at 10:08 AM, Santi Camps wrote:
I think its known that using strftime method of DateTime module with 
dates = 1900 or = 2038, a TimeError is raised.   For instance:


DateTime can handle dates with larger ranges, it just can't display 
them with the strftime method.

DateTime's strftime method is impelemented with the standard C 
libraries' strftime(), and a C time_t datatype only represents dates 
between 1970 and 2038.


Yes, I know, but displaying them through a datetime.datetime object the 
display can also work fine.   That's my proposal.

Santi Camps
___
Zope-Dev maillist  -  Zope-Dev@zope.org
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] Can't import objects in Zope 2.8a2

2005-04-06 Thread Santi Camps
Hi all,
I'm just trying recent Zope 2.8 a2 and I'm not able to import any .zexp 
file.   At the begin I thought that it could be caused by the zexp I was 
trying to import, but default Examples.zexp also cause the same error.   
I've tried with and without ZEO, and with and without debug mode, always 
the same result.I'm doing something wrong or this could be a bug ?

Thanks in advance
The obtained traceback is this one:
Time
2005/04/06 14:05:06.943 GMT+2
User Name (User Id)
admin (admin)
Request URL
http://localhost.localdomain:8083/manage_importObject
Exception Type
BdbQuit
Exception Value
Traceback (innermost last):
Module ZPublisher.Publish, line 113, in publish
Module ZPublisher.mapply, line 88, in mapply
Module ZPublisher.Publish, line 40, in call_object
Module OFS.ObjectManager, line 554, in manage_importObject
Module Shared.DC.Scripts.Bindings, line 311, in __call__
Module Shared.DC.Scripts.Bindings, line 348, in _bindAndExec
Module App.special_dtml, line 175, in _exec
Module DocumentTemplate.DT_Let, line 76, in render
Module DocumentTemplate.DT_In, line 703, in renderwob
Module App.PersistentExtra, line 44, in locked_in_version
Module ZODB.Connection, line 831, in modifiedInVersion
Module pdb, line 992, in set_trace
Module bdb, line 52, in trace_dispatch
Module bdb, line 80, in dispatch_return
___
Zope-Dev maillist  -  Zope-Dev@zope.org
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] Re: Patch for attribute permisions problems in Zope 2.7.3

2005-02-21 Thread Santi Camps
En/na Tres Seaver ha escrit:
|
| Now, accessed and container are always the same, and in some cases
| should be different.   I attach a patch to solve this case that works
| for me.  I'm not sure if my code is the best way to solve the problem
| but, as I said, it seems to work fine.
| Of course, If the patch is accepted, the same change should be done in
| the C version.
Jim and I worked through this, and ended up putting back the use of
'aq_acquire' to do the validation, precisely becuase *it* knows what the
real container is (from guarded_getattr, you have to guess).  Please
verify that the head of the 2.7 branch resolves the issues you found.
Yes, works fine for me !!  

Thanks very much for your work on this issue.  I'm sorry I let it slide
so long,
Tres.
No, thanks to you for your great work.  It's really impresive.   The 
minimum I could do is try to help when I can.

Regards
Santi Camps
___
Zope-Dev maillist  -  Zope-Dev@zope.org
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] Patch for attribute permisions problems in Zope 2.7.3

2004-10-29 Thread Santi Camps
Hi all again,
We have been written last week about some attribute permission problems 
with Zope 2.7.3 beta due to a patch applied by Tres. 

First of all, Tres, apologies for my too fast written test case and my 
too late test of Zope 2.7.3.   Now, with some more time, I've tested and 
debugged on Zope 2.7.3 and found exactly what's happen.  

Supose we have a structure of objects like this:A.__of__(B)
A inherits from Acquisition.Implicit, has security assertions, but has 
not __allow_access_to_unprotected_subojects__
We want to access, from a Zope Page Template, an attribute of B that 
is not present in A
Accessing B.our_attribute attribute works fine.   But accessing 
A.__of__(B).our_attribute fails, and should work.

The problem is the call to validate done in guarded_getattr method 
of ImplPython.py.  The actual call is if validate(inst, inst, name, 
v), but the validate function says:

Arguments:
   accessed -- the object that was being accessed
   container -- the object the value was found in
   name -- The name used to access the value
   value -- The value retrieved though the access.
   roles -- The roles of the object if already known.
Now, accessed and container are always the same, and in some cases 
should be different.   I attach a patch to solve this case that works 
for me.  I'm not sure if my code is the best way to solve the problem 
but, as I said, it seems to work fine.  

Of course, If the patch is accepted, the same change should be done in 
the C version.

Thanks
Santi Camps
http://www.earcon.com

--- ImplPython.py   2004-08-07 19:15:48.0 +0200
+++ /usr/local/zope273/lib/python/AccessControl/ImplPython.py   2004-10-29 
10:56:11.0 +0200
@@ -534,6 +534,12 @@
 # exceptions are caught early.
 try:
 v = getattr(inst, name)
+container = inst
+while hasattr(container,'aq_explicit') and \
+  not(hasattr(container.aq_explicit, name)) and \
+  hasattr(container, 'aq_parent'):
+# Find real container when attribute is acquired
+container = container.aq_parent
 except AttributeError:
 if default is not _marker:
 return default
@@ -551,6 +557,6 @@
 return v
 
 validate = SecurityManagement.getSecurityManager().validate
-if validate(inst, inst, name, v):
+if validate(inst, container, name, v):
 return v
 raise Unauthorized, name
___
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] RFC: Proposed backward-compatibility policy

2004-10-27 Thread Santi Camps
En/na Jim Fulton ha escrit:
Chris McDonough wrote:
This sounds good.  I would add perhaps the concept of a 'smoke test'
application for backwards compatibility testing.
For Zope 2, the smoke test might be Plone or another large app written
on top of it.
Maybe someone involved in Zope 2 release management would volunteer to
run the smoke test app unit tests on each proposed Zope 2 release.  If
the unit tests didn't pass, it would block the release until the issue
was resolved.  I think Andreas does this in a sort of ad-hoc way with
Plone now but not sure.
Same for Zope 3, I just don't know what the smoke test app would be.

I'd actually like to set up a public buildbot server somewhere that
we could automatcally test 3rd-party applications with.  We could
then test a variety of applications.  ZC doesn't really have the
human bandwidth to manage another machine in the zope.org cluster.
Would anybody be willing to run a buildbot server?  We (Fred :)
can help set it up, as we've done that here in F12g.
If we can get the server going, then we'd also need volunteers to
run buildbot slaves.
Jim
Hi,
I also think the Policy you propose will be a goal.  

We have no resources to run a bulidbot server.   Moreover, nowadays we 
haven't enought human resources to develop on zope head (I really hope 
this can change in a near future).  So, our products are susceptible to 
break between Zope releases.  

What I can just ensure is we will test our products with every beta 
release of Zope (or alpha release, if any) as soon as possible, in order 
to detect and try to solve problems before final releases.

Regards
Santi Camps
http://www.earcon.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 )


Re: [Zope-dev] Re: Was: Re: 2.7.3 beta attribute permission problems

2004-10-25 Thread Santi Camps
En/na Tres Seaver ha escrit:
Andreas Jung wrote:

--On Freitag, 22. Oktober 2004 8:38 Uhr -0400 Tres Seaver 
[EMAIL PROTECTED] wrote:

Andreas Jung wrote:
how severe is the problem that you have fixed? According to some
rumors the fix seems to break applications. The question for Zope
2.7.3 final is: is the problem severe enough to have it fixed for
2.7.3 with the risk of causing trouble with broken applications or
can we defer the fix to Zope 2.8?

-1.
I have yet to get a reproducible test case (one which breaks on 
2.7-head
but works on 2.7.2) from the examples folks have supplied.  The bug 
which
I was fixing is a security issue, reported against CMF, but also
affecting Zope:  http://zope.org/Collectors/CMF/259

Given that the change was required to implement a security fix, and
without a reproducible test case for the reported breakage, I don't 
think
we can credit the rumors.  We *definitely* don't want to defer the
security fix.

I am not against the patch...I just need to know what the state of 
this issue is and what its
implications are for the final 2.7.3 release :-)

OK, here is my take, rephrased:  the patch is there to support an 
important security fix (see the link above).  Without a reproducible 
test case (I've tried and failed to make Stefan's reproducible within 
the AccessControl tests), we should just go forward and release 2.7.3.

Applications which use 'setDefaultAccess(deny)' for their content 
objects may need to quit trying to acquire CMF tools implicitly (using 
'getToolByName' instead, which is the preferred API anyway);  that is 
the only case I know of which can be isolated.

Richard Jones reported an issue with the patch, but couldn't give us a 
simple case.  Users who *have* such weird applications can reverse the 
patch, find workarounds, or whatever, until they can help us isolate 
the bug.

I think that the Product I send to the list last week was a reproducible 
simple test case, wasn't it ?  If I can help in any other way I will try 
to do it.

Regards
Santi Camps
http://www.earcon.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 )


Re: [Zope-dev] 2.7.3 beta attribute permission problems

2004-10-19 Thread Santi Camps
En/na Dieter Maurer ha escrit:
Santi Camps wrote at 2004-10-18 12:37 +0200:
 

...
I have a persistent object A and a non persistent object B.   B has 
implicit acquisition.   From trusted code I return B.__of__(A).   Trying 
to access B.meta_type from untrusted code (a ZPT) raises the error.B 
has no attribute meta_type, so it should be returned from A using 
implicit acquisition.  A has all necessary security assertions.
   

meta_type is probably a string.
Elementary data types (such as string) do not know
anything about acquisition.
The code that checks the permissions cannot (easily) determine
where it comes from (other than reimplementing acquisition, which
would not be a good thing).
 

Yes, meta_type is an attribute of type string, but I don't understand 
your reasons.   Acquisition, obviously, is not implemented in strings, 
but if the object containing meta_type attribute inherits from 
Acquisition.Implicit it should work.  In fact, it works for Zope 2.7.0 
to 2.7.2.   The problem appears in Zope 2.7.3, and I think that the 
problem is the change I mentioned in AccessControl/cAccessControl.c and 
AccessControl/ImplPython.py. I suppose this change is for some 
reasonable reason, but if it breaks security validations throught 
implicit acqusition I think the change should be considered.

Regards
Santi Camps
http://www.earcon.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 )


Re: [Zope-dev] 2.7.3 beta attribute permission problems

2004-10-19 Thread Santi Camps
En/na Richard Jones ha escrit:
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On 19/10/2004, at 4:33 PM, Santi Camps wrote:
Yes, meta_type is an attribute of type string, but I don't understand 
your reasons.   Acquisition, obviously, is not implemented in 
strings, but if the object containing meta_type attribute inherits 
from Acquisition.Implicit it should work.  In fact, it works for Zope 
2.7.0 to 2.7.2.   The problem appears in Zope 2.7.3, and I think that 
the problem is the change I mentioned in 
AccessControl/cAccessControl.c and AccessControl/ImplPython.py. I 
suppose this change is for some reasonable reason, but if it breaks 
security validations throught implicit acqusition I think the change 
should be considered.

AFAIK Tres is working on this. I was unable to produce a simple 
example case, but more recently Stefan Holek (I think) was. The last I 
saw was Tres saying Aargh! on the 13th, then on the 14th saying he's 
unable to produce good test cases.

And that's the problem. Tres' patch removed DWIM code. I'm not sure 
what that meant (I know what DWIM stands for ;) ... and I'm unable to 
state exactly (in a test case) what it is that my code does that 
invokes the DWIM'y code.

Richard
Thanks very much for the information, Richard.  I think I should be able 
to provide a good test code (all our framework crash in zope 2.7.3 due 
to this patch).   Let's go

Santi Camps
http://www.earcon.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 )


Re: [Zope-dev] 2.7.3 beta attribute permission problems

2004-10-19 Thread Santi Camps
En/na Santi Camps ha escrit:
En/na Richard Jones ha escrit:
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On 19/10/2004, at 4:33 PM, Santi Camps wrote:
Yes, meta_type is an attribute of type string, but I don't 
understand your reasons.   Acquisition, obviously, is not 
implemented in strings, but if the object containing meta_type 
attribute inherits from Acquisition.Implicit it should work.  In 
fact, it works for Zope 2.7.0 to 2.7.2.   The problem appears in 
Zope 2.7.3, and I think that the problem is the change I mentioned 
in AccessControl/cAccessControl.c and 
AccessControl/ImplPython.py. I suppose this change is for some 
reasonable reason, but if it breaks security validations throught 
implicit acqusition I think the change should be considered.

AFAIK Tres is working on this. I was unable to produce a simple 
example case, but more recently Stefan Holek (I think) was. The last 
I saw was Tres saying Aargh! on the 13th, then on the 14th saying 
he's unable to produce good test cases.

And that's the problem. Tres' patch removed DWIM code. I'm not sure 
what that meant (I know what DWIM stands for ;) ... and I'm unable to 
state exactly (in a test case) what it is that my code does that 
invokes the DWIM'y code.

Richard

Thanks very much for the information, Richard.  I think I should be 
able to provide a good test code (all our framework crash in zope 
2.7.3 due to this patch).   Let's go

Santi Camps
http://www.earcon.com
Here you are a test case for that problem.   It's a very simple case of 
what my framework does.

How to proceed:
1) Install the product in a Zope 2.7.3 beta
2) Add an instance of meta type AccessControl Test
3) Try http://localhost:8080/AccessControlTest/get_sum_of_values.  It 
works fine (is a method of Test class)
4) Try http://localhost:8080/AccessControlTest/get_product_of_values.  
It also works fine  (is a method of Adapter class)
5) Try http://localhost:8080/AccessControlTest/crashing_test (is a ZPT 
trying to access previous methods).  It crashes !!
*
Error Type: Unauthorized*
*Error Value: The container has no security assertions. Access to 
'get_sum_of_values' of (Adapter instance at 40ae6ac0) denied.*

Obviously, this is not a reasonable behaviour.   If I can access those 
methods directly from an URL, I should be able to do it from a ZPT.

Doing the same on Zope 2.7.2 works fine.
I hope this help
Santi Camps
http://www.earcon.com



testAccessControl.tar.gz
Description: application/gzip
___
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] Re: 2.7.3 beta attribute permission problems

2004-10-19 Thread Santi Camps
En/na Tres Seaver ha escrit:
Dieter Maurer wrote:
Santi Camps wrote at 2004-10-19 15:05 +0200:
...
Error Type: Unauthorized*
*Error Value: The container has no security assertions. Access to 
'get_sum_of_values' of (Adapter instance at 40ae6ac0) denied.*

This tells you that the container containing get_sum_of_values
does not have security assertions. Is this wrong?

The container (the class Test.Test in Santi'a product) does have 
security assertions for *itself*:

class Test(OrderedFolder):

Test

meta_type   = 'AccessControl Test'
security = ClassSecurityInfo()
security.declareObjectProtected('View')
However it makes no assertion for the attribute 'get_sum_of_values':

def get_sum_of_values(self):


return self.value1 + self.value2
AFAICT, the new behavior is perfectly correct here:  absent either an 
explicit permisison declaration for 'get_sum_of_values', or a blanket 
grant for unprotected subobjects (e.g, 
'security.setDefaultAccess(1)'), the template which fails *should* 
fail;  the fact that it used to succeed was merely a security hole.

Tres.
Hi again,
Adding a  security.declareProtected('View', 'get_sum_of_values') results
in the same error.
Anyway, I can't understand a behaviour that allows to access a method
directly from the URL and crashes when the access is done from a ZPT.
If what you want to do is that all methods without explicit permission
declaration be considered private, direct access from an URL should also
raise an Unauthorized error, I think.
On the other hand, I don't think that current code could be considered a
security hole.  If a method is unprotected, then the protection of the
object itself is applied.   I like it.  But I understand that this is a
personal opinion.  I supose the change is due to some security hole found.
Regards
Santi Camps
http://www.earcon.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] 2.7.3 beta attribute permission problems

2004-10-18 Thread Santi Camps
Hi all,
I've instal·led Zope 2.7.3b2 (python 2.3.4, gnu/linux box) to test my 
products and at the first moment I've found a terrible problem for me.   
My applications began to raise Unauthorized: The container has no 
security assertions errors everywhere.  I've been looking for in google 
and found this thread:
http://www.mail-archive.com/zope-dev%40zope.org/msg17218.html

Really the problem seems to be exactly the same.   A simple example:
I have a persistent object A and a non persistent object B.   B has 
implicit acquisition.   From trusted code I return B.__of__(A).   Trying 
to access B.meta_type from untrusted code (a ZPT) raises the error.B 
has no attribute meta_type, so it should be returned from A using 
implicit acquisition.  A has all necessary security assertions.

All this has been working fine from Zope 2.7.0 to 2.7.2.   The problem 
appears the first time in Zope 2.7.3 beta.   As Richard Jones says, the 
problem seems to be a little change in AccessControl/ImplPython.py:

554,557d553
 # Filter out the objects we can't access.
 if hasattr(inst, 'aq_acquire'):
 return inst.aq_acquire(name, aq_validate, validate)
 # Or just try to get the attribute directly.
and I think also in cAccessControl.c:
2112,2123d2113
 # Filter out the objects we can't access.
 if hasattr(inst, 'aq_acquire'):
 return inst.aq_acquire(name, aq_validate, validate)
*/
   if (aq_isWrapper(inst))
 {
   Py_DECREF(v);
   return aq_Acquire(inst, name, aq_validate, validate, 1, 
NULL, 0);
 }

   /*
 # Or just try to get the attribute directly.

Thanks in advance
Santi Camps
http://www.earcon.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] Referencial Integrity in ZCatalogs

2004-08-02 Thread Santi Camps
Hi all,
I've been developing database oriented applications for about 10 years, 
using zope with Relation DDBB for one year and a half, and just one year 
using Zope with ZODB in my applications.   At this point, I can see a 
lot of advantatges of use ZODB with Zope, but there are some points 
where the relational model was more useful to me. 
In fact, the main problem in my applications are relationships.   In a 
relational world, you can specify relations using foreign keys, and also 
say what action should be done on delete or on update (no action, set 
null, restrict, cascade, set default).   This is very useful developing 
business oriented applications. 
Using ZODB some of these relations can be done using containment:   If A 
contains B, this is the same of having a relation 1-N on delete cascade
Another case is to use a Relation Manager.   I've implemented and object 
Relation that is deleted when some of the two related objects are (using 
manage_beforeDelete).  This is the same that a relation M - N on 
delete cascade
The third case I've been implemented, and the one giving me more 
problems, is to have a property referencing another object (path or 
UID).  If the referenced object is dropped, the referer has problems

I work a lot with ZCatalogs, using one catalog for each meta_type of 
objects, so for me catalogs are the most similar thing to a Table.   
I'm thinking that could be very useful to implement some basic 
referencial integrity in ZCatalogs.   Just being able to define primary 
keys and some simple types of foreign keys we will have on Zope the best 
of two worlds.   Seeing code of ZCatalog product it seems not to be very 
difficult to implement, adding some validations on catalog_object and 
uncatalog_object methods.   Of course, all these should be optional.   I 
no Primary Keys neither Foreign Keys are defined, catalogs should work 
exactly like until now.

What do you think about this ?  If nobody convince me that this is a 
stupid work, I will try to implement it.   In this case, what's the 
better way to provide the code ?  A patch for ZCatalog ?  Or a new 
Product IntegrityZCatalog inheriting from ZCatalog ?

Thanks
Santi Camps
___
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] Referencial Integrity in ZCatalogs

2004-08-02 Thread Santi Camps
En/na Roché Compaan ha escrit:
Have a look at Archetypes, it does what you want.
http://sourceforge.net/projects/archetypes
I think you are talking about SQLStorage of Archetypes.   Storing some 
attributes in a Relational Database and using foreign keys in it can 
solve the problem.  But I have some inconveniences to use Archetypes:
1) I don't use CMF.  My applications aren't content management 
applications, but business oriented applications.
2) I like to distribute my applications without needing BBDD 
installation.   Just download and run.   Having a relational database 
backend will need some extra installation

In any case, use SQLStorage without CMF could be interesting.   I don't 
know if it is possible.   Do you know ?

Thanks
Santi Camps
___
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] Referencial Integrity in ZCatalogs

2004-08-02 Thread Santi Camps
En/na Russ Ferriday ha escrit:
Take a look at archetypes on Plone.org, and download a version from 
sf.net.
Look in particular at the ReferenceEngine, based on the catalog, and 
note that there have been implementation changes, and there's a new 
beta version.
Ben Saller and Kapil Thangavelu were part of the team responsible for 
Archetypes.
--r.
Um, this seems something more what I'm looking for.  I can see that 
ReferenceEngine and Referenceable implements some referential at object 
level.  I was thinking about to do it at catalog level, maintaining a 
paralelism with a referential model, where catalog = table.   But making 
an implementation like Archetypes one is another good option, of course.

Unfortunately, I don't use CMF in my application.   I use a structure of 
frames to work, and also a lot of javascript and DHTML, translatable 
javascript content, etc.  Working this way is easy don't use CMF that 
accommodate to it.

Thanks for the info
Santi Camps
___
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: [Fwd: Re: [Zope-dev] Referencial Integrity in ZCatalogs]

2004-08-02 Thread Santi Camps
En/na Leonardo Rochael Almeida ha escrit:
Forgot to Cc: zope-dev
-Mensagem encaminhada-
From: Leonardo Rochael Almeida [EMAIL PROTECTED]
To: Santi Camps [EMAIL PROTECTED]
Subject: Re: [Zope-dev] Referencial Integrity in ZCatalogs
Date: Mon, 02 Aug 2004 17:05:53 -0300
I would suggest you take a look at mxmRelations, however Zope.org
workflow is keeping it out of reach, and I couldn't find it on MaxM's
own site.
The URL for it would be:
http://www.zope.org/Members/maxm/products/mxmRelations
 

Yes, I've seen this solution.  It's another way to make things.  But I'm 
not sure that it can implement a foreign key on delete restricted, for 
instance. 

I see there are a lot of ways to solve this problem, so I will implement 
my proposal as a separate Product.   I will try to implement a 
IntegrityZCatalog, adding primary and foreign key capabilities.  

It will be easier to use for me, and also for all new zope coders 
comming from relational databases.  If we can say Catalogs are our 
Tables.  Use them as you have been using Tables until now and you will 
be right, I think we can make they learning much short.

Regards
Santi Camps
___
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] Re: CatalogBrains since Zope2.7.1b1

2004-06-27 Thread Santi Camps
   Optional arguments will still allow untrusted code to bypass security
   checks.
Yes, that's true.
   Here are three solutions to this, two of which do not involve catalog
   changes:
   - Use a proxy role on the script that invokes getObject which grants the
   permissions needed.
   - Use self.unrestrictedTraverse(brain.getPath()) from trusted code
   - Add a private method: unrestrictedGetObject() to the catalog brain API
   which does no security checking, but is inaccessible to untrusted code.
   I think the last one is a good idea and I will implement it. The other
   two are available options for now.
Ok, I think it will be useful.  Until then, the second option is a good solution for 
me.  Thanks a lot for the suggestion.
Regards
Santi Camps
___
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] Re: Re: CatalogBrains since Zope2.7.1b1

2004-06-24 Thread Santi Camps
   Security was tightened for getObject recently as part of a general
   refactor of that code. I am happy to consider whether the security is
   too tight, in which case it could be backed off a bit.
   Previously getObject performed no security checks and returned objects
   for catalog results regardless of security permissions (it used
   unrestrictedTraverse). I switched it to use restrictedTraverse which
   checks security all the way down on all of the containing folders and on
   the final object itself. This is how path expressions work, for
   example.
I think this new security checks could be a problem in some cases.  They are Ok when 
using restricted code, but from trusted code I'm not sure that force to use 
restrictedTraverse could be considered a goal.
For instance, imagin an application with employees of one department managing dossiers 
with economic data inside.  Employees of accounting department shouldn't have access 
to these dossiers objects, but they need to obtain some reports with a sum of all 
dossiers economic data.   So, accounting department users shouldn't have access to 
dossiers objects, but from reports trusted code these dossiers need to accessed.
I think a possible solution could be an additional optional parameter of .getobject 
used from trusted code when unrestrictedTraverse want to be used.  What do you think  ?
Regards
Santi Camps


___
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] ZPT in Zope Products

2004-04-15 Thread Santi Camps
Wyatt Anderson escribi:

Hello All,

I am trying to use ZPT within a Zope Product I am trying to build.

I want to test the container type I am addding to to determine what

action to take. The following though

from Products.PageTemplates.PageTemplateFile import PageTemplateFile

def manage_addMyContainerForm(self, REQUEST):

pt = None

if self.meta_type in [ContainerType1, ContainerType2]:

pt = PageTemplateFile(zpt/addMyContainerForm, globals())

else:

pt = PageTemplateFile(zpt/containerError, globals())

return pt.pt_render()

This produces the following traceback in Zope:

Traceback (innermost last):

 Module ZPublisher.Publish, line 100, in publish

 Module ZPublisher.mapply, line 88, in mapply

 Module ZPublisher.Publish, line 40, in call_object

 Module Products.MyContainer.MyContainer, line 17, in manage_addMyContainerForm

 Module Products.PageTemplates.PageTemplate, line 90, in pt_render

  - PageTemplateFile at containerError

 Module Products.PageTemplates.PageTemplateFile, line 73, in pt_getContext

TypeError: 'str' object is not callable

Ive checked out the code in PageTemplate.py and PageTemplateFile.py 
and cant

figure out what is going on. The line in question is

root = self.getPhysicalRoot()

Is it possibly some security thing? My class is 
setDefaultAccess(allow) for now.

Ive also tried simply

return pt

with no traceback but without the desired results as the object is 
returned.

Thanks in advance,

Wyatt

Try return pt()

Santi Camps

___
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] APE and SQL Storages in Zope 2.7

2004-03-24 Thread Santi Camps
Shane Hathaway escribió:

[EMAIL PROTECTED] wrote:

Is there any way to have a working config for postgresql and zope 2.7 
? Or everybody is working with FileSystem storages and SQL storages 
are just
working with zope 2.6 ?


Thanks for reporting this.  I just now brought the ZConfig schema up 
to date.  See the updated component.xml for an example of setting up a 
connection to Postgres.

Shane

Thanks a lot for your answer !!   It works fine :-)

Let me make a suggestion:   In next releases, leave 
SQLMultiTableProperties option as default.  That's what all Zope newbies 
are looking for, I think.   I meet a lot of developers that like Zope, 
but they are disturbed if data aren't in a relational database, but also 
if data aren't in a relational way (just what SQLMultiTableProperties 
does).  It could seems a silliness, but it's real, and stops a lot of 
people to use Zope.  I think Ape will help a lot to expand Zope.  

I will begin to intesively use Ape with SQLMultiTableProperties option 
over Postgresql.Of course, I will report eventual bugs in the collector.

Thanks again

Santi Camps



___
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] Zope 2.7 breaks auto refresh

2004-03-03 Thread Santi Camps
Hi again,

I've this traceback using Zope 2.7.0 final:

Module ZPublisher.Publish, line 163, in publish_module_standard
  * Module ZPublisher.Publish, line 127, in publish
  * Module Zope.App.startup, line 203, in zpublisher_exception_hook
  * Module ZPublisher.Publish, line 104, in publish
  * Module Zope.App.startup, line 221, in commit
  * Module ZODB.Transaction, line 233, in commit
  * Module ZODB.Transaction, line 348, in _commit_objects
  * Module ZODB.Connection, line 435, in commit
__traceback_info__: (('Products.Transience.TransientObject',
'TransientObject'), '\x00\x00\x00\x00\x00\x00\x008', '')


The error is caused during the auto refresh hook.  If auto refresh is
disabled, all works fine.  I've seen that there is a bug in the
collector about this issue: http://zope.org/Collectors/Zope/1010

I've tryied to understand the problem.  It seems that now Trasicience
uses a different ZODB connection (using DBTab), and I think this is the
cause of the problem.  

In Zope/App/startup.py, there is the following lines:

# Initialize the app object
application = app()
OFS.Application.initialize(application)
if Globals.DevelopmentMode:
# Set up auto-refresh.
from App.RefreshFuncs import setupAutoRefresh
setupAutoRefresh(application._p_jar)
application._p_jar.close()


This handles the autoRefresh machinery to the main Connection, but I've
not found anywhere the same has been done with temporary Connection.  

But in the ZODB/Connection.py there is a global_code_timestamp used to
compare all Connections _code_timestamp attribute.   

Then, when the Connection tries to commit, as the _code_timestamp of
Trasicience connection hasn't been updated, the problem appears.  Almost
is what I think.

If anybody can put me in the right direction I can try to provide a
patch.  What do you think ?  Which is the best way to solve this
problem?

Thanks a lot

-- 
Santi Camps
http://zetadb.sourceforge.net


___
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] Zope 2.7 breaks auto refresh

2004-03-03 Thread Santi Camps
 I don't understand this traceback entirely.  What is the exception that
 is being raised?  Also, the last line in the traceback doesn't match a
 line on my copy of ZODB/Connection.py.  (I've got revision 1.98.4.5.)
 

Sorry, the full Traceback is this one (the previous one has a modified
version of Connection.py to add some LOGs):

Traceback (innermost last):

  * Module ZPublisher.Publish, line 163, in publish_module_standard
  * Module ZPublisher.Publish, line 127, in publish
  * Module Zope.App.startup, line 203, in zpublisher_exception_hook
  * Module ZPublisher.Publish, line 104, in publish
  * Module Zope.App.startup, line 221, in commit
  * Module ZODB.Transaction, line 233, in commit
  * Module ZODB.Transaction, line 348, in _commit_objects
  * Module ZODB.Connection, line 425, in commit
__traceback_info__: (('Products.Transience.TransientObject',
'TransientObject'), '\x00\x00\x00\x00\x00\x00\x00)', '')

ValueError: Cache values may only be in one cache. (Also, an error
occurred while attempting to render the standard error message.)


After that, any try to work with the applications raises this other one:


Traceback (innermost last):

  * Module ZPublisher.Publish, line 163, in publish_module_standard
  * Module ZPublisher.Publish, line 127, in publish
  * Module Zope.App.startup, line 203, in zpublisher_exception_hook
  * Module ZPublisher.Publish, line 104, in publish
  * Module Zope.App.startup, line 221, in commit
  * Module ZODB.Transaction, line 233, in commit
  * Module ZODB.Transaction, line 348, in _commit_objects
  * Module ZODB.Connection, line 425, in commit
__traceback_info__: (('BTrees.OOBTree', 'OOBTree'),
'\x00\x00\x00\x00\x00\x00\x00\x0e', '')

ValueError: Cache values may only be in one cache. (Also, an error
occurred while attempting to render the standard error message.)



  I've tryied to understand the problem.  It seems that now Trasicience
  uses a different ZODB connection (using DBTab), and I think this is the
  cause of the problem.  
  
  In Zope/App/startup.py, there is the following lines:
  
  # Initialize the app object
  application = app()
  OFS.Application.initialize(application)
  if Globals.DevelopmentMode:
  # Set up auto-refresh.
  from App.RefreshFuncs import setupAutoRefresh
  setupAutoRefresh(application._p_jar)
  application._p_jar.close()
  
  
  This handles the autoRefresh machinery to the main Connection, but I've
  not found anywhere the same has been done with temporary Connection.  
  
  But in the ZODB/Connection.py there is a global_code_timestamp used to
  compare all Connections _code_timestamp attribute.   
  
  Then, when the Connection tries to commit, as the _code_timestamp of
  Trasicience connection hasn't been updated, the problem appears.  Almost
  is what I think.
 
 I'm not very familiar with the App.RefreshFuncs code, but I think I can
 offer some generic comments.  setupAutoRefresh() calls
 ZODB.Connection.updateCodeTimestamp() which will cause every Connection
 to reset its cache the next time it is opened.  It wouldn't be safe to
 reset the cache at other times, because application code could have a
 reference to existing objects.
 
 I don't know how all this affects the Transience connection.  When is it
 opened and closed?
 
 Jeremy

I think the error is produced after the second store in the SESSION
variable.  Perhaps the problem is that the temporary Connection is not
closed and openned right.  I will continue debugging

Thanks for your answer

-- 
Santi Camps
http://zetadb.sourceforge.net


___
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] Zope 2.7 date international configuration

2004-03-02 Thread Santi Camps
Hi all,

I'm just beginning to move my applications to Zope 2.7 and I've found
something estrange related to dates. In the new zope.conf you can enable
an option:  datetime-format international

I've enabled it hoping that fields named   field_name:date  will be
handled as dates in international format.  But not, they are handled as
dates in us format.  

Seeing the ZPublisher/Converters.py I see that fields in the form
field_name:date_international are handled OK.  But fields with just
:date are hanled with default DateTime format.  

Seeing DateTime module, it seems that this default format should be in
an environment variable DATETIME_FORMAT.  Also, it seems that this
variable should be defined during Zope startup.

But the result is that with :date fields, us format is always used,
not following the instruction in zope.conf.  Perhaps there is some
problem in Zope configuration machinery.  

Anybody else with this problem ?  

-- 
Santi Camps
http://zetadb.sourceforge.net


___
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] Zope 2.X BIG Session problems - blocker - our site dies - need help of experience Zope developer, please

2004-02-28 Thread Santi Camps
 When we started using Zope sessions, we experienced a set
 of session problems. I started fixing them, but it turned out
 that the implementation was very ambitious, too ambitious to
 get it safe. I, therefore, switched plans and implemented
 an alternative Transience module -- much simpler and less ambitious.
 We use it since then in a medium load production
 environment and did not see any more problems.
 
 I asked my boss whether I can release this implementation
 as Open Source. He said sure.
 
 I still have to hash out a few organisational questions but
 I expect the module will be available within 2 weeks.

Oh, these are really good news !!  

Please, announce it very high :-)

Thanks a lot

-- 
Santi Camps
http://zetadb.sourceforge.net


___
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] Put an adapted object in context

2004-02-13 Thread Santi Camps
 Okay, though Acquisition.Implicit is actually going to make your namespace
 issues worse; better use Acquisition.Explicit and enjoy another benefit of
 adapters -- namespace separation. I suspect though that your application's 
 goals/design are different than mine. I appreciate adapters in part because
 they can support a much cleaner partioning of code, while you're interested
 in them primarily for the added dynamism, which is of course another major
 benefit of them.
 

That's it.  

  Sure.  Now my little adapters systems is beginning to work fine, and I
  will move my application this way.  I'm using a simple engine, a method
  to define which adapters should be applied to each meta_type (this info
  is stored in SESSION) and then this adapters are transparently applied
  when accessing this kind of objects (writing some code in
  __bobo_traverse__).
 
 Sounds a bit like views (which is a special kind of adapter in a way); what're
 the adapters doing? 
 
 A registry that maps meta_type to views is what we've been using inside Silva for
 a long time, but we're going to move away from this towards mapping interface
 to views/adapters, like in Zope 3, hopefully soon.
 
 One important idea is that an object can have multiple views simultaneously,
 instead of one big view standing in for all aspects of looking at the object. 
 Associating views with interfaces makes it possible to associate some views for
 the 'base interfaces' of an object (and thus for a large class of objects) while
 others only apply to very particular interfaces (and thus a much smaller class
 of objects).
 

Yes, the most important difference is that CMF and Silva are content
management systems, and I'm focussing my efforts in to use Zope as a
bussiness applications development framework.

I use adapters to apply a Model View Controler pattern.  I've diveded my
development into:

1) Types. Basic objects with its model methods and its unitary views. 
For instance, a Folder with its creation and modification methods and
forms, but without any logic (neither navigation between methods,
REQUEST doesn't appear here).

2) Applications.  Each application acts as a controller of used Types,
and also can add some custom views.  This functionallity is added
throught adapters.  So, the application can decide in which framework
should appear the add_folder_view, where its submit should be sended,
and what should be done after adding.

This way, same object could be used from various applications with no
problems.  All the logic and navigation is decided in each application.

Regards

-- 
Santi Camps
http://zetadb.sourceforge.net


___
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] Put an adapted object in context

2004-02-12 Thread Santi Camps
 Santi Camps wrote:
  My problem is that the adapter object, and also the adapted object
  contained in it, are out of publisher context or something like this. 
  For instance, absolute_url() methods doesn't work becouse REQUEST is not
  defined.
 
 I'm not sure I understand what you mean; I don't understand why your
 adapted object would become detached from the original context.
 

It was a stupid question, I was applying the adapter before publishing
the object.  Now I apply the adapter in __bobo_traverse__ and its
beginning to run OK.

 It looks like you're losing acquisition context. You put an object into
 acquisition context explicitly. Something along these lines:

 import Acquisition
 
 class MyAdapter(Acquisition.Explicit):
def __init__(self, context):
self.context = context
 
 def getAdapter(context):
# create adapter for context, and wrap it explicitly in the acquisition
# context
return MyAdapter(context).__of__(context)
 
 This works to give the adapter among other things a security context,
 so you can call methods on the adapter from a page template, for instance.
 You can also get to REQUEST and such, though in this case I used explicit
 acquisition so you'll have to use self.aq_acquire.REQUEST, if I recall
 the syntax correctly.
 

Thats very interesting !!  I was rewriting __getattr__ to allow the
adapter access adapted object attributes, but doing this way its clear
and easier.  Inheriting from Acquisition Implicit and applying the
adapter using __of__ I obtain the same result and have less problems.  

 Regards,
 
 Martijn
 
 P.S. In the course of the coming weeks I'll be backporting parts of Zope 3's
 component architecture, especially adapters, into Zope 2. Contact me if 
 you're interested. I also expect I'll be making more noise about this in
 a few weeks.

Sure.  Now my little adapters systems is beginning to work fine, and I
will move my application this way.  I'm using a simple engine, a method
to define which adapters should be applied to each meta_type (this info
is stored in SESSION) and then this adapters are transparently applied
when accessing this kind of objects (writing some code in
__bobo_traverse__).  

-- 
Santi Camps
http://zetadb.sourceforge.net


___
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] Put an adapted object in context

2004-02-11 Thread Santi Camps
Hi all,

Following your instructions and seeing Skin Product code, I've been able
to write a simple way to register Apdaters in my applications that are
applied to specific meta_type objects during publishing.  This is now
working fine.  I can write an Adapter in my application and say use
this adapter for all objects of meta_type 'Folder'.  The adapter to
apply of the same object may change depending of user and the
application he is using.

My problem is that the adapter object, and also the adapted object
contained in it, are out of publisher context or something like this. 
For instance, absolute_url() methods doesn't work becouse REQUEST is not
defined.  If I add REQUEST manually to the object, the absolute_url
returns the object Id, but not the entire path.  I can inspect
absolute_url code and try to provide needed information to make work,
but I'm sure that somewhere should be a method to put my object in the
current publishing context.  Anybody knows about this?

Thanks a lot for your help.

-- 
Santi Camps
http://zetadb.sourceforge.net


___
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: Adapters in Zope 2

2004-02-10 Thread Santi Camps
  Casey Duncan wrote:
   Zope2 folders are designed for this. They are really just blank
   objects where you can specify your own methods in instance space.
   Traditionally in Zope2, there are two ways to do this: by adding
   method objects (External Methods, DTML methods, python scripts,
   ZPT) directly to the folder. Or by adding these objects above the
   folders and aquiring them which is a type of environmental
   inheritance. In the CMF this is codified in the skins tool which
   contains global methods which can be applied to basically any object
   in the site.
  
  Great explanation - would you give me a hint on the CMF part ?
  Which global methods do you speak of ?
 
 The CMF has a Tool infrastructure. Tools are persistent objects
 typically at the top of the CMF site. Tools provide methods and
 configuration for use by all objects in the site via acquisition. For
 example, the membership tool (portal_membership), provides methods to
 access member information and member folders.
 
 The portal_skins tool is special in that it actually contains framework
 and application defined method objects (scripts, templates, etc)
 organized into layers and configured into skins (which are lists of
 layers to use). The CMF Site object is a special Skinnable folder
 which allows methods available in the current skin (as described in the
 skins tool) to be acquired through it. This makes all of the method
 objects in the skin's layers globally available to all objects in the
 CMF site. 
 
 This solves several problems, one of which is a tendancy of top-heavy
 hierarchies in zope where lots of objects are in the root because they
 need to be global. The skin and layer mechanisms allow different sets of
 methods to be available depending on the application, products
 installed, site policy and user preferences.
 
 -Casey
 

Very interesting.  That's what I was looking for.  I will try to extract
this mechanism from CMF.

Thanks a lot for your answers

-- 
Santi Camps
http://zetadb.sourceforge.net


___
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] Adapters in Zope 2

2004-02-09 Thread Santi Camps
Hi all,

I know that adaptors are introduced in zope3 but, anybody knows if this
technique can be used in zope2 ?

I've been trying to add some extra functionallity to a Folder object
without inheriting, but I'm not able to make it work.  To maintain the
adapted object publishable I've rewrited __getattr__, but then some
extra problems appears.  

Anybody knows if there is a way to use adapters in zope2 ?  Or, if not,
there is some other way to add functionallity on-the-fly, without
inheriting ?

Thanks in advance

-- 
Santi Camps
http://zetadb.sourceforge.net


___
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] Where did __traceback_info__ go?

2003-12-21 Thread Santi Camps
 I upgraded to 2.7b3, and it looks quite solid!
 
 I have one problem, though: I can't find the full tracebacks that
 include __traceback_info__ anywhere!
 

You can add this to your standard_error_message:

dtml-if error_tb
  dtml-var error_tb
/dtml-if


-- 
Santi Camps
http://zetadb.sourceforge.net


___
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] session concurrency

2003-11-27 Thread Santi Camps
 It is unlikely that the the low conflict connection causes your
 problem. Low conflict affects the following situation:
 
You try to load an object (because it is not in your ZODB cache)
and get informed that is has been modified (by another commited
transaction) since your transaction started.
 
With a normal ZODB connection, you will get a ReadConflictError
as adding the object to your ZODB cache would make it inconsistent:
some objects would have the state from your transactions start
and others from a later date.
With a low conflict connection, the inconsistency is accepted
and no ReadConflictError is raised.
 
 As you described, you loose the session object.
 This is not easily understood as the effect of a cache inconsistency.
 

Sure.  Disabling Low conflict hasn't solved anything. 

I'm not able to find where is the problem.  I have not enought knowledge
of Zope internals.  I will try to store my data in persisten subobjects,
as you said.

One thing is true:  Changing session object simultaniously in various
frames doesn't work fine.  Sometimes session data is not the espected
becouse another frame has erased your changes in the session object.  

I think this is a serious inconvenient in front of other platforms. 
From my point of view, it would be better to have SESSION out of the
transaction but with changes stored inmediatly.  You don't?

Perhaps some day I will be able to implement this for myself.  Until
that, do you think I should enter a bug, or this cann't be considered as
a bug?

Thanks for your help

Santi Camps




___
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] session concurrency

2003-11-27 Thread Santi Camps
 I'm not able to find where is the problem.  I have not enought knowledge
 of Zope internals.  I will try to store my data in persisten subobjects,
 as you said.

Finally I've found a better and easy partial workarround.  I will
explain it here so other users in similar situation can know.

It consist in to have multiple Transitient Object Containers and
multiple Session Data Managers.  For instance, in my case:

Folder1/some_scripts
Folder1/session_data  (a Transitient Object Container)
Folder1/session_data_manager (a Session Data Manager using previous
object and referenced in REQUEST as SESSION_FOLDER1)

Folder2/some_scripts
Folder2/session_data (a Transitient Object Container)
Folder2/session_data_manager (a Session Data Manager using previous
object and referenced in REQUEST as SESSION_FOLDER2)

Then, scripts in Folder1 can use SESSION_FOLDER1 to store its session
data, scripts in Folder2 can use SESSION_FOLDER2 to do the same.  To use
SESSSION_FOLDER1 from scripts in Folder2, a simple traversal will work
fine.

Using this solution, my simultanious frames are working using session
with no problems.

Cheers 

Santi Camps
http://zetadb.sourceforge.net


___
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] session concurrency

2003-11-24 Thread Santi Camps
Hi all,

I've a product, http://zetadb.sourceforge.net, that uses SESSION
extensively.   I've just discover, unhappiness, that there are some
problems when SESSION object is changed at the same time in two diferent
python scripts (using frames).  The two frames are changing diferent
keys of the SESSION object, but at the end the whole SESSION object is
saved, I think, so one of the two objects losses its SESSION data

Anybody knows any workarround about this?  

Thanks in advance

Santi Camps


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