Re: [Zope-dev] Acquisition Confusion :S

2000-07-31 Thread Simon Michael

"Evan Simpson" <[EMAIL PROTECTED]> writes:
> The IPC8 slides are in error, and need to be fixed.

heh..like this stuff needs to be any harder.. 

still, can't have people breezing through it too quickly.. ;-)

___
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] Strange local(?) bug in uploading files

2000-07-31 Thread R. David Murray

On Mon, 31 Jul 2000, Peter Arvidsson wrote:
> I have a major problem with uploading files. I am doing a form to upload
> PDF-files This is what it looks like (with only the relevant code):
> pdf_form:

We helped Peter out on IRC.  Turns out he had a method named pdf that
was getting passed instead of his file object, also named pdf.

The explicit content type not working is a bug that is fixed in
the CVS version of Zope.

--RDM


___
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] Ids starting with _

2000-07-31 Thread R. David Murray

On Mon, 31 Jul 2000, Chris Withers wrote:
> Toby Dickenson wrote:
> > Almost all zope-manageable classes (and certainly Folders, that Dieter
> > mentioned) use the old rule. This happens because they derive from
> > SimpleItem.Item, which has __allow_access_to_unprotected_subobjects__=1
> 
> 1) Why does SimpleItem still have this?! Since so much, IIRC, is derived
> from SimpleItem.Item, surely this goes very much against the grain of
> 'everything should be protected unless I say otherwise'?

If you read the docs about the 2.2 security changes, you'll find the
explication.  Summary:  this is a transitional step.

> 2) Why does having __allow_access_to_unprotected_subobjects__=1 mean
> that the 'start with _ = hidden/no DTML, no web Access' ruel applies?

I don't think that's what he meant.  I think he meant that keeping
that _ behavior was necessary because most objects still use the
older 'wide open' security model.  But I could be wrong.

--RDM


___
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-07-31 Thread Chris Withers

I still don't get this :(

Here's the situation:

A has attributes B and C, C has attribute D

my old working:

A.B.C.D = (B o A) : .C.D

now, since C is found in A:

= ((C o A) o (B o A)) : .D

again since D is found in C:
 
= ((D o C) o ((C o A) o (B o A)))

However, this:
> This last line should be (((D o C) o (C o A)) o ((C o A) o (B o A))), which

Implies that rather than the rule I was working on which was:
If X is found in Y, the next line becomes ((X o Y) o {the last line})

This rule applies:
If X is found in Y, then the next line becomes (((X o Y) o (wrapper of
which Y was either parent or self)) o {the last line})

Is this the case?

If so, why? ;-)

> In this case aq_inner is the entire
> expression, since aq_self is not a wrapper.

I still don't get this at all :(

I hoep someone can help more :~(

> The IPC8 slides are in error, and need to be fixed.

Similarly, does the dev-wiki still have a purpose? It feels like the
unmaintained precursor to dev.zope.org...

cheers,

Chris

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




[Zope-dev] Re: Collector #1457: DateTime strftime() -- still broken

2000-07-31 Thread Steve Alexander

[EMAIL PROTECTED] wrote:
> 
> Steve Alexander reported:
> 
> > This is a patch to address collector item 1455.
> >
> > Here's a working patch to make formatting of a DateTime instance work as generally 
>expected, when you use
> >
> >   
> >
> > or whatever.
> >
> > It could be made more efficient by compiling the two regular expressions into 
>class attributes. However, a bug in ts_regex stops it using compiled regular 
>expressions in gsub.
> >
> > See the following URL for a description of the regex bug.
> >
> > http://lists.zope.org/pipermail/zope-dev/2000-July/006105.html
> >
> >
> 
> with patch:
> 
> > *** lib/python/DateTime/DateTime.old.py   Sun Jul 23 20:03:04 2000
> > --- lib/python/DateTime/DateTime.py   Mon Jul 24 14:01:37 2000
> > ***
> > *** 1376,1382 
> >   return millis
> >
> >   def strftime(self, format):
> > ! return strftime(format, gmtime(self.timeTime()))
> >
> >   # General formats from previous DateTime
> >   def Date(self):
> > --- 1376,1385 
> >   return millis
> >
> >   def strftime(self, format):
> > ! diff=_tzoffset(self._tz, self._t)
> > ! format = ts_regex.gsub('\(^\|[^%]\)%Z', '\\1'+self._tz, format)
> > ! format = ts_regex.gsub('\(^\|[^%]\)%z', '\\1%+05d' % (diff/36), format)
> > ! return strftime(format, gmtime(self.timeTime()+diff))
> >
> >   # General formats from previous DateTime
> >   def Date(self):
> >
> 
> Thanks for the report. Per popular demand based on list
> feedback, strftime() now formats using the current timezone
> representation of the DateTime object (consistent with all
> of the other DT formatting methods).
> 
> For those who really needed it to format based on GMT, you
> can use the toZone() method to get a copy of the DateTime
> object represented in GMT and call the formatting methods
> on that object:
> 
>   
> 
>   or
> 
>   
> 
> -Brian

I just looked at the fix in CVS. I'm sad to report that it is still
broken.

Here's the patched method from CVS:

def strftime(self, format):
# Format the date/time using the *current timezone
representation*.
jfirst = _julianday(self._year, 1, 1) - 1
jtoday = _julianday(self._year, self._month, self._day)
julian = jtoday - jfirst
time_info=(self._year, self._month, self._day,
   self._hour, self._minute, self._nearsec,
   (self._dayoffset + 6) % 7,
   julian,
   0)
return strftime(format, time_info)


This gets time.strftime to format the time in the DateTime instance,
shifted by an appropriate amount. However, if you try and format with %z
or %Z to display the timezone information, it always comes out as GMT.
So, the implementation has gone from correct but not useful, to
generally useful but technically incorrect.

To see the problem, apply the patch and try this DTML snippet:


  Time:  
  Time:  




This prints out the following:

Time: July 23, 2000 14:03 GMT 
Time: July 23, 2000 2:03 pm GMT+1 

They are being presented as different times.
The first one should read "Time: July 23, 2000 14:03 GMT+1".

A solution is to replace the %Z and %z format substrings with correctly
calculated values, as in my original patch, included towards the start
of this message.

--
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] Ids starting with _

