[Zope3-Users] Re: Unable to Get Zope 3 running

2006-06-21 Thread Philipp von Weitershausen
Daniel Roberson wrote:
 I am new at this but I have been unable to get Zope 3 to run correctly
 from the internet or from another computer
 on my internal network.
 
 I downloaded Python 2.4.0 and installed it.

Note that at least Python 2.4.1 is required. I recommend the latest
revision of Python 2.4, which IIRC is 2.4.3.

 OK, got it running with no error on port 9090 as an HTTP server on
 localhost.
 
 Ran the http://localhost:9090/manage command in the browser and I was
 connected at least on the computer it is installed on.
 
 Now the problem.  1.  Cannot access the ZOPE 3 server from the
 internet or from a different machine on the internal network.

Check your firewall settings on the Windows machine. It's probably not
allowing any connections from the outside.

   2.  Cannot run as a Windows Service.

Sorry, am not a Windows user.

Philipp

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


Re: [Zope3-Users] Access request object from content_factory

2006-06-21 Thread Rupert Redington
Hi John,

When I'm looking for the request object from somewhere like that I use

from zope.security.management import getInteraction

request = getInteraction().participations[0]

Why this works is outlined (IIRC) in zope/app/securitypolicy/zopepolicy.txt.

There may well be better ways to fish for the request than this... any
offerings?

Rupert

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


Re: [Zope3-Users] Re: Access request object from content_factory

2006-06-21 Thread Rupert Redington
Philipp von Weitershausen wrote:
 Marco Mariani wrote:
 Rupert Redington wrote:
 from zope.security.management import getInteraction

 request = getInteraction().participations[0]

 Why this works is outlined (IIRC) in zope/app/securitypolicy/zopepolicy.txt.

 There may well be better ways to fish for the request than this... any
 offerings?
   
 In my understanding, if you need to look for the request inside a
 content object, you're doing something that should be done in another
 place, be it a view or an adapter.
 

I understand this... I think...

 Indeed.
 
 Of course, I've been wrong before :-]
 
 Not this time :).
 
 The hack displayed above (going thru the security interaction) should
 not be considered a standard procedure for getting at the request in
 places where you don't have it. Content objects are dull. They do
 nothing. Other stuff does things *to* them. Mats' solution is the better
 one.
 

That's me told :-)

The place I found myself doing this was not in a content object, but in
a local utility which needed to return some absolute urls:

siteurl = zapi.absoluteURL(getSite(), getInteraction().participations[0])

I really don't like passing the request from the view to the utility's
method - I often end up calling one utility from another and feel
uncomfortable with forwarding the request through several calls - it
just seems ugly.

I realise that I shouldn't use zapi anymore... apart from that - what
can I do to achieve the effect of lines like the one above without
resorting to a hack?

Furthermore I sometimes find myself using this in event subscribers - I
can't see any way to get request data from an event...

What am I missing this time?

Cheers

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


Re: [Zope3-Users] Re: Access request object from content_factory

2006-06-21 Thread John Smith
Well, I always like to do things the way the experts
recommend :)

Are there any suggestions for this use case?:

I have a content class, which consists of 2
attributes:

1. a user comment
2. the name of the logged in user

So far, I have been using the browser:addform 
directive to add instances, which generates all my
views for me. (I love this and do not want to lose
it).

I have read about annotations and the DublinCore and I
think I can go digging in __annotations__, if I make
my class IAttributeAnnotable and get the logged in
user name.

The thing is, in this use case, the logged-in-user
attribute is not metadata, it is a fundamental
component of this particular content object.

So, my question boils down to: what is the recommended
way to get at the request object in a content factory
when using browser:addform.

The reason I think this matters is that there are so
many adapters and utilities that need a request
object, it seems unnecessary to deprive a content
factory of the use of them, when the developer chooses
to take advantage of browser:addform.

Best wishes,

John




--- Philipp von Weitershausen
[EMAIL PROTECTED] wrote:

 Marco Mariani wrote:
  Rupert Redington wrote:
  from zope.security.management import
 getInteraction
 
  request = getInteraction().participations[0]
 
  Why this works is outlined (IIRC) in
 zope/app/securitypolicy/zopepolicy.txt.
 
  There may well be better ways to fish for the
 request than this... any
  offerings?

  In my understanding, if you need to look for the
 request inside a
  content object, you're doing something that should
 be done in another
  place, be it a view or an adapter.
 
 Indeed.
 
  Of course, I've been wrong before :-]
 
 Not this time :).
 
 The hack displayed above (going thru the security
 interaction) should
 not be considered a standard procedure for getting
 at the request in
 places where you don't have it. Content objects are
 dull. They do
 nothing. Other stuff does things *to* them. Mats'
 solution is the better
 one.
 
 Philipp
 
 ___
 Zope3-users mailing list
 Zope3-users@zope.org
 http://mail.zope.org/mailman/listinfo/zope3-users
 




