Vedr. [Zope3-Users] Web Component Development with Zope 3 (2nd edition)

2007-03-01 Thread Torvald Bringsvor

--- Jonathan [EMAIL PROTECTED] skrev:

 For whoever may be interested...
 
 Amazon.com is finally shipping the second edition of
 Philipp's book (ordered 
 Dec 6/06, shipped on Feb 24/07, arrived today!)

I got mine from amazon.co.uk ages ago. Well, you are
in for a good read then.

-Torvald

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] What is the difference between acquisition and trivial?

2007-03-01 Thread Chris Withers

Alex Cheng wrote:

Thanks.


What 'trivial' are you referring to?

cheers,

Chris

--
Simplistix - Content Management, Zope  Python Consulting
   - http://www.simplistix.co.uk
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Re: Unicode for Stupid Americans (like me)?

2007-03-01 Thread Raphael Ritz

Jeff Shell schrieb:
[..]


I feel like I know enough to squeak by, but that's no longer
acceptable. Sometimes I quiver in terror, waiting for everything to
fall down because of something so seemingly basic like strings/text.
It may be a lot of technical debt, or it may be extremely easy to pay
down. In any case, it's time to pay it down. :)



In addition to what has already been said (and maybe not really
what you are asking for), the number one problem people encounter
can be illustrated within a simple interactive Python session
like this one:

[EMAIL PROTECTED] ~]$ python244
Python 2.4.4 (#1, Jan 29 2007, 13:00:46)
[GCC 4.1.1 20060525 (Red Hat 4.1.1-1)] on linux2
Type help, copyright, credits or license for more information.
 s1 = uI'm unicode
 s2 = I'm a byte string
 s1 + s2
uI'm unicodeI'm a byte string
 s1 = uI'm unicode äöü
 s1
uI'm unicode \xe4\xf6\xfc
 s2 = I'm a byte string äöü
 s2
I'm a byte string \xc3\xa4\xc3\xb6\xc3\xbc
 s1 + s2
Traceback (most recent call last):
  File stdin, line 1, in ?
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 18: 
ordinal not in range(128)

 s1 + s2.decode('utf-8')
uI'm unicode \xe4\xf6\xfcI'm a byte string \xe4\xf6\xfc


It's Python's implicit casting of byte strings to unicode strings
the moment it has to deal with both together with Python's default
encoding being 'ascii' (don't ask why - it's been a long discussion
at the time ...).

The moment you get the strings involved from some application
call or third-party code you often don't really know what you
will get, so unless you do extensive checks and explicit
decoding using the right codec you'll never be on the safe side.

Within Zope 3, however, this should be a non-issue as Zope 3
(including Zope 3-based applications) should only use unicode
strings.

Just my 2 cents.

Raphael





___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Default value for an interface attribute

2007-03-01 Thread Douglas Douglas
Hi everybody.

I have this interface:

class INews(IPage):
A news page for the application.


date = Date(
title=_(uPublication Date),
description=_(uThe intended date for this news),
default=date.today(),
required=False
)

My problem is that I started the instance on February 21, and when I use an
AddForm for this interface, my form shows that date instead of today's date,
which is what I need.

It seems like the default attribute is set once upon server start and then
never changed. Is that the case? If it is, could you please point me to a
better approach for this?

Thanks.


 

Want to start your own business?
Learn how on Yahoo! Small Business.
http://smallbusiness.yahoo.com/r-index
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Re: zope.testbrowser and ZMI?

2007-03-01 Thread Basil Shubin

Philipp von Weitershausen wrote:

Basil Shubin wrote:

Hi friends!

Hmm... strange thing...

With this code I got:

  browser = Browser('http://localhost:8080/')
  browser.addHeader('Authorization', 'Basic admin:admin')
  browser.open('http://localhost:8080/manage')
Traceback (most recent call last):

...

urllib2.HTTPError: HTTP Error 500: Internal Server Error


Add

   browser.handleErrors = False

to see the real exception, not just an HTTP 500.


Above exception is the same, as with browser.handleErrors = False

Totaly confused here, is the above method is *right* to access ZMI?

What is *right* way to access ZMI via zope.testbrowser?

Thanks!

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Re: zope.testbrowser and ZMI?

2007-03-01 Thread Stephan Richter
On Thursday 01 March 2007 10:17, Basil Shubin wrote:
    browser.addHeader('Authorization', 'Basic admin:admin')

This authorization is not correct. You need to use:

   manager.addHeader('Authorization', 'Basic mgr:mgrpw')

At least this is the default.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics  Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Default value for an interface attribute

2007-03-01 Thread Maciej Wisniowski

 I have this interface:

 class INews(IPage):
 A news page for the application.
 

 date = Date(
 title=_(uPublication Date),
 description=_(uThe intended date for this news),
 default=date.today(),
 required=False
 )
   
With formlib (in Five in fact, not with Zope3) I was creating
form_fields that should have dynamic defaults in __call__
method of formlib's AddForm (EditForm)
view. I think it is not nice solution so I'd love to see
better way of doing this.

-- 
Maciej Wisniowski
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Re: Default value for an interface attribute

2007-03-01 Thread Raphael Ritz

Maciej Wisniowski schrieb:

I have this interface:

class INews(IPage):
A news page for the application.


date = Date(
title=_(uPublication Date),
description=_(uThe intended date for this news),
default=date.today(),
required=False
)
  

With formlib (in Five in fact, not with Zope3) I was creating
form_fields that should have dynamic defaults in __call__
method of formlib's AddForm (EditForm)
view. I think it is not nice solution so I'd love to see
better way of doing this.



How about checking whether the value of 'default' is a
callable and if so call it to obtain the default value.
That way

   defautl=date.today

(without the ())should do what Douglas expects (maybe
this is even the case already?).

Not that you want to know this but in Archetypes we explicitly
support 'default' and 'default_method' as field properties.
If no 'default' is provided, 'default_method' is looked up and
if it exists it's called.

Raphael

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Re: Default value for an interface attribute

2007-03-01 Thread Douglas Douglas

--- Raphael Ritz [EMAIL PROTECTED] wrote:

 How about checking whether the value of 'default' is a
 callable and if so call it to obtain the default value.
 That way
 
 defautl=date.today
 
 (without the ())should do what Douglas expects (maybe
 this is even the case already?).
 

I tried this way, but raises this Exception:

ConfigurationError: ('Invalid value for', 'interface', (built-in method today
of type object at 0xb79465c0, type 'datetime.date'))



 

Now that's room service!  Choose from over 150,000 hotels
in 45,000 destinations on Yahoo! Travel to find your fit.
http://farechase.yahoo.com/promo-generic-14795097
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Re: Default value for an interface attribute

2007-03-01 Thread Maciej Wisniowski

 How about checking whether the value of 'default' is a
 callable and if so call it to obtain the default value.
Yup... but evaluation of this is done internally by Zope schema
package in Field class I think. Seems for me that there is no way
to define 'default' as callable.

-- 
Maciej Wisniowski
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Re: Unicode for Stupid Americans (like me)?

2007-03-01 Thread Paul Winkler
On Wed, Feb 28, 2007 at 09:08:03PM -0500, Gary Poster wrote:
 It's been years since I dug into this, but I'm better than 90% sure  
 that the browser is expected to make its requests in the encoding of  
 the response (i.e., the one set by Content-Type).  It's been too long  
 for me to tell you if that's in a spec or if it is simply the de  
 facto rule, though I suspect the former.

That almost makes sense, except that the first request precedes the
first response :) I'll have to dig into this some more when I have
time...