2000-07-31 Thread Chris Withers

Toby Dickenson wrote:
> Almost all zope-manageable classes (and certainly Folders, that Dieter
> mentioned) use the old rule. This happens because they derive from
> SimpleItem.Item, which has __allow_access_to_unprotected_subobjects__=1

1) Why does SimpleItem still have this?! Since so much, IIRC, is derived
from SimpleItem.Item, surely this goes very much against the grain of
'everything should be protected unless I say otherwise'?

2) Why does having __allow_access_to_unprotected_subobjects__=1 mean
that the 'start with _ = hidden/no DTML, no web Access' ruel applies?

cheers,

Chris

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




Re: [Zope-dev] Re: ZScheduler and SSL

2000-07-31 Thread R. David Murray

On Mon, 31 Jul 2000, Loren Stafford wrote:
> If there is a generally available solution to this SSL client problem, I
> wouldn't mind building it into ZScheduler as an option. At the very least, I
> could encapsulate the client interface in a separate module. Then you could
> conveniently replace that module with your own.

Lynx has an ssl capable version, but it is currently considered
too buggy to be safe.

w3m also has an ssl version. 

Unfortunately I don't know if the ssl version of either one is
available for Windows.

--RDM


___
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] MethodGeddon

2000-07-31 Thread Shane Hathaway

Chris Withers wrote:
> 
> http://www.zope.org/Wikis/zope-dev/MethodGeddon
> 
> Just been reading about this and I was wondering how is coming along...

After more pondering I decided to throw out the idea for typed
arguments.  I was trying to solve a difficult problem with a
roundabout, and in the end more difficult solution.

> Is it in the fishbowl under another name or should it be in the
> fishbowl?

It would actually fall under the the "Current Projects" section.

http://dev.zope.org/Wikis/DevSite/Projects/PythonMethods/MethodObjectInterface

Alright, I didn't put it my comments in exactly the right place, but
it's close enough. :-)

> Shane, would the argument list be a management tab for methods?
> That sounds cool to me :-)

What I have done instead (and this is exactly the way Jim envisioned it
months ago) is added a "Bindings" tab to Python methods.  You just fill
in the names to be populated with an object's container, its context,
itself, the DTML namespace, and (this just in :-) the traversal
subpath.  Then I did the same thing with External Methods and combined
them into one product.  Unless my changes are vetoed, in the future you
won't be adding "External Methods" and "Python Methods" anymore, you'll
be adding "Python Method (Internal)" and "Python Method (External)"
instead.

I've checked it all into CVS but I'm not sure it's available to the
public.  Perhaps it should be; lobby Ken or Brian.  It's the module
Packages/Products/PythonMethod.

> I reckon 'self' should always be the equivalent of the python 'self' or
> not exist to avoid confusion. I guess that means it wouldn't get used
> much since it would be the actual method-object (and I thought that was
> an oxymoron ;-) but with the possibility opf things like __render__ and
> __call__, who knows...

Jim solved this confusion by letting you invent your own names, then we
made it easier to use by providing "recommended names": container,
self, m_self (the method object), _, and traverse_subpath.

