Re: [Zope-dev] Bug in DateTime.py

2000-08-08 Thread Steve Alexander

Karsten Petersen wrote:
 
 Hi,
 
 today I had *very* strange effects with the following code:
 dtml-let bla="_.DateTime('2000/08/08')"
   dtml-var blabr
   dtml-var expr="bla.parts()"br
   dtml-var expr="bla.strftime('%Y/%m/%d')"br
 /dtml-let
 
 on my system it gave me:
 2000/08/08
 (2000, 8, 8, 0, 0, 0, 'GMT+2')
 2000/08/07
 
 Well - this was not quite what I expected. :)
 
 I tracked the problem down to the timezone: When no time is given, the
 time is initialized with 00:00. So after applying gmtime in the strftime
 function (DateTime.py line 1379) it got shifted out and - hoppla - we
 have gone one day back in time. :)

Use the patch here:

  http://classic.zope.org:8080/Collector/1457/view

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

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




Re: [Zope-dev] Acquisition Confusion :S

2000-08-08 Thread Steve Alexander

Michel Pelletier has reminded me that we need a security check by
containment at each point in the search through context.

So, in my example, the search will look like this:

/
|-Aa
| |-B  b
|
|-Xx
| |-P  p1
| |-Y  y
|
|-Pp0

  Context-first
  Acquisition  (P of (B of (A of (Y of (X of /)))

  Security p0 /  b a /  a b  y x /  x /  / 
  Checks

That makes for a lot of security checks.
There are possible optimisations, though. But this starts to get even
more complicated.

--
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] DB Connection Question

2000-08-08 Thread Andre Schubert

Hi,

I have written a Product the uses a Databaseconnection to MySQL, that
works fine. but the connection in coded into my Product, and now i want
to use a Zope DatabaseConnection added to the same folder.
How does this works, it is very important for me, because we want to
change to another database, and because this fact it is very useful for
me to use an existing DataBaseConnection Object from Zope in my Product
to connect to a DataBase.


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




Re: [Zope-dev] RE: [Zope] ZPatterns Question

2000-08-08 Thread Phillip J. Eby

At 01:57 PM 8/8/00 +0200, RC Compaan wrote:
I've added a propertysheet called "properties" to my ZClass and i notice
there is Persistent Sheetprovider under the default rack already.  The
Sheetprovider has properties Sheet_Names and Sheet_Namespaces.  I guess
Sheet_Names should refer to the sheetname i created for my ZClass??? but how
do Sheet_Namespaces come into play.

Actually, neither relates.  Property sheets created on ZClasses always have
their data stored in attributes of the object itself, so if you want to
control those property sheets you would not use a sheet provider at all.
Sheet providers are only used to provide property sheets whose data is
stored external to the object.

The "name" refers to sheet names, yes, although again these are not ones
created on the ZClass, which will be handled by the ZClass.  The
"namespaces" refers to the XML namespaces of the property sheets, which is
a WebDAV thing.  In the WebDAV protocol, "property sets" are added/changed
using URLs as XML namespaces.  So you could have a property sheet whose XML
namespace is "http://www.zope.org/PTK/MemberProperties" and whose name is
just "MemberProperties" or "MemberInfo" or something else altogether.
ZPatterns supports WebDAV, and WebDAV requires the ability to add arbitrary
property sets with arbitrary properties to an object.  Also, the XML
namespaces concept can be useful as a way of avoiding name collisions
between frameworks.


From the IRC_Chatlog:
"Call "getItem(key)" to retrieve an item from the Specialist, and
"newItem(key)" to create a new item in the specialist."

Does this imply that I can simply call "newItem(key)" from a dtml-method
inside the specialist to create a new instance of my object?

Yes.



I think I understand ZPattern architecture somewhat but get lost on the
implementation side, particularly at that place where  attributes are
retrieved from storage or more clearly how a specialist(datamanager) links
up/communicates with a sheetprovider (data-plugin) and how the sheetprovider
in turn communicates with the rack and how the rack retrieves from storage
(dataskin).

A very simple outline like this would help me a lot, eg:
Specialist to Sheetprovider (handled in IDE - add a SheetProvider under
Plugins)
Sheetprovider to rack (handled in IDE - select Storage Class under rack)
Rack to Dataskin ()
Dataskin to physical storage ()

Roché

PS: I would be more than willing to document my enlightenment in a howto

The Specialist does not talk to the sheet provider.  The Specialist asks
its racks for an object.  The Rack which "retrieves" the object tells the
object that it belongs to the rack and should ask the rack for anything it
needs.  When the object needs a property sheet or attribute or whatever, it
asks the rack to give it a list of relevant providers for that
attribute/sheet/whatever.  It then walks the list asking those providers if
they can perform the function it desires.  If none of the providers are
successful, it performs a default behavior (such as raising an
AttributeError to indicate the attribute does not exist).  This general
pattern is followed for almost anything that can be delegated from a skin
to a provider.

When DataSkins are used outside a rack, the process is similar, except that
the DataSkin itself notices it is being retrieved from somewhere and has
not been told it belongs to a rack, so it searches its acquisition path
asking for a Customizer.  Once found, it then uses the Customizer in the
same way as it would have used the Rack (i.e. to ask for lists of providers
that might be useful for performing tasks it needs done).


___
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] Bug in DT_In.py, still using collector? Here's a patch

2000-08-08 Thread Brad Clements

In Zope 2.2.0 

If you have a bug in your DTML in a dtml-in xx next block, you don't 
see the bug. DT_In assumes that you just don't have more records to 
see.

DT_In.py, around line 545

This code:

elif next:
try:
# The following line is a sneaky way to test whether
# there are more items, without actually
# computing a length:
sequence[end]
pstart,pend,psize=opt(end+1-overlap,0,
  sz,orphan,sequence)
kw['next-sequence']=1
kw['next-sequence-start-index']=pstart-1
kw['next-sequence-end-index']=pend-1
kw['next-sequence-size']=pend+1-pstart
result=render(section,md)
except:
if self.elses: result=render(self.elses, md)
else: result=''

SHOULD BE:

elif next:
try:
# The following line is a sneaky way to test whether
# there are more items, without actually
# computing a length:
sequence[end]
pstart,pend,psize=opt(end+1-overlap,0,
  sz,orphan,sequence)
kw['next-sequence']=1
kw['next-sequence-start-index']=pstart-1
kw['next-sequence-end-index']=pend-1
kw['next-sequence-size']=pend+1-pstart
except:
if self.elses: result=render(self.elses, md)
else: result=''
else:
result=render(section,md)


Brad Clements,[EMAIL PROTECTED]   (315)268-1000
http://www.murkworks.com  (315)268-9812 Fax
netmeeting: ils://ils.murkworks.com   AOL-IM: BKClements

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