-- 

Paul Winkler
http://www.slinkp.com
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Re: Default value for an interface attribute

2007-03-01 Thread Christian Theune
Hi,

Am Donnerstag, den 01.03.2007, 16:54 +0100 schrieb Maciej Wisniowski:
  How about checking whether the value of 'default' is a
  callable and if so call it to obtain the default value.
 Yup... but evaluation of this is done internally by Zope schema
 package in Field class I think. Seems for me that there is no way
 to define 'default' as callable.

Right. This is an unsupported use case. I bet if someone writes up a
proposal and brings it up to discussion on zope3-dev@zope.org we'll find
a common solution to this.

Please also notice that we're moving to using launchpad more heavily. So
if you write a proposal in the wiki, please also submit it as a feature
request (blue print) in launchpad for the Zope 3 product.

Christian

-- 
gocept gmbh  co. kg - forsterstraße 29 - 06112 halle/saale - germany
www.gocept.com - [EMAIL PROTECTED] - phone +49 345 122 9889 7 -
fax +49 345 122 9889 1 - zope and plone consulting and development


signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Re: zope.testbrowser and ZMI?

2007-03-01 Thread Philipp von Weitershausen

Stephan Richter wrote:

On Thursday 01 March 2007 10:17, Basil Shubin wrote:

  browser.addHeader('Authorization', 'Basic admin:admin')


This authorization is not correct. You need to use:

   manager.addHeader('Authorization', 'Basic mgr:mgrpw')