Now, the bindings still aren't available to DTML methods.  But it
shouldn't be difficult to add.

> ...
> So you could get to any or all of those as you need in your method. Of
> course, new users wouldn't have to worry about this until they needed to
> do something that used it.

Right.  An important feature.

Shane

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




[Zope-dev] Are full pathnames in error messages a security bug?

2000-07-31 Thread R. David Murray

I don't know if this has been raised before, but the following excerpt
from the most recent SANS security alert concensus made me think:

-- Forwarded message --
[...]
--> {00.31.014} Apache TomCat leaks system information

Apache's TomCat server has been found to provide various types of system
information to an attacker-such as full system paths being displayed in
error messages. TomCat also comes with the "snoop" servlet, which
provides even more detailed information about the system when invoked.



Obviously the 'snoop' servlet is the reason this was posted, but
still, they are calling full path information a security leak.
Not perhaps something to put high on a priority list, but should there
be a way to prevent full path information from appearing in
error messages?  It would have the side benefit of making the
error messages more readable .

--RDM


___
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: ZScheduler and SSL

2000-07-31 Thread Loren Stafford

Jim,

It wouldn't be hard to modify ZScheduler to utilize some SSL-capable client
program instead of Client.py. There are just three lines in
ZScheduler/Dispatcher.py that deal with the client interface (search for
'client'). You might also have to munge the URL that you feed to the client
program (to get https:// instead of http://). (Hmmm. Not even MS Outlook is
SSL aware.)

What that client program might be, I don't know. But I wouldn't be surprised
if to find that you could call MSIE or Navigator or Mozilla with a
command-line interface. Does anyone else have any experience with this?

If there is a generally available solution to this SSL client problem, I
wouldn't mind building it into ZScheduler as an option. At the very least, I
could encapsulate the client interface in a separate module. Then you could
conveniently replace that module with your own.

-- Loren


- Original Message -
From: "Jim Sanford" <[EMAIL PROTECTED]>
To: "Loren Stafford" <[EMAIL PROTECTED]>
Sent: July 31, 2000 07:03 AM
Subject: Re: ZScheduler and SSL [was: Zope.org feedback]


> Every link is hard coded and is fully qualified so I don't
> use absolute_url in any of my code. What Zope does is beyond
> my knowledge.
>
> I access Zope via PCGI behind MS IIS 4.0 and have had no
> other problems with SSL. Speed is not a problem because we
> have a accelerator card that handles the SSL number
> crunching.
>
> Looks like I will have to figure out a way to handle
> scheduled events (primarily executing reports and emailing
> them to different list sof people, primarily management
> types.) Probably with an external method.
>
> Jim
>
> - Original Message -
> From: "Loren Stafford" <[EMAIL PROTECTED]>
> To: "Jim Sanford" <[EMAIL PROTECTED]>
> Sent: Sunday, July 30, 2000 4:48 PM
> Subject: ZScheduler and SSL [was: Zope.org feedback]
>
>
> Have you run into other problems with Zope and SSL?  For
> example, the
> absolute_url method -- does it it always return
> http://something or does it
> return the same protocol specifier used for the request?
>
> I ask, because ZScheduler depends on absolute_url. I also
> wonder whether the
> value of absolute_url will always be correct for ZScheduler
> purposes in
> virtual-hosting environments.
>
> -- Loren
>
> - Original Message -
> From: "Jim Sanford" <[EMAIL PROTECTED]>
> To: "Loren Stafford" <[EMAIL PROTECTED]>; "Zope List"
> <[EMAIL PROTECTED]>
> Sent: July 28, 2000 03:39 PM
> Subject: Re: Zope.org feedback
>
>
> > We have no http access to our site.
> >
> > It is a corporate Client Relationship Management, Job
> Tracking and Order
> Processing, Production and Tracking system that is accessed
> > from all over the world.
> >
> > I will send this to the list to see if any one else can
> provide help.
> >
> >
> > - Original Message -
> > From: Loren Stafford <[EMAIL PROTECTED]>
> > To: Jim Sanford <[EMAIL PROTECTED]>
> > Sent: Friday, July 28, 2000 5:14 PM
> > Subject: Re: Zope.org feedback
> >
> >
> >
> >
> > > URL: http://www.zope.org/Members/lstaffor
> > > ZScheduler uses Client.py.
> > >
> > > Would it be correct to say that if my entire site is
> only accessible via
> > SSL (https) that ZScheduler will not work?
> >
> > I hadn't thought about this before, so you probably know
> more about it
> than
> > I do. But given that the python lib that Client.py uses
> for http
> > (httplib.py) doesn't support https, then you're right.
> >
> > Solutions?
> >
> > 1. Permit http traffic to your site if it comes fromt the
> same IP and is
> for
> > URLs that end in "/trigger". I suppose that IP spoofing
> makes this
> something
> > of a security hole. How bad?
> >
> > 2. Enhance either Client.py or httplib.py to support at
> least enough https
> > to get the job done. I know nothing about this. Is it
> reasonably doable?
> Is
> > there a Zopista willing and able to do it?
> >
> > 3. ?
> >
> > -- Loren