___ 
Inbox full of spam? Get leading spam protection and 1GB storage with All New 
Yahoo! Mail. http://uk.docs.yahoo.com/nowyoucan.html
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Formlib and fieldsets

2006-06-21 Thread Rupert Redington
Hi All,

I can't find anything in Formlib to indicate that there's a well trodden
path to handling fieldsets in formlib.

I'm not really sure what the best way to do this is. Clearly the formlib
form templates that I can see in Zope 3.2 don't contain any code for
handling fieldsets - but that doesn't sound too hard to manage.

Where though should fieldset definitions be handled?

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


Re: [Zope3-Users] Re: Access request object from content_factory

2006-06-21 Thread John Smith

--- Rupert Redington [EMAIL PROTECTED] wrote:
 
 I realise that I shouldn't use zapi anymore... apart


Good gracious!

No zapi?

How did I miss that? Where do I get my utilities,
parents, roots, adapters from now?

John.

(dazed and confused)




___ 
Inbox full of spam? Get leading spam protection and 1GB storage with All New 
Yahoo! Mail. http://uk.docs.yahoo.com/nowyoucan.html
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Re: Access request object from content_factory

2006-06-21 Thread Rupert Redington


John Smith wrote:
 --- Rupert Redington [EMAIL PROTECTED] wrote:
  
 I realise that I shouldn't use zapi anymore... apart
 
 
 Good gracious!
 
 No zapi?
 
 How did I miss that? Where do I get my utilities,
 parents, roots, adapters from now?
 
 John.
 
 (dazed and confused)
 
 

I think the right answer to that is wherever zapi got them from in the
first place

reading zope/app/zapi/__init__.py is informative...

Rupert

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


Re: [Zope3-Users] Re: Access request object from content_factory

2006-06-21 Thread Benji York

Rupert Redington wrote:


John Smith wrote:


No zapi?

How did I miss that? Where do I get my utilities,
parents, roots, adapters from now?



I think the right answer to that is wherever zapi got them from in the
first place


Well said.
--
Benji York
Senior Software Engineer
Zope Corporation
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


RE: [Zope3-Users] store persistent objects

2006-06-21 Thread Leticia Larrosa

Hi all

To fix the error I must change the __init__ of the BTreeContainer class to
the follow:

class persistent_test(BTreeContainer):
implements(Ipersistent_test)
def __init__(self):
  BTreeContainer.__init__(self)
self['un_padre'] = Padre('Lety','Campanilla')


Any idea about store object and list of objects? 
This way is the right way?

Thanks in advanced
Leticia Larrosa

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Leticia Larrosa
Sent: Tuesday, June 20, 2006 11:03 AM
To: zope3-users@zope.org
Subject: [Zope3-Users] store persistent objects

Hi all

Resume:

I want to store persistent data in the zope database. I must have an object
that store others object inside it, including list of objects, etc. I want
that when I create the root object automatically create object inside it.

Example of python class:

class Leave:
name = u
(...)

class RootIndex:
index_list = []
(...)   

class Root:
name = u
rootIndex = None
leave_list = []

def __init__(self): 
self.rootIndex = RootIndex()


I want store this data, for future access to it throw the user interface. I
don't know which way is the best, even I don't have any way to do that yet
;)

Any idea will be appreciated.

Details:

I create the following classes, interfaces and zcml directives and get the
error when I create a persistent_test throw the ZMI:


AttributeError: 'persistent_test' object has no attribute
'_SampleContainer__data'


My container overrides __init__ and set the __data value in my class ?

(...)

class IPadre(Interface):
nombre_padre = zope.schema.TextLine(
title=unombre padre,
required=True,
)
hijo = zope.schema.Object(
schema=IHijo,
)

class Padre(Persistent):
implements(IPadre)
nombre_padre = u
hijo = Hijo(u)

def __init__(self, a_nombre_padre, a_nombre_hijo):
self.nombre_padre = a_nombre_padre
self.hijo = Hijo(a_nombre_hijo)