At least this is the default.


In most Zope 3 ftest layers it is. I believe he's on Zope2, though.

I think his problem is that he's using the Zope 3 test browser in Zope 
2. He should be using Products.Five.testbrowser.Browser.



--
http://worldcookery.com -- Professional Zope documentation and training
Next Zope 3 training at Camp5: http://trizpug.org/boot-camp/camp5

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Widget for displaying Text das HTML

2007-03-01 Thread Florian Lindner
Hello,
has anyone yet developed a widget for displaying text as HTML and keeping the 
linebreaks / paragraphs?

Like a text becomes:

Hello,br /
has anyone yet developed a widget for displaying text as HTML and keeping the 
linebreaks / paragraphs?br /

pA paragraph/

when rendered.
Is something like that already existing?

If not, how would you implement it? (just the concept, not the code) ;-)

Thanks,

Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Widget for displaying Text das HTML

2007-03-01 Thread Maciej Wisniowski
 If not, how would you implement it? (just the concept, not the code) ;-)
Take a look at 'Zope3 developer's handbook' by Stephan Richter (there is
online version I think). You'll find a example of custom HTML field and
widget there. It is not exactly what you're looking for but I think
it may be helpful.

-- 
Maciej Wisniowski
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Widget for displaying Text das HTML

2007-03-01 Thread Christophe Combelles

Florian Lindner a écrit :

Hello,
has anyone yet developed a widget for displaying text as HTML and keeping the 
linebreaks / paragraphs?


Like a text becomes:

Hello,br /
has anyone yet developed a widget for displaying text as HTML and keeping the 
linebreaks / paragraphs?br /



isn't it just the purpose of structuredtext and RestructuredText ? (stx  rst)
(zope.structuredtext in standard zope3)

Christophe



pA paragraph/

when rendered.
Is something like that already existing?

If not, how would you implement it? (just the concept, not the code) ;-)

Thanks,

Florian
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users




___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Re: zope.testbrowser and ZMI?

2007-03-01 Thread Basil Shubin

Philipp von Weitershausen wrote:

Stephan Richter wrote:

On Thursday 01 March 2007 10:17, Basil Shubin wrote:

  browser.addHeader('Authorization', 'Basic admin:admin')


This authorization is not correct. You need to use:

   manager.addHeader('Authorization', 'Basic mgr:mgrpw')

At least this is the default.


In most Zope 3 ftest layers it is. I believe he's on Zope2, though.

I think his problem is that he's using the Zope 3 test browser in Zope 
2. He should be using Products.Five.testbrowser.Browser.


 from Five.testbrowser import Browser
 browser = Browser()
 browser.addHeader('Authorization', 'Basic mgr:mgrpw')
 browser.open('http://localhost:8080/manage')
Loading Zope, please stand by ... done (3.729s)
Traceback (most recent call last):
  File stdin, line 1, in ?
  File 
/home/bashu/workspace/gadoz-shared/zope2.10/lib/python/zope/testbrowser/browser.py, 
line 220, in open
  File 
/home/bashu/workspace/gadoz-shared/zope2.10/lib/python/mechanize/_mechanize.py, 
line 177, in open
  File 
/home/bashu/workspace/gadoz-shared/zope2.10/lib/python/mechanize/_mechanize.py, 
line 202, in _mech_open
  File 
/home/bashu/workspace/gadoz-shared/zope2.10/lib/python/mechanize/_opener.py, 
line 234, in open

  File /usr/lib/python2.4/urllib2.py, line 376, in _open
'_open', req)
  File /usr/lib/python2.4/urllib2.py, line 337, in _call_chain
result = func(*args)
  File 
/home/bashu/work/gadoz/gadoz-shared/products/Five-1.5/Five/testbrowser.py, 
line 64, in http_open

return self.do_open(PublisherConnection, req)
  File /usr/lib/python2.4/urllib2.py, line 993, in do_open
h.request(req.get_method(), req.get_selector(), req.data, headers)
  File 
/home/bashu/workspace/gadoz-shared/zope2.10/lib/python/zope/testbrowser/testing.py, 
line 80, in request
  File 
/home/bashu/workspace/gadoz-shared/zope2.10/lib/python/Testing/ZopeTestCase/zopedoctest/functional.py, 
line 197, in http
  File 
/home/bashu/workspace/gadoz-shared/zope2.10/lib/python/Testing/ZopeTestCase/zopedoctest/functional.py, 
line 110, in sync

AttributeError: 'NoneType' object has no attribute '_p_jar'

Totaly confused, again!

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users