___
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: zscheduler question

2000-07-31 Thread Loren Stafford

Klaus,

Thank you for being an alpha tester of ZScheduler. Let's carry on these
discussions on zope-dev (as long as it's still an alpha product), for the
benefit of other alpha testers, and to benefit from the ideas of other
developers.


From: "Klaus Ahrens" <[EMAIL PROTECTED]>


> Loren Stafford wrote:
> >
> > Here's a simple DTML method that adds a simple ZEvent. You'll have to
modify
> > it for your subclass and parameters.
> >
> > 
> > 
> > 
> >
> > -- HTH
> > -- Loren
>
> thank you very much for the quick response!
>
> some details are not quite clear for me:
>
> - i see that after calling (for testing purposes: viewing !?)
>   such a dtml-method creates a new zevent, which when it's due
>   does the requested action, but after that, the zevent should
>   vanish ! but how?

As ZScheduler is currently designed, ZEvents don't automatically vanish.
Past events that have not been rescheduled continue to exist and continue to
be catalogued with a "null" time (DateTime(0)). I'll have to think about
whether auto-deletion is an essential feature, and how it should be
implemented. What do other developers think?  What does 'cron' do?

To delete ZEvents programmatically, you have to use the manage_delObjects
method. It takes a list of object IDs as its argument. In the context of the
parent folder of the events:

  manage_delObjects(['votingEventId1', 'votingEventId2', ...])

If all your ZEvents are in one folder you can make a list of the IDs of
'null' events thus:



  

  



You could also use the Schedule (which is a catalog of ZEvents) to find all
expired ZEvents.



  



You could even make one of these methods a repetitive ZEvent that runs every
day (or whatever interval) and removes "null" ZEvents. Would that approach
suit your application?

Clearly these methods are a little sketchy. You'll have to do a little DTML
programming to get them to do what you want in your environment.

> moreover: if there are several pending zevents
>   they must have different id's: so i need some automatic
>   numbering scheme for multiple zevents and some
>   ...deleteOneTimeEvent (... this() ...) -magic
>   as a side effect of the triggered action. i have no idea how
>   to do that !?

You need to append some kind of "uniquifier" to the id of the ZEvent before
you create it. You could create a counter property and increment it each
time you use it (not recommended for frequent use). You could use some form
of DateTime(). I seem to remember a  discussion of this subject on zope-dev.

>
> - one problem with DateTime which has to do with a
>   time zone bug (i suppose) is the following: all scheduled
>   DateTimes go off by one hour, even
>
>   _.DateTime() and
>   _.DateTime()+0
>
>   or
>
>   _.DateTime('gmt+1') and
>   _.DateTime('gmt+1')+0
>
>
>   report different times:
>
> 2000/07/31 11:16:46.517 GMT+1 (<--- now)
> 2000/07/31 10:16:46.5327 GMT+1
>
> !some millis due to the execution seuqence are not
> the problem
>
>   i know, that has nothing to do with zscheduler
>   but do you have any clue ?

ZScheduler depends on having a correctly-functioning DateTime module. I've
been reading the discussions on zope and zope-dev lists with some
consternation, but I think others have analyzed the problem thoroughly.
ZScheduler's use of DateTime is very simple and straight-forward. It does
not do anything to make it an more or any less vulnerable to DateTime
anomalies. I can only advise that you keep "up-to-date" with the latest
DateTime discussions (on both zope and zope-dev) and patches.

-- HTH
-- Loren


___
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] dtml-var tag suggestion

2000-07-31 Thread Casey Duncan

Thanks, that works good. It also escapes any special characters in the
string, an added bonus.

The only case I found where a new format option would work better is if you
use the dtml-var size option to limit the size of the string. I will
continue to play with it and see what I come up with.

Perhaps an option to back_quote should be added to dtml-var to eliminate
somewhat hairy looking expressions like this (taken from my code):



I never thought I would use every type of quotation mark in a single
expression! 8^)

Thanks!

-Casey D.