class Ipersistent_test(IContainer):
def __setitem__(name, object):
 Add an Ipersistent_test object. 

class persistent_test(BTreeContainer):
implements(Ipersistent_test)
def __init__(self):
self['un_padre'] = Padre('Lety','Campanilla')



In my configure.zcml


interface
  interface=persistent_test.Ipersistent_test
  type=zope.app.content.interfaces.IContentType
  /
content class=persistent_test.persistent_test
implements
interface=zope.app.annotation.interfaces.IAttributeAnnotatable
/
implements
interface=zope.app.container.interfaces.IContentContainer
/
factory id=persistent_test.persistent_test description=persistent
test/
require 
permission=zope.ManageContent 
interface=persistent_test.Ipersistent_test
/
  /content

interface
  interface=persistent_test.IPadre
  type=zope.app.content.interfaces.IContentType
  /
  content class=persistent_test.Padre
implements
interface=zope.app.annotation.interfaces.IAttributeAnnotatable
/
implements
interface=zope.app.container.interfaces.IContentContainer
/
factory id=persistent_test.Padre description=Padre/
require 
permission=zope.ManageContent 
interface=persistent_test.IPadre
/
require 
permission=zope.ManageContent 
set_schema=persistent_test.IPadre
/
  /content

browser:addMenuItem
  class=persistent_test.persistent_test
  title=Persistent Test
  permission=zope.ManageContent
  /




Traceback:

Traceback (innermost last):
  Module zope.publisher.publish, line 138, in publish
result = publication.callObject(request, object)
  Module zope.app.publication.zopepublication, line 164, in callObject
return mapply(ob, request.getPositionalArguments(), request)
  Module zope.publisher.publish, line 113, in mapply
return debug_call(object, args)
   - __traceback_info__: BoundPageTemplateFile of
zope.app.publisher.browser.viewmeta.Contents object at 0x02847850
  Module zope.publisher.publish, line 119, in debug_call
return object(*args)
  Module zope.app.pagetemplate.viewpagetemplatefile, line 83, in __call__
return self.im_func(im_self, *args, **kw)
  Module zope.app.pagetemplate.viewpagetemplatefile, line 51, in __call__
sourceAnnotations=getattr(debug_flags, 'sourceAnnotations', 0),
  Module zope.pagetemplate.pagetemplate, line 117, in pt_render
strictinsert=0, sourceAnnotations=sourceAnnotations)()
  Module zope.tal.talinterpreter, line 239, in __call__
self.interpret(self.program)
  Module zope.tal.talinterpreter, line 314, in interpret
handlers[opcode](self, args)
  Module zope.tal.talinterpreter, line 869, in do_useMacro
self.interpret(macro)
  Module zope.tal.talinterpreter, line 314, in interpret
handlers[opcode](self, args)
  Module 

Re: [Zope3-Users] Re: Access request object from content_factory

2006-06-21 Thread Philipp von Weitershausen
Rupert Redington wrote:
 The hack displayed above (going thru the security interaction) should
 not be considered a standard procedure for getting at the request in
 places where you don't have it. Content objects are dull. They do
 nothing. Other stuff does things *to* them. Mats' solution is the better
 one.

 
 That's me told :-)
 
 The place I found myself doing this was not in a content object, but in
 a local utility which needed to return some absolute urls:

That already sounds like bad design. Why would the local utility worry
about URLs at all?

 siteurl = zapi.absoluteURL(getSite(), getInteraction().participations[0])
 
 I really don't like passing the request from the view to the utility's
 method - I often end up calling one utility from another and feel
 uncomfortable with forwarding the request through several calls - it
 just seems ugly.
 
 I realise that I shouldn't use zapi anymore... apart from that - what
 can I do to achieve the effect of lines like the one above without
 resorting to a hack?

Don't have your utilities involve URLs...

 Furthermore I sometimes find myself using this in event subscribers - I
 can't see any way to get request data from an event...

Why would you want to? If you really want to use events, throw an event
that also holds on to the request. I still think that this wouldn't be
necessary in most cases.

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


Re: [Zope3-Users] store persistent objects

2006-06-21 Thread Alek Kowalczyk

Leticia Larrosa wrote:

Hi all

To fix the error I must change the __init__ of the BTreeContainer class to
the follow:

class persistent_test(BTreeContainer):
implements(Ipersistent_test)
def __init__(self):
  BTreeContainer.__init__(self)
self['un_padre'] = Padre('Lety','Campanilla')