-Original Message-
From: Duncan Booth [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 31, 2000 10:09 AM
To: Casey Duncan; [EMAIL PROTECTED]
Subject: Re: [Zope-dev] dtml-var tag suggestion


> I have been using dtml to create dynamic JavaScripts for some forms I am
> creating. In doing this I came upon the standard problem of inserting
> strings containing double quotes into a JavaScript such as where title =
> '"Quoted String"':
>
> form.select.options[0].text = "";
>
> And you wind up with this rendered:
>
> form.select.options[0].text = ""Quoted String"";
>
Given that, like Python, javascript accepts strings either single or
double quoted, you could try using backquotes to escape the
string:

 form.select.options[0].text = ;

should (untested) give you:

 form.select.options[0].text = '"Quoted String"';

Provided title is a string, this will escape any quotes and, for that
matter, unprintable characters, and wrap either single or double
quotes round the outside. If title is a method then you need to call
it first: 

--
Duncan Booth
[EMAIL PROTECTED]
int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3"
"\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure?
http://dales.rmplc.co.uk/Duncan


___
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] Strange local(?) bug in uploading files

2000-07-31 Thread Peter Arvidsson

I have a major problem with uploading files. I am doing a form to upload
PDF-files This is what it looks like (with only the relevant code):
pdf_form:


Title:

PDF:





pdf_method:






When I run this code in 2.1.6 it almost works. The content_type is wrong
but if you edit this property and set it to "application/pdf" it works.
(This is another strange problem.. this should be set automaticlly. I
doesnt work when I pass content_type='application/pdf' either.)

However when I try to run this in Zope 2.2 i get the following error
(with traceback):

Error Type: AttributeError
Error Value: seek

Traceback (innermost last):
  File
/usr/local/new.test.version.of.zope.DO.NOT.REMOVE/lib/python/ZPublisher/Publish.py,
line 222, in publish_module
  File
/usr/local/new.test.version.of.zope.DO.NOT.REMOVE/lib/python/ZPublisher/Publish.py,
line 187, in publish
  File
/usr/local/new.test.version.of.zope.DO.NOT.REMOVE/lib/python/Zope/__init__.py,
line 221, in zpublisher_exception_hook
(Object: ElementWithAttributes)
  File
/usr/local/new.test.version.of.zope.DO.NOT.REMOVE/lib/python/ZPublisher/Publish.py,
line 171, in publish
  File
/usr/local/new.test.version.of.zope.DO.NOT.REMOVE/lib/python/ZPublisher/mapply.py,
line 160, in mapply
(Object: pdf_method)
  File
/usr/local/new.test.version.of.zope.DO.NOT.REMOVE/lib/python/ZPublisher/Publish.py,
line 112, in call_object
(Object: pdf_method)
  File
/usr/local/new.test.version.of.zope.DO.NOT.REMOVE/lib/python/OFS/DTMLMethod.py,
line 167, in __call__
(Object: pdf_method)
  File
/usr/local/new.test.version.of.zope.DO.NOT.REMOVE/lib/python/DocumentTemplate/DT_String.py,
line 502, in __call__
(Object: pdf_method)
  File /usr/local/zope/lib/python/DocumentTemplate/DT_Util.py, line 342,
in eval
(Object: manage_addFile(pdfid, file=pdf, title=titlepdf))
(Info: pdf)
  File , line 0, in ?
  File
/usr/local/new.test.version.of.zope.DO.NOT.REMOVE/lib/python/OFS/Image.py,
line 125, in manage_addFile
(Object: ElementWithAttributes)
  File
/usr/local/new.test.version.of.zope.DO.NOT.REMOVE/lib/python/OFS/Image.py,
line 271, in manage_upload
(Object: 965062238)
  File
/usr/local/new.test.version.of.zope.DO.NOT.REMOVE/lib/python/OFS/Image.py,
line 304, in _read_data
(Object: 965062238)
AttributeError: (see above)


I tried to look in the python-files for manage_addFile but I didnt see
anything wrong there (however I am a python newbie :) Why do I get this
error in 2.2? I have tried everything and consulted the irc-channel but
noone could help me. Is this a bug in 2.2 or am I doing something wrong?


___
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-07-31 Thread Evan Simpson

From: Chris Withers <[EMAIL PROTECTED]>
> In anser to 'What is A.B.C.D?' I can't see how you can get:
> ((D o (C o A)) o (B o A))
>
> Here's my working:
>
> A.B.C.D = (B o A) : .C.D
> = ((C o A) o (B o A)) : .D
> = ((D o C) o ((C o A) o (B o A)))

This last line should be (((D o C) o (C o A)) o ((C o A) o (B o A))), which
simplifies to ((D o (C o A)) o ((C o A) o (B o A)))
and then (D o ((C o A) o (B o A))).  In this case aq_inner is the entire
expression, since aq_self is not a wrapper.

The IPC8 slides are in error, and need to be fixed.

Cheers,

Evan @ digicool & 4-am


___
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] ZOracle LOB Questions

2000-07-31 Thread Matthew T. Kromer

Alexander Schad wrote:
> 
> > Alex, Oracle 8i broke DCOracle's support for LOBs; DCOracle primarily
> > uses OCI 7 (Oracle 7) calls, and Oracle 8i enforces a restriction that
> > OCI 8 objects cannot be used in the context of an OCI 7 statement.
> >
> > You can use Oracle 8.0 for this, the restriction isn't enforced until
> > Oracle 8.1.
> >
> 
> Hello!
> thank you for your answer. but does that mean that i can only use LOBS
> with Oracle 8.0 ?
> i'm confused. i need to use LOBs. if i use oracle 8.1 can i use LOBS and
> if yes which Databse adapter do i need?

If your database adapter is 8.0 you can probably use LOBs, if
the adapter is 8.1 you probably can't.  I never mix and match
adatpters vs. databases, though, so your mileage my vary.  By
this I mean, you could use 8.0 libraries to access an 8.1
database via SQL*NET.  I *think* the error is actually being
raised at the library level, not the server itself.

___
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] Acquisition Confusion :S

2000-07-31 Thread Chris Withers

Hi Jim, (or any zope-dev'ers who can explain this ;-)

I've just been reading:
http://www.zope.org/Members/jim/Info/IPC8/AcquisitionAlgebra

...and I've got confused on the 'Getting the containment wrapper'
section.

In anser to 'What is A.B.C.D?' I can't see how you can get:
((D o (C o A)) o (B o A))

Here's my working:

A.B.C.D = (B o A) : .C.D
= ((C o A) o (B o A)) : .D
= ((D o C) o ((C o A) o (B o A)))

You can't apply the simplification:
((Z o Y) o (Y o Z))

to the leftmost section 'cos the brackets are in the wrong place...

so how to you make the jump to:

= ((D o (C o A)) o (B o A)) (but should it?!)

Also, is the definition "aq_inner is obtained by finding the innermost
wrapped object" the same as "aq_inner is the 'self'/'object' part of the
current aquisiton wrapper"?

Confusedly and looking for help,

Chris

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




Re: [Zope-dev] ZOracle LOB Questions

2000-07-31 Thread Alexander Schad


> Alex, Oracle 8i broke DCOracle's support for LOBs; DCOracle primarily
> uses OCI 7 (Oracle 7) calls, and Oracle 8i enforces a restriction that
> OCI 8 objects cannot be used in the context of an OCI 7 statement.
> 
> You can use Oracle 8.0 for this, the restriction isn't enforced until
> Oracle 8.1.
> 

Hello!
thank you for your answer. but does that mean that i can only use LOBS
with Oracle 8.0 ?
i'm confused. i need to use LOBs. if i use oracle 8.1 can i use LOBS and
if yes which Databse adapter do i need?

Ciao,
Alex

--
 Alexander G. Schad (Programmer)beehive elektronische medien gmbh
--
 mailto:[EMAIL PROTECTED]  mailto:[EMAIL PROTECTED]
http://www.beehive.de
fon: (+49 30) 84 78 20
fax: (+49 30) 84 78 22 99



___
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] ZOracle LOB Questions

2000-07-31 Thread Matthew T. Kromer