Any idea about store object and list of objects? 
This way is the right way?


  

I'm not sure if I have understood your problem correctly, but here is
what you probably could do:
For Root: inherit from Persistent and call  __init__ of parent class
(btw: using super(CurrentClass, self) is the recommended way to do that)

class Root(Persistent):
def __init__(self):
super(Root, self).__init__()
self.rootIndex = RootIndex()



For list: use PersistentList instead of list.
For Leave and RootIndex: inherit from Persistent as well (and remember
to call super(...).__init__ if you define own constructor)

Regards,
Alek


Thanks in advanced
Leticia Larrosa

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Leticia Larrosa
Sent: Tuesday, June 20, 2006 11:03 AM
To: zope3-users@zope.org
Subject: [Zope3-Users] store persistent objects

Hi all

Resume:

I want to store persistent data in the zope database. I must have an object
that store others object inside it, including list of objects, etc. I want
that when I create the root object automatically create object inside it.

Example of python class:

class Leave:
name = u
(...)

class RootIndex:
index_list = []
(...)   

class Root:
name = u
rootIndex = None
leave_list = []

	def __init__(self): 
		self.rootIndex = RootIndex()



  



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


[Zope3-Users] Re: Splitting ZODB ?

2006-06-21 Thread Philipp von Weitershausen
Chris Withers wrote:
 Thierry FLORAC wrote:
 While using Zope2, I used to split my ZODB into several parts, using
 the old DBTab product configuration (which was finally included into
 Zope2).
 Can I setup this kind of configuration with Zope3 and, if so, how ?
 
 It's all ZODB, I would hope Zope 3's zope.conf would allow this in the
 same way that Zope 2 does...

Actually, DBTab and Zope 2 used to monkey patch the ZODB to allow mount
points. The ZODB has recently grown this feature itself and IIRC Zope 2
was fixed (by Theuni?) to use this functionality now. I don't think Zope
3's zope.conf exposes it yet, though.

Would be a nice beginner sprint topic... Perhaps at the EP sprints?

Philipp

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


Re: [Zope3-Users] Re: Splitting ZODB ?

2006-06-21 Thread Jim Fulton

Philipp von Weitershausen wrote:

Chris Withers wrote:


Thierry FLORAC wrote:


While using Zope2, I used to split my ZODB into several parts, using
the old DBTab product configuration (which was finally included into
Zope2).
Can I setup this kind of configuration with Zope3 and, if so, how ?


It's all ZODB, I would hope Zope 3's zope.conf would allow this in the
same way that Zope 2 does...



Actually, DBTab and Zope 2 used to monkey patch the ZODB to allow mount
points. The ZODB has recently grown this feature itself and IIRC Zope 2
was fixed (by Theuni?) to use this functionality now. I don't think Zope
3's zope.conf exposes it yet, though.


Yes, it does.  You can have multiple database sections
and database sections can now have a name.  The databases
are registered as utilities and participate in a ZODB multidatabase.
The first database defined is used as the root database.

Zope 3 doesn't support mounting, but the same functionality
is mostly trivially obtained using the ZODB multi-database APIs.

Jim

--
Jim Fulton   mailto:[EMAIL PROTECTED]   Python Powered!
CTO  (540) 361-1714http://www.python.org
Zope Corporation http://www.zope.com   http://www.zope.org
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Re: Splitting ZODB ?

2006-06-21 Thread Philipp von Weitershausen
Jim Fulton wrote:
 Zope 3 doesn't support mounting, but the same functionality
 is mostly trivially obtained using the ZODB multi-database APIs.

Well, ok, then mounting support could a nice sprint topic :)
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Re: Splitting ZODB ?

2006-06-21 Thread Jim Fulton

Philipp von Weitershausen wrote:

Jim Fulton wrote:


Zope 3 doesn't support mounting, but the same functionality
is mostly trivially obtained using the ZODB multi-database APIs.



Well, ok, then mounting support could a nice sprint topic :)


Maybe, I'm not really sure it is necessary.

Now you can just grab an object from one database
and assign it as an attribute value of an object in another
database.

Much of the value of the Zope 3 mounting code
was in getting around the limitation that cross-database
object references weren't supported.

BTW, it might be nice to start thinking about having
some Foundation sprints. :)

Jim

--
Jim Fulton   mailto:[EMAIL PROTECTED]   Python Powered!
CTO  (540) 361-1714http://www.python.org
Zope Corporation http://www.zope.com   http://www.zope.org
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users