Alexander Schad wrote:
> 
> Hello!
> 
> i have Oracle 8.1.6 ZOracleDA 2.2 installed with Zope 2.1.6 on a red hat
> linux machine.
> 
> i have an oracle table with one column containing blobs. Now i have
> the following problems:
> 
> 1. How can i retrieve data from that table in zope or in python (syntax) ?
> 
> 2. How can i insert data to that table ?
>i need the zope syntax something like:
> insert into blob_table values ('') ???
>or the python syntax
> 
> i have written a little script:
> 
> import DCOracle, sys, os, DCOracle.dbi
> 
> dbc = DCOracle.Connect('mozdb_dba/mozdb_dba')
> cur = dbc.cursor()
> fn = open('test_img.jpg','rb')
> data = fn.read()
> fn.close()
> param = DCOracle.dbi.dbiRaw(data)
> cur.execute('select blobcol from blobtable')
> dat = cur.fetchone()
> cur.close()
> dbc.close()
> print dat
> 
> when i try to execute it i get the following error:
> 
> Traceback (innermost last):
>   File "blobtest.py", line 12, in ?
> dat = cur.fetchone()
>   File "DCOracle/ociCurs.py", line 339, in fetchone
> self._error()
>   File "DCOracle/ociCurs.py", line 109, in _error
> raise error, (rc, oci_.OracleErrorMessage(self._c.lda, rc))
> oci.error: (24813, 'ORA-24813: cannot send or receive an unsupported
> LOB\012')
> 
> 3. Is there a way to call a stored procedure or function that actually
>return values ?
>i succeeded in retrieving one particular value out of a table but when
>i try a function like :
> select * from some_table
>i fail...
> 
> 4. Changes.txt:
> 
>   Z Oracle DA Releases
> 
>   2.2.0
> 
> Added a small feature that allows you to access LOBs in the Oracle
> database.  To do this, you must have your maximum number of
> results set to '1'.  Otherwise, it won't work.
> 
>   i don't know what this is referring to. where should i make this change?
> 
> Ciao,
> Alex
>

Alex, Oracle 8i broke DCOracle's support for LOBs; DCOracle primarily
uses OCI 7 (Oracle 7) calls, and Oracle 8i enforces a restriction that
OCI 8 objects cannot be used in the context of an OCI 7 statement.

You can use Oracle 8.0 for this, the restriction isn't enforced until
Oracle 8.1.

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




Re: [Zope-dev] dtml-var tag suggestion

2000-07-31 Thread Duncan Booth

> I have been using dtml to create dynamic JavaScripts for some forms I am
> creating. In doing this I came upon the standard problem of inserting
> strings containing double quotes into a JavaScript such as where title =
> '"Quoted String"':
> 
> form.select.options[0].text = "";
> 
> And you wind up with this rendered:
> 
> form.select.options[0].text = ""Quoted String"";
> 
Given that, like Python, javascript accepts strings either single or 
double quoted, you could try using backquotes to escape the 
string:

 form.select.options[0].text = ;

should (untested) give you:

 form.select.options[0].text = '"Quoted String"';

Provided title is a string, this will escape any quotes and, for that 
matter, unprintable characters, and wrap either single or double 
quotes round the outside. If title is a method then you need to call 
it first: 

-- 
Duncan Booth [EMAIL PROTECTED]
int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3"
"\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure?
http://dales.rmplc.co.uk/Duncan

___
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: Additional Quoting; Exposing Auxiliary Tag Functions via "_"

2000-07-31 Thread Casey Duncan

Dieter Maurer writes:
> The existing "quote features" name the context for which quoting
> is needed. The context determines what needs to be quoted and
> how quoting has to be done.
> Your proposal does not state the context but only the how.
> Otherwise, I would think such an extension would be good.

You are right here. I just came up with "slash_quote" off the top of my
head. "string_quote" is a good language-neutral name I think that is similar
in spirit to the present format options.

> Thus, I propose:

> 1. new quoting directive "string_quote" quoting Python strings
>i.e. ", ' and \ are quoted.
>This would work for Javascript (and other languages with
>C-like quotation and string literals), too.

> 2. all auxiliary functions for DTML tags, especially quoting,
>should be available via the namespace.

>To avaid namespace pollution, they may go into a separate
>module, say 'aux'.
>E.g. I would like to use quoting, formatting etc.
>inside DTML embedded Python expressions in a form like that:

>   
>and
>

This idea has merit, and extends the usefulness of these options to parts of
an expression rather than just the whole thing. I think calling the module
'aux' might not be the best for code readability sake though. Perhaps it
should just be called fmt or format. Perhaps like so:


and


newbie format methods could be added too (Feature creep alert!) like:



in place of the first one.


___
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] Ids starting with _

2000-07-31 Thread Toby Dickenson

On Sun, 30 Jul 2000 10:38:44 +0100, Chris Withers <[EMAIL PROTECTED]>
wrote:

>Dieter Maurer wrote:
>>  > I wonder why starting folders with _ is so bad in Zope?
>
>> In the time, when everything was allowed what was not explicitely
>> forbidden, an easy way was necessary to forbid access. Jim
>> (and, therefore, Zope) used:
>> 
>>   anything starting with "_" is private: no DTML access, no Web access.
>> 
>> Now, with the change to a security policy "Everything is
>> forbidden when not explicitely allowed", the need for
>> such a rule based on naming dwindles. Maybe, it will disappear
>> sometime in the future.

That rules applies at a lower level. It removes the need to have
special-case handling for the many low-level objects that should never
be web-accessible.

Almost all zope-manageable classes (and certainly Folders, that Dieter
mentioned) use the old rule. This happens because they derive from
SimpleItem.Item, which has __allow_access_to_unprotected_subobjects__.





Toby Dickenson
[EMAIL PROTECTED]

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




[Zope-dev] ZOracle LOB Questions

2000-07-31 Thread Alexander Schad

Hello!

i have Oracle 8.1.6 ZOracleDA 2.2 installed with Zope 2.1.6 on a red hat
linux machine.

i have an oracle table with one column containing blobs. Now i have
the following problems:

1. How can i retrieve data from that table in zope or in python (syntax) ?

2. How can i insert data to that table ?
   i need the zope syntax something like:
insert into blob_table values ('') ???
   or the python syntax 

i have written a little script:

import DCOracle, sys, os, DCOracle.dbi

dbc = DCOracle.Connect('mozdb_dba/mozdb_dba')
cur = dbc.cursor()
fn = open('test_img.jpg','rb')
data = fn.read()
fn.close()
param = DCOracle.dbi.dbiRaw(data)
cur.execute('select blobcol from blobtable')
dat = cur.fetchone()
cur.close()
dbc.close()
print dat

when i try to execute it i get the following error:

Traceback (innermost last):
  File "blobtest.py", line 12, in ?
dat = cur.fetchone()
  File "DCOracle/ociCurs.py", line 339, in fetchone
self._error()
  File "DCOracle/ociCurs.py", line 109, in _error
raise error, (rc, oci_.OracleErrorMessage(self._c.lda, rc))
oci.error: (24813, 'ORA-24813: cannot send or receive an unsupported
LOB\012')

3. Is there a way to call a stored procedure or function that actually
   return values ? 
   i succeeded in retrieving one particular value out of a table but when
   i try a function like :
select * from some_table
   i fail...


4. Changes.txt:

  Z Oracle DA Releases

  2.2.0

Added a small feature that allows you to access LOBs in the Oracle 
database.  To do this, you must have your maximum number of
results set to '1'.  Otherwise, it won't work.

  i don't know what this is referring to. where should i make this change?

Ciao,
Alex


--
 Alexander G. Schad (Programmer)beehive elektronische medien gmbh
--
 mailto:[EMAIL PROTECTED]  mailto:[EMAIL PROTECTED]
http://www.beehive.de
fon: (+49 30) 84 78 20
fax: (+49 30) 84 78 22 99


___
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] ZPatterns design question

2000-07-31 Thread Steve Alexander

"Phillip J. Eby" wrote:
> 
> At 11:09 PM 7/30/00 +0100, Steve Alexander wrote:
> >Let's say I have an AddressBook specialist.
> 
> Why?  :)
> 
> Seriously, what is the function of "address book" in your application?  Is
> it to find people in general?  Or...?

As in your example later, the Addresses specialist is at a different
level of abstraction than other specialists.

The domain expert tells me that he want to keep particular information
about Suppliers: what they supply, and their address details. However,
he also wants to store the address details of any other contacts he
wishes. He'll sometimes need to search through all of the contacts and
suppliers (and in future, anyone that has an address) by phone number or
name or address. The domain expert calls the thing that allows him to do
the searching (and also browsing) of addresses his "address book", and
it reflects a real paper-based artifact. I'm sure I could rename it
"Contacts" or "Addresses" without causing too much confusion, though.

>From the way I just described it, there is no requirement for the
addresses to be stored all in one place. There is a requirement that you
can search and browse through all addresses, and return the appropriate
object.

So, I guess a good way to go is to add an "address" propertysheet to
Contact and Supplier, and have triggers that add the address details of
both to an Address catalogue.

> >
> >Bunch of questions:
> >
> >Is this the ZPatterns ideomatic way to do this?
> 
> Dunno.  Explain the problem you're trying to solve, and I'll
> tell you the simplest way I know to do it.
   

Aha... the missing link :-)


> >What kind of propertysheet should I be using?
> 
> Depends on what your application needs.  I can see circumstances where the
> best place for that sheet could be LDAP, SQL, or the ZODB.  

I wasn't being very clear there.  What kind of propertysheet should I be
adding to my DataSkin-derived ZClasses?

There are two kinds: "Common instance" and "DataSkin attribute".

It looks to me like at present the "DataSkin attribute" flavour will
work better with SkinScript.


> In which case, I think your
> confusion comes from terminology.  I would expect to store "Contacts" or
> "Entries" in an addressbook, and these would have address sheets, as would
> "Suppliers" or whatever else.

That makes sense. Suppliers are sored in the Suppliers specialist, and
general Contacts are stored in the Contacts specialist. The contacts
specialist provides searching appropriate to the domain of addresses and
contacts.


> Anyway, to answer your question - I think that your getItem() for an
> address specialist wants to return some object with an address sheet.  But
> not an address object.  Contact, Entry, Supplier, TennisBuddy...  whatever
> the heck kind of object it is.

This is starting to make much more sense.

Many thanks.

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