[Zope3-Users] Still trying am to build an EditForm

2007-09-02 Thread Florian Lindner
Hello,
I am still trying to build an EditForm using z3c.form. Since my previous 
thread is rather old I dare to open a new one.

I've tried a number of variations and will post the one which is the closest 
to the example.

This is the interface:

class IBlogEntry(IContainer):
Interface for blog entry objects.
contains(IBlogComment)

title = TextLine(
title = _(uBlog entry title),
description = _(uBlog entry title.),
default = u,
required = True)

content = Text(
title = _(uBlog entry content),
description = _(uBlog entry content.),
default = u,
required = True) 

inputType = Choice(
title = _(uType of input),
description = _(uSpecify the input type),
required = True,
default = ureStructeredText,
values = [ureStructeredText, uHTML] )

The view is configured like that:

z3c:pagelet
name=EditEntry.html
for=..interfaces.IBlogEntry
class=.views.EditEntry
permission=Blog.EditEntry
layer=Blog.interfaces.IBlogLayer
/

The code in .views.EditEntry is:

class EditEntry(layout.FormLayoutSupport, form.EditForm):
fields = field.Fields(IBlogEntry).select(title, content)

The layer is registered like that:

interface
interface=.interfaces.IBlogLayer
name=BlogSkin
type=zope.publisher.interfaces.browser.IBrowserSkinType
/

and

class IBlogLayer(IFormLayer, IPageletBrowserLayer):
Demo browser layer using div-form layout template.


Now I call the URL.

http://localhost:8080/++skin++BlogSkin/Blog/2007_08_16_abc/EditEntry

2007_08_16_abc ist an BlogEntry object.

Now there comes an ComponentLookupError. A server error occurred.  up.

Traceback (most recent call last):
  Module zope.publisher.publish, line 133, in publish
result = publication.callObject(request, obj)
  Module zope.app.publication.zopepublication, line 167, in callObject
return mapply(ob, request.getPositionalArguments(), request)
  Module zope.publisher.publish, line 108, in mapply
return debug_call(obj, args)
   - __traceback_info__: security proxied z3c.pagelet.zcml.EditEntry instance 
at 0xa0248cc
  Module zope.publisher.publish, line 114, in debug_call
return obj(*args)
  Module z3c.formui.layout, line 27, in __call__
ILayoutTemplate)
  Module zope.component._api, line 103, in getMultiAdapter
raise ComponentLookupError(objects, interface, name)
ComponentLookupError: ((z3c.pagelet.zcml.EditEntry object at 0xa0248cc, 
zope.publisher.browser.BrowserRequest instance 
URL=http://localhost:8080/++skin++BlogSkin/Blog/2007_08_16_abc/EditEntry.html),
 
InterfaceClass z3c.template.interfaces.ILayoutTemplate, u'')


I have also tried some variations of the above like not using z3c:pagelet but 
an normal page directive, registered it without an layer directive and so on.

So please... whats wrong there?

Thanks,

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


Re: AW: [Zope3-Users] Creating edit form with z3c.form

2007-08-19 Thread Florian Lindner
Am Samstag, 18. August 2007 schrieb Roger Ineichen:
 Hi Florian

  Betreff: [Zope3-Users] Creating edit form with z3c.form
 
  Hello,
  I try to create an edit form with z3c.form but it gives me an
  system error only:

 [...]

  ComponentLookupError:
  ((zope.app.publisher.browser.viewmeta.EditEntry object at
  0x9f6c68c, zope.publisher.browser.BrowserRequest instance
  URL=http://localhost:8080/Blog/2007_08_16_abc/EditEntry.html,
  Blog.blog.BlogEntry object at 0x9264d2c), InterfaceClass
  z3c.form.interfaces.IWidgets, u'')

 Try to find out which field doesn't have a widget. This is
 probably the __parent__ attribute.

  My code looks like that:
 
  from z3c.form import form, field
  from z3c.formui import layout
 
  class EditEntry(layout.FormLayoutSupport, form.EditForm):
  fields = field.Fields(IBlogEntry)

 Try to restrict your fields and find out which one does not
 have a widget with:

 fields = Fields(IBlogEntry).select('title', 'etc')

Hi!
I changed it to:

class EditEntry(layout.FormLayoutSupport, form.EditForm):
fields = field.Fields(IBlogEntry).select(title, content) 

but which doesn't change the error. This is the interface I get the fields 
from:

class IBlogEntry(IContainer):
Interface for blog entry objects.
contains(IBlogComment)

title = TextLine(
title = _(uBlog entry title),
description = _(uBlog entry title.),
default = u,
required = True)

content = Text(
title = _(uBlog entry content),
description = _(uBlog entry content.),
default = u,
required = True) 

inputType = Choice(
title = _(uType of input),
description = _(uSpecify the input type),
required = True,
default = ureStructeredText,
values = [ureStructeredText, uHTML] )


Regards,

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


Re: [Zope3-Users] Re: Using svn checkout with zc packages

2007-07-30 Thread Florian Lindner
Am Montag, 30. Juli 2007 schrieb Stephan Richter:
 On Monday 30 July 2007 09:59, Jeff Shell wrote:
  Last time I checked, which I admit has been a while, buildout didn't
  provide any examples of how to transition into buildout style
  development.

 I agree we are totally lacking  At the one end we push hard for people to
 use eggs -- even make the Zope 3 trunk checkout totally useless -- and on
 the other hand we are providing zero documentation on how to get started.

 The common answer you will get is: Look at all the SVN packages, there are
 many examples. I think this is a horrible thing to say. Unfortunately there
 is a big push behind using egg-based development without taking care that
 all bases are covered. I think this is because most development is driven
 by customer requirements these days and not by the academic purity (as
 people called it) with which we started developing Zope 3. I guess this is
 a good and a bad thing.

 Here are some documents that should get you started (in order I would look
 at them):

 - zc.buildout presentation slides:

 http://svn.zope.org/zc.buildout/trunk/doc/tutorial.txt?rev=76281view=auto

Here is a PDF version of the slides:

http://www.zope.de/redaktion/dzug/tagung/potsdam-2007/folien/introduction-to-zc-buildout.pdf/download



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


Re: [Zope3-Users] Re: Using svn checkout with zc packages

2007-07-29 Thread Florian Lindner
Am Mittwoch, 25. Juli 2007 schrieb Philipp von Weitershausen:
 Florian Lindner wrote:
  Hello,
  I use a Zope3 svn checkout for developement. What is the best way to make
  this working with the zc packages? I don't want to easy_install the
  entire Zope checkout but I also want my code to work with easy_install'ed
  versions of these packages. (don't want to change import statements and
  so on...) My favorite way would be to just do a svn checkout of the zc
  packages too but it seems to me that it won't work this way (or am I
  missing something?)

 Of course you can get a checkout of any package you wish from
 svn.zope.org, including the zc.* packages. However, they'll likely have
 dependencies which you will have to resolve as well. Some might also
 define entry points which means they really want to be installed as eggs.

 Why do you use checkouts? Do you actually change the packages while
 you're developing with them?

 Have you looked at zc.buildout? Checkout the tutorial [1]. Also, pretty
 much any zope.* or zc.* package's sandbox is set up using buildout these
 days, providing you with lots of examples.

I'm fine with easy_install for installing Zope3 and the z3c packages but at 
this time I don't want to use it for my own projects.
But when I install Zope3 (for example by easy_install zope.component) I don't 
find any mkzopeinstance. I know about zopeproject but that creates an egg 
what I don't want. How can I get mkzopeinstance with easy_install? I haven't 
found anything in PyPi.

Thanks,

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


[Zope3-Users] Using svn checkout with zc packages

2007-07-25 Thread Florian Lindner
Hello,
I use a Zope3 svn checkout for developement. What is the best way to make this 
working with the zc packages? I don't want to easy_install the entire Zope 
checkout but I also want my code to work with easy_install'ed versions of 
these packages. (don't want to change import statements and so on...)
My favorite way would be to just do a svn checkout of the zc packages too but 
it seems to me that it won't work this way (or am I missing something?)

Thanks,

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


[Zope3-Users] Building an admin interface

2007-07-16 Thread Florian Lindner
Hello,
I have a rather fundamental problem.

Until now the editor of my bloggin software has added, modified and removed 
blog entries by logging in to the ZMI and use the filesystem like view there.

This gives me (as the developer) only very limited control about how it is 
done. For example: A newly created entry should be stored in the subfolder 
year/month/day/entry_id. I can modify the entry_id by using a NamesChooser 
adapter but I can't (AFAIK) modify the actual location.

Because of this I want to develop an admin interface. The application 
generally shoud work stand alone (eg. not integrated in Plone) but should act 
as a well behaving citizen in the Zope3 world. (make integration easy).

How is this done the best way?

- What skins to use?

- How should authentication be done?
Just rely on the authentication source being around and use it  with 
getUtility(IAuthentication)?

- How to design my ZPTs to make them fit in the skin/interface?

- What else to pay attention to?

Thanks for all tips!

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


[Zope3-Users] Thinking about blog entry structure

2007-07-05 Thread Florian Lindner
Hello,
I'm currently rethinking my Blog's structure for saving entries.
At the moment I use a flat structure with all entries represented by an 
instance. The naming scheme is like 2007_07_05_Title_of_entry example: [1]

But that is not something I really like and I think it will be unhandleable 
for large blogs.

What would you suggest as an organization?

Something like 2007/05/Title or even 2007/05/13/Title?

Thanks for ideas!

Florian


[1] http://xgm.de/Blog/2007_05_13_Zeit_für_eine_neue_Suchmaschine
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Calling a view in a doc test

2007-06-18 Thread Florian Lindner
Am Dienstag, 5. Juni 2007 schrieb Marius Gedminas:
 On Tue, Jun 05, 2007 at 04:49:37PM +0200, Florian Lindner wrote:
  Am Montag, 4. Juni 2007 schrieb Marius Gedminas:
   On Mon, Jun 04, 2007 at 03:14:16PM +0200, Florian Lindner wrote:
in a doctest I have an object which has a view registered.
I want to call this view and test for the XML it returns.
How can I call the view so that it is being rendered, just like
called by a browser?
 
  I have thes setup and tearDown methods:
 
  import unittest
  import zope.testing.module
  from zope.testing import doctest
  from zope.component import testing, eventtesting
  from zope.app.container.tests.placelesssetup import PlacelessSetup
  from zope.app.testing import setup
 
  container_setup = PlacelessSetup()
 
  def blogSetUp(test):
  zope.testing.module.setUp(test, 'Blog.doctest')
  testing.setUp(test)
  eventtesting.setUp(test)
  container_setup.setUp()
  setup.placelessSetUp()
  setup.setUpTraversal()
 
  def blogTearDown(test):
  setup.placelessTearDown()
  zope.testing.module.tearDown(test)
  testing.tearDown(test)

 Oh, my, this feels like cargo-cult programming[1] to me.  For example,
 zope.app.testing.setup.placelessSetUp() calls
 zope.app.container.tests.placelesssetup.PlacelessSetup().setUp() for you
 already, you don't need to do it twice.  In fact the
 CleanUp().cleanUp(), which is the first thing that placelessSetUp()
 calls, undoes all the changfes made by container_setup.setUp().  The
 same applies to zope.component.testing.setUp.

   [1] http://en.wikipedia.org/wiki/Cargo_cult_programming

You're probably right about that, I've very little experience with the testing 
framework.

 I would suggest that you remove everything and keep just

   def blogSetUp(test):

zope.testing.module.setUp(test, 'Blog.doctest')

it worked after I've added the line above.

   setup.placelessSetUp()
   setup.setUpTraversal()

   def blogTearDown(test):
   setup.placelessTearDown()

  and this is my README.txt containing the test:
   context = MyBlog

 You may want to actually create the object:
context = MyBlog()

MyBlog is the instance.

 and sometimes it is a good idea to put it into the containment

 hierarchy, if you're going to look up things like absolute URLs:
from zope.app.folder import rootFolder
root = rootFolder()
root['my_blog'] = context
   
   from zope.publisher.browser import TestRequest
   from browser.views import RSSFeed
   request = TestRequest()
   view = RSSFeed(context, request)
   print view()
 
  Since my code includes a call to absoluteURL I have added your setup and
  tearDown methods. But there is still an error:

Thanks, now it works!

  BTW: What would be the name of the MyViewClass if the page would be
  registered without a class set?

 There isn't one.  When you use the browser:page directive, the ZCML
 maaagick creates a new class (with a funky name) at runtime, with extra
 attributes and methods.  You cannot access that class from a unit test,
 because it doesn't exist in your source code.

 My suggestion is don't do that.  If you want a view with just a
 template, and you want to render it in a unit test, define a view class

class MyTrivialViewClass(BrowserPage):
__call__ = ViewPageTemplateFile('mytemplate.pt')

Regards,

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


Re: [Zope3-Users] Calling a view in a doc test

2007-06-05 Thread Florian Lindner
Am Montag, 4. Juni 2007 schrieb Marius Gedminas:
 On Mon, Jun 04, 2007 at 03:14:16PM +0200, Florian Lindner wrote:
  Hello,
  in a doctest I have an object which has a view registered.
  I want to call this view and test for the XML it returns.
  How can I call the view so that it is being rendered, just like called by
  a browser?

 Is that in a unit test, or a functional test?

 In a unit test you can do it like this:
  context = ...yourcontentobject...
  from zope.publisher.browser import TestRequest
  request = TestRequest()
  view = MyViewClass(context, request)
  print view()

 some xml or whatever output here

 If you want to provide, e.g., form parameters, pass them to the request:
  request = TestRequest(form={'foo': u'Lalala\u1234'})

 If your view does anything interesting (e.g. use TALES expressions, or
 refer to other views like context/@@absolute_url), you will need to
 register a whole bunch of components in your doctest setUp methods.
 Don't forget to tear them down afterwards.  IIRC you will need

 from zope.app.testing import setup

 def setUp(test):
 setup.placelessSetUp()
 setup.setUpTraversal()

 def tearDown(test):
 setup.placelessTearDown()

 at the very least.  Accessing other views, resources, or, god forbid,
 forms, will require other component registrations.  At some point you
 have two choices: figure out this stuff once and then use copy  paste
 (actually, helper functions defined once in your project), or switch to
 testing your views with functional tests.

Hello,
I have thes setup and tearDown methods:

import unittest
import zope.testing.module
from zope.testing import doctest
from zope.component import testing, eventtesting
from zope.app.container.tests.placelesssetup import PlacelessSetup
from zope.app.testing import setup

container_setup = PlacelessSetup()

def blogSetUp(test):
zope.testing.module.setUp(test, 'Blog.doctest')
testing.setUp(test)
eventtesting.setUp(test)
container_setup.setUp()
setup.placelessSetUp()
setup.setUpTraversal()

def blogTearDown(test):
setup.placelessTearDown()
zope.testing.module.tearDown(test)
testing.tearDown(test)


and this is my README.txt containing the test:

 context = MyBlog
 from zope.publisher.browser import TestRequest
 from browser.views import RSSFeed
 request = TestRequest()
 view = RSSFeed(context, request)
 print view()

Since my code includes a call to absoluteURL I have added your setup and 
tearDown methods. But there is still an error:

  File /home/florian/Zope3/src/zope/traversing/browser/absoluteurl.py, 
line 34, in absoluteURL
return zope.component.getMultiAdapter((ob, request), IAbsoluteURL)()
  File /home/florian/Zope3/src/zope/traversing/browser/absoluteurl.py, 
line 55, in __str__
raise TypeError(_insufficientContext)
TypeError: There isn't enough context to get URL information. This is 
probably due to a bug in setting up location information.


Do you know what's missing here?

Thanks,

Florian

BTW: What would be the name of the MyViewClass if the page would be registered 
without a class set?
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Calling a view in a doc test

2007-06-04 Thread Florian Lindner
Hello,
in a doctest I have an object which has a view registered.
I want to call this view and test for the XML it returns.
How can I call the view so that it is being rendered, just like called by a 
browser?

Thanks,

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


Re: [Zope3-Users] Blog naming proposals

2007-06-01 Thread Florian Lindner
Am Montag, 28. Mai 2007 schrieb Florian Lindner:
 Hello,
 some people might have noticed I am developing a Blog package for Zope3.
 Since it slowly becomes functional (an older version is working at
 http://xgm.de) I want to release it (under an free and open source
 licence).

 One thing still missing is a good name. A name that quickly comes to my
 mind is zBlog but which is not very fancy.

 What ideas have you for Zope3 blog package, what would you choose?

Thanks for all suggestions and ideas. I have not decided yet but at the moment 
I tend to name it Noize.
Most blogs are producing more smoke than heat thus more noize than signal. And 
a Z is also in it.

Regards,

Florian

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


[Zope3-Users] Blog naming proposals

2007-05-28 Thread Florian Lindner
Hello,
some people might have noticed I am developing a Blog package for Zope3.
Since it slowly becomes functional (an older version is working at 
http://xgm.de) I want to release it (under an free and open source licence).

One thing still missing is a good name. A name that quickly comes to my mind 
is zBlog but which is not very fancy.

What ideas have you for Zope3 blog package, what would you choose?

Regards,

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


Re: [Zope3-Users] Still trying to connect to ZODB from external

2007-05-24 Thread Florian Lindner
Am Mittwoch, 9. Mai 2007 18:18 schrieb Stefan H. Holek:
 You *must* either commit or abort your transaction.

Hello,
I've changed my code to:

def releaseRefreshEvent():
 Calls all utlities that have a INewsfeed interface registered. 
print releaseRefreshEvent!!
db = getUtility(ZODB.interfaces.IDatabase)
conn = db.open()
root = conn.root().data['Application']

[...]

get_transaction().commit()
conn.close()
# db.close()


but that gives another error:

WARNING ZODB.DB DB.open() has 9 open connections with a pool_size of 7

Regards,

Florian



 Stefan

 On 8. Mai 2007, at 23:02, Florian Lindner wrote:
File /home/florian/Zope3/src/ZODB/Connection.py, line 268, in
  close
  raise ConnectionStateError(Cannot close a connection joined to 
  ZODB.POSException.ConnectionStateError: Cannot close a connection
  joined to a
  transaction
 
  What is the right way to do it?

 --
 Anything that happens, happens.  --Douglas Adams
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Still trying to connect to ZODB from external

2007-05-11 Thread Florian Lindner
Am Mittwoch, 9. Mai 2007 18:18 schrieb Stefan H. Holek:
 You *must* either commit or abort your transaction.

Ok, so I would prefer to commit. ;-)
If I understood the code correctly I need to have an object implementing 
IStorage in  order to do that. But I haven't found out where to get such an 
object?

Thanks,

Florian

 On 8. Mai 2007, at 23:02, Florian Lindner wrote:
File /home/florian/Zope3/src/ZODB/Connection.py, line 268, in
  close
  raise ConnectionStateError(Cannot close a connection joined to 
  ZODB.POSException.ConnectionStateError: Cannot close a connection
  joined to a
  transaction
 
  What is the right way to do it?

 --
 Anything that happens, happens.  --Douglas Adams
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Still trying to connect to ZODB from external

2007-05-08 Thread Florian Lindner
Hello,
I have a function called by a scheduler. Since it operates outside of Zope 
context I need to create a connection to the ZODB in order to call a utility:

db = getUtility(ZODB.interfaces.IDatabase)
conn = db.open()
root = conn.root().data['Application']
   
zope.app.component.hooks.setSite(root[cs])

utils = getUtilitiesFor(INewsfeed)
for i in utils:
print Utility called:, i[0]
i[1].sendNotification()
   
conn.close()

This produces errors like:

Unhandled error in Deferred:
Traceback (most recent call last):
  File /home/florian/Zope3/src/twisted/internet/posixbase.py, line 220, in 
run
self.mainLoop()
  File /home/florian/Zope3/src/twisted/internet/posixbase.py, line 228, in 
mainLoop
self.runUntilCurrent()
  File /home/florian/Zope3/src/twisted/internet/base.py, line 561, in 
runUntilCurrent
call.func(*call.args, **call.kw)
  File /home/florian/Zope3/src/twisted/internet/task.py, line 108, in 
__call__
d = defer.maybeDeferred(self.f, *self.a, **self.kw)
--- exception caught here ---
  File /home/florian/Zope3/src/twisted/internet/defer.py, line 107, in 
maybeDeferred
result = f(*args, **kw)
  File /home/florian/Desktop/zope/lib/python/CS/centershock/centershock.py, 
line 34, in releaseRefreshEvent
conn.close()
  File /home/florian/Zope3/src/ZODB/Connection.py, line 268, in close
raise ConnectionStateError(Cannot close a connection joined to 
ZODB.POSException.ConnectionStateError: Cannot close a connection joined to a 
transaction

What is the right way to do it?

Thanks,

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


[Zope3-Users] Wiki for 'Zope3

2007-03-20 Thread Florian Lindner
Hello,
I'm looking for Zope3 wiki package. It should be usable out of the box and 
also provide a decent design out of the box.
(I don't think that there are so many packages, so just name anything and I'll 
test with my further criteria).  ;-)

Thanks,

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


Re: [Zope3-Users] Disable raw directive in restructured text

2007-03-16 Thread Florian Lindner
Am Freitag, 16. März 2007 16:48 schrieb Martijn Pieters:
 On 3/15/07, Florian Lindner [EMAIL PROTECTED] wrote:
  I've found out it could partly be achieved by using:
 
  def convertToHTML(self, comment):
   Converts a comment from restructured text to HTML. 
  text = unicode(comment.content)
  settings_override = {}
  settings_override[raw_enabled] = False
  settings_override[file_insertion_enabled] = False
  # settings_override[report_level] = quiet
  renderer = ReStructuredTextToHTMLRenderer(text, self.request)
  return renderer.render(settings_override).strip()
 
  but now a raw directive generates an error message whereas it is
  completely swallowed when uncommenting the report_level.

 Note that you should really read the following:

   http://docutils.sourceforge.net/docs/howto/security.html

 You'll have to disable the include and csv-table directives as well.

The file_insertion_enabled = False disables the include and csv-table 
directives.


settings_override = {}
settings_override[raw_enabled] = False
settings_override[file_insertion_enabled] = False

I think it's safe this way.

But these settings still don't entirely satisfy me because if somebody 
enters .. raw:: html a warning message is printed informing that raw is 
disabled. If I set:

settings_override[report_level] = quiet

The raw directive is is completely removed from output. What I want is that it 
is treated just like any other text, appearing also in the output.

Is that possible?

Thanks,

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


[Zope3-Users] Disable raw directive in restructured text

2007-03-15 Thread Florian Lindner
Hello,
I'm using this code to render a rest snippet to HTML:

def convertToHTML(self, comment):
 Converts a comment from restructured text to HTML. 
text = unicode(comment.content)
renderer = ReStructuredTextToHTMLRenderer(text, self.request)
return renderer.render().strip()

Since the text in entered by users I want to disable the raw directive [1]. 
How can I do this? (only while rendering this text, not globally)

Thanks,

Florian

[1] http://docutils.sourceforge.net/docs/ref/rst/directives.html#raw
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Disable raw directive in restructured text

2007-03-15 Thread Florian Lindner
Am Donnerstag, 15. März 2007 21:14 schrieb Jonathan:
 - Original Message -
 From: Florian Lindner [EMAIL PROTECTED]
 To: zope3-users@zope.org
 Sent: Thursday, March 15, 2007 3:46 PM
 Subject: [Zope3-Users] Disable raw directive in restructured text

  Hello,
  I'm using this code to render a rest snippet to HTML:
 
 def convertToHTML(self, comment):
  Converts a comment from restructured text to HTML. 
 text = unicode(comment.content)
 renderer = ReStructuredTextToHTMLRenderer(text, self.request)
 return renderer.render().strip()
 
  Since the text in entered by users I want to disable the raw directive
  [1].
  How can I do this? (only while rendering this text, not globally)

 How about passing the original (ie. user-entered) ReST data to your display
 widget which then strips the 'raw::' string from the rest data before
 calling convertToHTML?

 Alternatively, pass an additional arguement to convToHTML which is a flag
 that tells the routine whether or not to strip the raw command from the
 passed text string before processing it.

Of course it's possible to strip it before passing the text to the rest 
renderer. But maybe somebody wants to really print .. raw:: html, maybe 
giving an example of the directive. If I would have stripped the raw there 
would be no text at all, but I want the raw to be treated just like any other 
text.

Regards,

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


Re: [Zope3-Users] Disable raw directive in restructured text

2007-03-15 Thread Florian Lindner
Am Donnerstag, 15. März 2007 22:01 schrieb Jonathan:
 - Original Message -
 From: Florian Lindner [EMAIL PROTECTED]
 To: zope3-users@zope.org
 Cc: Jonathan [EMAIL PROTECTED]
 Sent: Thursday, March 15, 2007 4:56 PM
 Subject: Re: [Zope3-Users] Disable raw directive in restructured text

  Am Donnerstag, 15. März 2007 21:14 schrieb Jonathan:
  - Original Message -
  From: Florian Lindner [EMAIL PROTECTED]
  To: zope3-users@zope.org
  Sent: Thursday, March 15, 2007 3:46 PM
  Subject: [Zope3-Users] Disable raw directive in restructured text
 
   Hello,
   I'm using this code to render a rest snippet to HTML:
  
  def convertToHTML(self, comment):
   Converts a comment from restructured text to HTML. 
  text = unicode(comment.content)
  renderer = ReStructuredTextToHTMLRenderer(text, self.request)
  return renderer.render().strip()
  
   Since the text in entered by users I want to disable the raw directive
   [1].
   How can I do this? (only while rendering this text, not globally)
 
  How about passing the original (ie. user-entered) ReST data to your
  display
  widget which then strips the 'raw::' string from the rest data before
  calling convertToHTML?
 
  Alternatively, pass an additional arguement to convToHTML which is a
  flag that tells the routine whether or not to strip the raw command from
  the passed text string before processing it.
 
  Of course it's possible to strip it before passing the text to the rest
  renderer. But maybe somebody wants to really print .. raw:: html, maybe
  giving an example of the directive. If I would have stripped the raw
  there would be no text at all, but I want the raw to be treated just like
  any other
  text.

 If you want to preserve the raw command, how about swaping the 'raw::'
 directive for a placeholder (eg. ||rw|| ), process the ReST data normally,
 then swap the 'raw::' command back in place of the placeholder?

I've found out it could partly be achieved by using:

def convertToHTML(self, comment):
 Converts a comment from restructured text to HTML. 
text = unicode(comment.content)
settings_override = {}
settings_override[raw_enabled] = False
settings_override[file_insertion_enabled] = False
# settings_override[report_level] = quiet
renderer = ReStructuredTextToHTMLRenderer(text, self.request)
return renderer.render(settings_override).strip()

but now a raw directive generates an error message whereas it is completely 
swallowed when uncommenting the report_level.

Regards,

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


Re: [Zope3-Users] Get a site

2007-03-08 Thread Florian Lindner
Am Donnerstag, 8. März 2007 20:10 schrieb Stephan Richter:
 On Sunday 28 January 2007 12:23, Florian Lindner wrote:
  exceptions.ValueError: I/O operation on closed file
 
 
  any idea what caused it?

 I think you violate the transaction mechanism. I think it would be easier
 to make a call via the publisher.

The problem was that I forgot to close the connection, resp. called the close 
function on the wrong object.

Regards,

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


[Zope3-Users] principal without dot

2007-02-28 Thread Florian Lindner
Hello,
this is the entry from principals.zcml created by mkzopeinstance (a bit 
modified):

  principal
id=something.Florian
title=Manager
login=florian
password_manager=Plain Text
password=123
/

but can I set a id that does not contain a dot?
I ask because I display DC creator metadata on a page and something like 
Florian just looks better than something.Florian.

Thanks,

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


Re: [Zope3-Users] Problem with macro

2007-02-26 Thread Florian Lindner
Am Sonntag, 25. Februar 2007 15:03 schrieb Marius Gedminas:
 On Sun, Feb 25, 2007 at 02:02:43PM +0100, Florian Lindner wrote:
  I have a simple problem. A template:
 
  html metal:use-macro=views/standard_macros/view
  i18n:domain=xgm.de/Blog body
  metal:block metal:define-macro=Blog
  metal:block metal:fill-slot=body
h1 tal:content=context/title /
div tal:replace=context/description /
   [...]
/div
 
  /metal:block
  /metal:block
/body
  /html
 
  That is registered as view.html.

 How?  browser:page name=view.html template=foo.pt / ?

  Now I want to use the macro in another page:
 
  div metal:use-macro=context/Blog/@@view.html/Blog /
 
  (tried different variations)

 Ah, but did you try

   metal:use-macro=context/Blog/@@view.html/index/macros/Blog /

No, have not tried it yet.

But
div metal:use-macro=context/Blog/@@view.html/index/macros/Blog /

gives an error too:

  File /home/florian/Zope3/src/zope/tales/expressions.py, line 124, in _eval
ob = self._traverser(ob, element, econtext)
  File /home/florian/Zope3/src/zope/app/pagetemplate/engine.py, line 65, in 
__call__
object = object[name]
KeyError: 'Blog'

Blog in a object contained by the xgm object. Blog is object that has the 
view.html registered.

Thanks,

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


Re: [Zope3-Users] Problem with macro

2007-02-26 Thread Florian Lindner
Am Montag, 26. Februar 2007 18:14 schrieb Marius Gedminas:
 On Mon, Feb 26, 2007 at 02:40:13PM +0100, Florian Lindner wrote:
  Am Sonntag, 25. Februar 2007 15:03 schrieb Marius Gedminas:
   On Sun, Feb 25, 2007 at 02:02:43PM +0100, Florian Lindner wrote:
I have a simple problem. A template:
   
html metal:use-macro=views/standard_macros/view
i18n:domain=xgm.de/Blog body
metal:block metal:define-macro=Blog

 ...

That is registered as view.html.
   
Now I want to use the macro in another page:
   
div metal:use-macro=context/Blog/@@view.html/Blog /
   
(tried different variations)
  
   Ah, but did you try
  
 metal:use-macro=context/Blog/@@view.html/index/macros/Blog /
 
  No, have not tried it yet.
 
  But
  div metal:use-macro=context/Blog/@@view.html/index/macros/Blog /
 
  gives an error too:
 
File /home/florian/Zope3/src/zope/tales/expressions.py, line 124, in
  _eval ob = self._traverser(ob, element, econtext)
File /home/florian/Zope3/src/zope/app/pagetemplate/engine.py, line
  65, in __call__
  object = object[name]
  KeyError: 'Blog'
 
  Blog in a object contained by the xgm object. Blog is object that has the
  view.html registered.

 Do you know which 'Blog' is the one that gives you the error?  The macro
 or the item on 'context'?

 It could very well be that your define-macro doesn't take effect, because
 it is inside a use-macro and outside any fill-slot.

It's probably that. I've changed the Blog macro to BlogMacro und now it 
complains abobut BlogMacro being missing.
How would you do that? (for explanation what I want see my original posting)

Thanks,

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


[Zope3-Users] Problem with macro

2007-02-25 Thread Florian Lindner
Hello,
I have a simple problem. A template:

html metal:use-macro=views/standard_macros/view i18n:domain=xgm.de/Blog
  body
metal:block metal:define-macro=Blog
metal:block metal:fill-slot=body
  h1 tal:content=context/title /
  div tal:replace=context/description /
 [...]
  /div

/metal:block
/metal:block
  /body
/html

That is registered as view.html.

Now I want to use the macro in another page:

div metal:use-macro=context/Blog/@@view.html/Blog /

(tried different variations)

but that always causes a system error because the macro could not be found.

Thanks,

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


[Zope3-Users] Zope Book: Internationalizing still up to date?

2007-02-21 Thread Florian Lindner
Hello,
is the chapter 18: Internationalizing a package in Stephans Zope Book 
(online version) still up to date or has changed to much so it's not worth 
reading anymore?
Any other good sources about i18n?

Thanks,

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


Re: [Zope3-Users] Grant role top zope.anybody

2007-02-18 Thread Florian Lindner
Am Samstag, 17. Februar 2007 23:35 schrieb Marius Gedminas:
 On Sat, Feb 17, 2007 at 12:48:05PM +0100, Florian Lindner wrote:
  Hello,
  I've tried to grant a role to zope.anybody (any user that visits the
  site). Tried it this way:
 
  grant
  role = my.role
  principal = zope.anybody
  /
 
  But this gives a unknown principal id error, even though I have:
 
unauthenticatedPrincipal
  id=zope.anybody
  title=Unauthenticated User /
 
  in my principal.zcml.
 
  How to do it right?

 ZCML is order-dependent (sadly).  You need to put your grant after the
 principal definition.  This means doing it in principals.zcml, or in
 some file that is included in site.zcml after principals.zcml.

The grant is contained in a security.zcml which is invoked from a 
configure.zcml from a package residing in the zope instance. I don't know 
about the order. Are the package configure.zcml invoked before 
principal.zcml?

Thanks,

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


[Zope3-Users] List a folder on different pages

2007-02-18 Thread Florian Lindner
Hello,
is there a howto somewhere online that explains how I can do a folder listing 
(in general: output of any list) in a way that it is split in different pages 
and with page numbers and next/previous page links?
I would probably be able to invent it myself but maybe someone has described 
it already.

Thanks,

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


Re: [Zope3-Users] Error when calling addform

2007-02-18 Thread Florian Lindner
Am Dienstag, 13. Februar 2007 12:04 schrieb Stephan Richter:
 On Monday 12 February 2007 15:56, David Johnson wrote:
  Many people have offered approaches.  I find the simplest and  
  cleanest approach for declaring interfaces is as follows:

 The cleanest way, in my opinion, is just not to use the addform directive
 altogether. zope.formlib is the wildly accepted successor.

Ok, I've done it now if the formlib.
Do I really have to create and set all fields manually?

class BlogCommentAddForm(form.AddForm):
form_fields = form.Fields(IBlogComment)

def create(self, data):
comment = BlogComment()
comment.name = data[name]
comment.email = data[email]
comment.content = data[content]
return comment

If I just omit create is complains that the function must be implemented. Can 
this be done easier?

Thanks,

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


[Zope3-Users] Grant role top zope.anybody

2007-02-17 Thread Florian Lindner
Hello,
I've tried to grant a role to zope.anybody (any user that visits the site). 
Tried it this way:

grant
role = my.role
principal = zope.anybody
/

But this gives a unknown principal id error, even though I have:

  unauthenticatedPrincipal
id=zope.anybody
title=Unauthenticated User /

in my principal.zcml.

How to do it right?

Thanks,

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


Re: [Zope3-Users] Re: Still a skinning problem

2007-02-11 Thread Florian Lindner
Am Donnerstag, 8. Februar 2007 17:23 schrieb FB:
 Hi,

 On Thu, Feb 08, 2007 at 04:54:51PM +0100, Florian Lindner wrote:
  Am Mittwoch, 7. Februar 2007 07:50 schrieb Jürgen Kartnaller:
   Florian,
   if you want the url to your current site implement this :
  
  
   class SiteUrlView(object):
  
def __call__(self):
return absoluteURL(hooks.getSite(), self.request)
  
   And register a page :
  
  page
  name=site_url
  for=*
  class=.views.SiteUrlView
  permission=zope.Public
  /
  
   Now you can use context/@@site_url anywhere.
 
  Hi,
  this works perfect when using it like:
 
  a tal:attributes=href context/@@site_urlhome/a
 
  but when I try to directly link to a view registered with the object
  site_url returns:
 
  a tal:attributes=href context/@@site_url/@@search.htmlsuche/a

 Try

  a tal:attributes=href
 string:${context/@@site_url}/@@search.htmlsuche/a

Yes, thanks, works!

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


[Zope3-Users] Error when calling addform

2007-02-11 Thread Florian Lindner
Hello,
I have an addform registered:

addform
label=Add Blog Comment
name=AddBlogComment.html
schema=..interfaces.IBlogComment
content_factory=..blog.BlogComment
permission=Blog.AddComment
/

addMenuItem
class=..blog.BlogComment
title=Blog Comment
description=A Blog Comment
permission=Blog.AddComment
view=AddBlogComment.html
/


class IBlogComment(IContained):
containers(IBlogEntry)

name = TextLine(
title = uYour name,
description = uYour name or nickname,
default = uGuest,
required = True)


email = TextLine(
title = uE-Mail,
required = False)

content = Text(
title = uBlog comment content,
default = u,
required = True)


class BlogComment(Contained):
 A comment to a Blog entry. 
implements(IBlogComment)

name = u
email = u
content = u


but when I call the addform resp. click on the addMenuItem  I get an system 
error:

2007-02-11T19:19:46 ERROR SiteError 
http://localhost:8080/xgm/Blog/2007_02_10_erster_post/+/AddBlogComment.html
Traceback (most recent call last):
  File /home/florian/Zope3/src/zope/publisher/publish.py, line 130, in 
publish
obj = request.traverse(obj)
  File /home/florian/Zope3/src/zope/publisher/browser.py, line 511, in 
traverse
ob = super(BrowserRequest, self).traverse(obj)
  File /home/florian/Zope3/src/zope/publisher/http.py, line 447, in traverse
ob = super(HTTPRequest, self).traverse(obj)
  File /home/florian/Zope3/src/zope/publisher/base.py, line 263, in traverse
obj = publication.traverseName(self, obj, entry_name)
  File /home/florian/Zope3/src/zope/app/publication/publicationtraverse.py, 
line 55, in traverseName
ob2 = ob.publishTraverse(request, nm)
  File /home/florian/Zope3/src/zope/app/publisher/browser/viewmeta.py, line 
271, in publishTraverse
view = queryMultiAdapter((self, request), name=name)
  File /home/florian/Zope3/src/zope/component/_api.py, line 114, in 
queryMultiAdapter
return sitemanager.queryMultiAdapter(objects, interface, name, default)
  File /home/florian/Zope3/src/zope/component/registry.py, line 206, in 
queryMultiAdapter
return self.adapters.queryMultiAdapter(
  File /home/florian/Zope3/src/zope/interface/adapter.py, line 482, in 
queryMultiAdapter
result = factory(*objects)
  File /home/florian/Zope3/src/zope/app/form/browser/editview.py, line 62, 
in __init__
self._setUpWidgets()
  File /home/florian/Zope3/src/zope/app/form/browser/add.py, line 48, in 
_setUpWidgets
setUpWidgets(self, self.schema, IInputWidget, names=self.fieldNames)
  File /home/florian/Zope3/src/zope/app/form/utility.py, line 153, in 
setUpWidgets
context=context)
  File /home/florian/Zope3/src/zope/app/form/utility.py, line 97, in 
setUpWidget
widget = _createWidget(context, field, viewType, view.request)
  File /home/florian/Zope3/src/zope/app/form/utility.py, line 65, in 
_createWidget
return zapi.getMultiAdapter((field, request), viewType)
  File /home/florian/Zope3/src/zope/component/_api.py, line 103, in 
getMultiAdapter
raise ComponentLookupError(objects, interface, name)
ComponentLookupError: ((zope.schema._bootstrapfields.Field object at 
0x9e95b2c, zope.publisher.browser.BrowserRequest instance 
URL=http://localhost:8080/xgm/Blog/2007_02_10_erster_post/+/AddBlogComment.html),
 
InterfaceClass zope.app.form.interfaces.IInputWidget, u'')



 what do I have misconfigured here?

Thanks,

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


Re: [Zope3-Users] Re: Still a skinning problem

2007-02-08 Thread Florian Lindner
Am Mittwoch, 7. Februar 2007 07:50 schrieb Jürgen Kartnaller:
 Florian,
 if you want the url to your current site implement this :


 class SiteUrlView(object):

  def __call__(self):
  return absoluteURL(hooks.getSite(), self.request)

 And register a page :

page
name=site_url
for=*
class=.views.SiteUrlView
permission=zope.Public
/

 Now you can use context/@@site_url anywhere.

Hi,
this works perfect when using it like:

a tal:attributes=href context/@@site_urlhome/a 

but when I try to directly link to a view registered with the object site_url 
returns:

a tal:attributes=href context/@@site_url/@@search.htmlsuche/a

(tried some variations of the above) it fails.

How can I link to these views?

Thanks,

Florian


the log message:

 File /home/florian/Zope3/src/zope/tales/tales.py, line 696, in evaluate
return expression(self)
   - /home/florian/Desktop/zope/lib/python/xgm/browser/skin/template.pt
   - Line 19, Column 18
   - Expression: PathExpr standard:u'context/@@site_url/@@search.html'
   - Names:
  {'args': (),
   'context': xgm.xgm.XGM object at 0x966d0ac,
   'default': object object at 0xb7c9a558,
   'loop': {},
   'nothing': None,
   'options': {},
   'repeat': {},
   'request': zope.publisher.browser.BrowserRequest instance 
URL=http://localhost:8080/++skin++xgm/xgm/@@index.html,
   'template': 
zope.app.pagetemplate.viewpagetemplatefile.ViewPageTemplateFile object at 
0x9169aac,
   'view': zope.app.pagetemplate.simpleviewclass.SimpleViewClass 
from /home/florian/Desktop/zope/lib/python/xgm/browser/skin/index.pt object 
at 0x96ca2cc,
   'views': zope.app.pagetemplate.viewpagetemplatefile.ViewMapper object 
at 0x96ca2ec}
  File /home/florian/Zope3/src/zope/tales/expressions.py, line 217, in 
__call__
return self._eval(econtext)
  File /home/florian/Zope3/src/zope/tales/expressions.py, line 194, in _eval
ob = self._subexprs[-1](econtext)
  File /home/florian/Zope3/src/zope/tales/expressions.py, line 124, in _eval
ob = self._traverser(ob, element, econtext)
  File /home/florian/Zope3/src/zope/app/pagetemplate/engine.py, line 68, in 
__call__
request=request)
  File /home/florian/Zope3/src/zope/traversing/adapters.py, line 154, in 
traversePathElement
return namespaceLookup(ns, nm, obj, request)
   - __traceback_info__: (zope.app.publisher.browser.viewmeta.SiteUrlView 
object at 0x96ca48c, '@@search.html')
  File /home/florian/Zope3/src/zope/traversing/namespace.py, line 112, in 
namespaceLookup
return traverser.traverse(name, ())
  File /home/florian/Zope3/src/zope/traversing/namespace.py, line 345, in 
traverse
raise TraversalError(self.context, name)
TraversalError: (zope.app.publisher.browser.viewmeta.SiteUrlView object at 
0x96ca48c, 'search.html')
127.0.0.1 - - [08/Feb/2007:16:53:46 +0200] GET /++skin++xgm/xgm HTTP/1.1 500 
89 - Mozilla/5.0 (compatible; Konqueror/3.5; Linux) KHTML/3.5.5 (like 
Gecko)
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Still a skinning problem

2007-02-06 Thread Florian Lindner
Am Dienstag, 6. Februar 2007 11:43 schrieb Mohsen Moeeni:
 Until the gurus find time to jump in with `the right` solution...

 On 2/5/07, Florian Lindner [EMAIL PROTECTED] wrote:
  The line in the template.pt:
  a tal:attributes=href context/@@index.html/@@absolute_urlhome/a
  works fine as long as context is an IXGM, because index.html is
  registered for IXGM. But if a view from the IBlog is called is it also
  rendered in the template.pt but context now is a IBlog which does not
  have an index.html (or at leat not the one I want) and therefore fails.

 Your template *assumes* the context will always have
 an `index.html` view. So it can not be used for a
 context that doesn't have it. 

I know that's the problem.

 At any rate, context 
 is not the best object you can use to link to home.
 It's better to use site root for that purpose. Something
 like:

 a tal:attributes=href view/siteroot/@@index.html/@@absolute_urlhome/a

 Where you find site root using zope3 APIs in view code and
 assign it to siteroot.

Now there is still the problem that I need a view class that implements 
siteroot for every view that uses template.pt.
Or can I use a view class for the template itself? (tried but did not work).

Any other idea or do I don't really understand you?

Thanks,

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


Re: [Zope3-Users] Still a skinning problem

2007-02-05 Thread Florian Lindner
Am Sonntag, 4. Februar 2007 22:20 schrieb David Johnson:
 I will wager to help...since frequently my posts go unanswered
 also.   I've implemented a few skins with great success.  However, if
 you wait long enough you could a real response from someone like
 Stephen instead of myself.

  is registered on the default layer. Since the xgm layer derives
  from the
  default layer it correctly uses my template.pt.
  But the problem is now when a view from the Blog object are called
  links in
  the template like
 
  a tal:attributes=href context/@@index.html/@@absolute_urlhome/a
 
  do not work anymore, since context is the Blog and not a IXGM
  object anymore.
  Therefore the lookup fails.

 I do not understand this particular point clearly and this seems to
 be an important point.  Could you provide more specifics?  Sounds
 like you have a blog package installed.  The blog package has objects
 that you can create (presumably blogs and blog entries).   The
 objects have various views, which have links that are being inserted
 incorrectly?

 Can reply and provide an example URL to your object and its view?
 Can you also provide the actual HTML code that is being produced
 (just the bad HTML code) versus what you would like to see?

There is no HTML Code produced since the view fails with an error.
The template is the same that is used at http://xgm.de

I have two packages:

- IXGM is the one you can see at xgm.de at this moment. It provides a 
template.pt, the contact site, CSS ressources, ... It is also a container. IT 
also defines a IXGMSKin

- IBlog is a new package. It should not know of IXGM and should also be used 
independently. In my case it is contained in IXGM. Of course it should adapt 
the look and feel of IXGM when called with the ++skin++xgm traverser set and 
then it should be rendered with template.pt (what it actually does). And that 
causes the problem:

The line in the template.pt:
a tal:attributes=href context/@@index.html/@@absolute_urlhome/a
works fine as long as context is an IXGM, because index.html is registered for 
IXGM. But if a view from the IBlog is called is it also rendered in the 
template.pt but context now is a IBlog which does not have an index.html (or 
at leat not the one I want) and therefore fails.

I have uploaded both packages at 
http://xgm.de/staticfiles/skinning-problem.zip.

Thanks for help,

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


[Zope3-Users] Still a skinning problem

2007-02-03 Thread Florian Lindner
Hello,
I am doing a repost here, since the problem really bugs me and I have gotten 
no replys anymore...

I have a template template.pt which should be applied to all site visited 
within the skin xgm.

page
for=*
name=standard_macros
permission=zope.Public
class=.views.StandardMacros
layer=xgm.interfaces.IXGMSkin
allowed_interface=zope.interface.common.mapping.IItemMapping
/

page
for=*
name=skin_macros
permission=zope.Public
layer=xgm.interfaces.IXGMSkin
template=template.pt
/

and

class StandardMacros(BaseMacros):
macro_pages = ('skin_macros', )


the template.pt is the one also used on xgm.de:

metal:block define-macro=page
metal:block define-macro=view

html xmlns=http://www.w3.org/1999/xhtml; xml:lang=de lang=de
  
head
title metal:define-slot=titleTesttitle/title
link rel=stylesheet type=text/css tal:attributes=href 
context/++resource++files/styles.css /
/head
  
body

ul id=navigation
li[ a tal:attributes=href 
context/@@index.html/@@absolute_urlhome/a ]/li

/ul

div id=content
metal:block define-slot=body
This is the content.
/metal:block
/div

/body
/html

/metal:block
/metal:block

(shortened a bit)


index.html is registered like that:

pages
for=xgm.interfaces.IXGM
layer=xgm.interfaces.IXGMSkin
permission=zope.Public
class=.views.ViewClass 

page
name=index.html
template=index.pt /

 /pages

This works perfect as far as only pages use this template who are registered 
on the same interface like the other ines (IXGM).

Now I have a third party package (Blog) which should generally be independent 
to all that but should use the template.pt which called with ++skin++xgm.

html metal:use-macro=views/standard_macros/view
  body
div metal:fill-slot=body
  h1 tal:content=context/title/h1
  div tal:content=context/description /

  div class=row tal:repeat=item view/getSortedBlogEntries
   tal:content=structure item/@@details.html /
/div
  /body
/html

is registered on the default layer. Since the xgm layer derives from the 
default layer it correctly uses my template.pt.
But the problem is now when a view from the Blog object are called links in 
the template like

a tal:attributes=href context/@@index.html/@@absolute_urlhome/a

do not work anymore, since context is the Blog and not a IXGM object anymore. 
Therefore the lookup fails.

Sorry for the long mail, I hope I was able to explain what my problem is.

Thanks,

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


Re: [Zope3-Users] zope.scheduler and triggering actions on local objects

2007-02-02 Thread Florian Lindner
Am Donnerstag, 1. Februar 2007 13:41 schrieb Alek Kowalczyk:
 Hi,
 I need to trigger periodically activities on various local components (i.e
 stored in ZoDB). I found zope.scheduler package which seem to be nice
 cron-like tool for Zope. But I did not find a clue how to use it with local
 components - in examples it is registered as global utility.

 I think about few ways of doing that. Please advice which one is the
 correct one: a) make zope.scheduler call via xml-rpc some URLs to trigger
 the activities 


 b) find (how?) local objects from scheduler global utility 
 and trigger activities c) register scheduler as local utility - it seems to
 be impossible for me, as it rather cannot be persistent, can it?

You can open a connection to the database and use it this way. Here is an 
example code that works but generated an error ofter some calls:

db = getUtility(ZODB.interfaces.IDatabase)
conn = db.open()
root = conn.root().data['Application']
zope.app.component.hooks.setSite(root)

utils = getUtilitiesFor(IYourInterface)
for i in utils:
print Utility found:, i[0]
   
db.close()

but after some calls it gives an error:

exceptions.ValueError: I/O operation on closed file

Don't know why.


  d) other solution?

 The solution b) is the one I feel is the right one. But how to find local
 objects? Can I hook into DatabaseOpenedWithRoot event and pass the database
 reference to global utility? If yes - how to deal with transactions...?

Regards,

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


Re: [Zope3-Users] Get a site

2007-01-28 Thread Florian Lindner
Am Montag, 22. Januar 2007 08:32 schrieb Christian Theune:
 Hi,

 Am Sonntag, den 21.01.2007, 14:44 +0100 schrieb Florian Lindner:
  Hello,
  I am in a function that has no context and want to set a site.
  The function is called periodically from a scheduler:
 
  from scheduler import loop
 
  def onStartup(event):
  refresher = loop.LoopTask(releaseRefreshEvent, interval=60)
 
  In this function I need to call getUtilitiesFor which needs a site set
  but I don't know how to get a site:
 
  (Pdb)  from zope.app.component import hooks
  (Pdb) from zope.app.zapi import *
 
  (Pdb) hooks.setSite(getSiteManager())
  *** AttributeError: 'BaseGlobalComponents' object has no
  attribute 'getSiteManager'
 
  (Pdb) hooks.setSite(getGlobalSiteManager())
  *** AttributeError: 'BaseGlobalComponents' object has no
  attribute 'getSiteManager'

 You don't set the site managers as a site, but the objects that are
 sites have site managers (or component registries) attached to them.

 Also, the global registry is always active, without settinga site.

  Just getting the root object (which AFAIK always is a site) would be ok.
  Or the object of static path.

 You'd have to open a connection to the database, get the root object and
 use that with setSite(). I don't have the complete spelling for that in
 my head though. If this is code that runs within Zope 3, then you might
 not want to talk to the database directly anyway because of the
 automatic transaction management.

Ok, I do it this way now:

def releaseRefreshEvent():
 Calls all utlities that have a INewsfeed interface registered. 
print releaseRefreshEvent!!
db = getUtility(ZODB.interfaces.IDatabase)
conn = db.open()
root = conn.root().data['Application']
zope.app.component.hooks.setSite(root)

utils = getUtilitiesFor(INewsfeed)
for i in utils:
print Utility called:, i[0]
i[1].sendNotification()

db.close()


called every 60 seconds. This works a few times but then gives an error:

2007-01-28T18:19:01 INFO root Startup time: 16.079 sec real, 4.780 sec CPU
releaseRefreshEvent!!
releaseRefreshEvent!!
Unhandled error in Deferred:
Traceback (most recent call last):
  File /home/florian/Zope3/src/zope/app/twisted/main.py, line 89, in main
reactor.run()
  File /home/florian/Zope3/src/twisted/internet/posixbase.py, line 206, in 
run
self.mainLoop()
  File /home/florian/Zope3/src/twisted/internet/posixbase.py, line 214, in 
mainLoop
self.runUntilCurrent()
  File /home/florian/Zope3/src/twisted/internet/base.py, line 541, in 
runUntilCurrent
call.func(*call.args, **call.kw)
--- exception caught here ---
  File /home/florian/Zope3/src/twisted/internet/task.py, line 84, in 
__call__
self.f(*self.a, **self.kw)
  File /home/florian/Desktop/zope/lib/python/CS/centershock/centershock.py, 
line 21, in releaseRefreshEvent
root = conn.root().data['Application']
  File /home/florian/Zope3/src/ZODB/Connection.py, line 304, in root
return self.get(z64)
  File /home/florian/Zope3/src/ZODB/Connection.py, line 204, in get
p, serial = self._storage.load(oid, self._version)
  File /home/florian/Zope3/src/ZODB/FileStorage/FileStorage.py, line 549, in 
load
h = self._read_data_header(pos, oid)
  File /home/florian/Zope3/src/ZODB/FileStorage/format.py, line 187, in 
_read_data_header
self._file.seek(pos)
exceptions.ValueError: I/O operation on closed file


any idea what caused it?

Thanks,

Florian

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


Re: [Zope3-Users] Get a site

2007-01-23 Thread Florian Lindner
Am Montag, 22. Januar 2007 09:40 schrieb FB:
 Hi,

 On Mon, Jan 22, 2007 at 08:32:21AM +0100, Christian Theune wrote:

 [snip]

  You'd have to open a connection to the database, get the root object and
  use that with setSite(). I don't have the complete spelling for that in
  my head though.

 db = zapi.getUtility(IDatabase)
 conn=db.open()
 root=conn.root().data['Application']

Thanks, this way it works!

Regards,

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


Re: [Zope3-Users] Get a site

2007-01-22 Thread Florian Lindner
Am Montag, 22. Januar 2007 08:32 schrieb Christian Theune:
 Hi,

 Am Sonntag, den 21.01.2007, 14:44 +0100 schrieb Florian Lindner:
  Hello,
  I am in a function that has no context and want to set a site.
  The function is called periodically from a scheduler:
 
  from scheduler import loop
 
  def onStartup(event):
  refresher = loop.LoopTask(releaseRefreshEvent, interval=60)
 
  In this function I need to call getUtilitiesFor which needs a site set
  but I don't know how to get a site:
 
  (Pdb)  from zope.app.component import hooks
  (Pdb) from zope.app.zapi import *
 
  (Pdb) hooks.setSite(getSiteManager())
  *** AttributeError: 'BaseGlobalComponents' object has no
  attribute 'getSiteManager'
 
  (Pdb) hooks.setSite(getGlobalSiteManager())
  *** AttributeError: 'BaseGlobalComponents' object has no
  attribute 'getSiteManager'

 You don't set the site managers as a site, but the objects that are
 sites have site managers (or component registries) attached to them.

 Also, the global registry is always active, without settinga site.

And how do I get the global registry?


  Just getting the root object (which AFAIK always is a site) would be ok.
  Or the object of static path.

 You'd have to open a connection to the database, get the root object and
 use that with setSite(). I don't have the complete spelling for that in
 my head though. If this is code that runs within Zope 3, then you might
 not want to talk to the database directly anyway because of the
 automatic transaction management.

The code is not being run out of Zope. It's just not part of any class, but 
it's only called when Zope is app and running.

This function is called upon a IProcessStartingEvent event:

def onStartup(event):
 Perform initializations on startup of the server. 
refresher = loop.LoopTask(releaseRefreshEvent, interval=60)
refresher.start()

in the releaseRefreshEvent I want to call all registered utilities:

def releaseRefreshEvent():
 Calls all utlities that have a INewsfeed interface registered. 
utils = getUtilitiesFor(INewsfeed)
for i in utils:
print Utility called:, i.__name__
i.sendNotification()


but that always returns no utilites at all. IMHO the problem is that a site is 
not set. How would you do that? 
(sorry, your answer is somehow too sophisticated for me...)

Thanks,

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


[Zope3-Users] Get a site

2007-01-21 Thread Florian Lindner
Hello,
I am in a function that has no context and want to set a site.
The function is called periodically from a scheduler:

from scheduler import loop

def onStartup(event):
refresher = loop.LoopTask(releaseRefreshEvent, interval=60)

In this function I need to call getUtilitiesFor which needs a site set but I 
don't know how to get a site:

(Pdb)  from zope.app.component import hooks
(Pdb) from zope.app.zapi import *

(Pdb) hooks.setSite(getSiteManager())
*** AttributeError: 'BaseGlobalComponents' object has no 
attribute 'getSiteManager'

(Pdb) hooks.setSite(getGlobalSiteManager())
*** AttributeError: 'BaseGlobalComponents' object has no 
attribute 'getSiteManager'

Just getting the root object (which AFAIK always is a site) would be ok. Or 
the object of static path.

Thanks,

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


Re: [Zope3-Users] Re: Skinning problem

2007-01-20 Thread Florian Lindner
Am Freitag, 19. Januar 2007 01:12 schrieb Philipp von Weitershausen:
 On 18 Jan 2007, at 22:10 , Florian Lindner wrote:
  Am Donnerstag, 18. Januar 2007 16:24 schrieb Philipp von
 
  Weitershausen:
  Marius Gedminas wrote:
  On Wed, Jan 17, 2007 at 09:50:58PM +0100, Florian Lindner wrote:
  Hello,
  I have a ressourceDirectory with a file styles.css
 
  resourceDirectory
  directory=files
  name=files
  /
 
  I refer to it in my default template:
 
  link rel=stylesheet type=text/css tal:attributes=href
  context/@@/files/styles.css /
 
  That's no good.  The /@@/ view  only works when context is a site.
  Besides, I'm not sure you can use it in a TALES expression like
  this.
 
  You want
 
link rel=stylesheet type=text/css
  tal:attributes=href context/++resource++files/
  styles.css /
 
  I think.  (I'm sure href context/++resource++name.css is the right
  solution for plain resource files, but I haven't used
  resourceDirectory
  much.)
 
  It works like that for resourceDirectory resources as well.
 
  Yes, it works fine but now I have another problem:
 
  The tempate contains links like:

 Which template?

  a tal:attributes=href context/@@contact.html/
  @@absolute_urlkontakt/a
 
  contact.html is registered for the interface (IXGM) of the object
  in which the
  object that should use the template (IBlog) resides. But in the
  IBlog context
  there is no contact.html.
  What is the best way to work around this?
 
  - Register contact HTML for all interfaces?
  - Make them static (no TAL) links?
 
  Both are ways I don't really like.

 I'm not getting this. Before you asked about resources, now all of a
 sudden it's about a template?

Ok, the entire situation is:

I have a template template.pt which should be applied to all site watched in 
the skin xgm.

page
for=*
name=standard_macros
permission=zope.Public
class=.views.StandardMacros
layer=xgm.interfaces.IXGMSkin
allowed_interface=zope.interface.common.mapping.IItemMapping
/

page
for=*
name=skin_macros
permission=zope.Public
layer=xgm.interfaces.IXGMSkin
template=template.pt
/

and

class StandardMacros(BaseMacros):
macro_pages = ('skin_macros', )


the template.pt is the one also used on xgm.de:

metal:block define-macro=page
metal:block define-macro=view

html xmlns=http://www.w3.org/1999/xhtml; xml:lang=de lang=de
  
head
title metal:define-slot=titleTesttitle/title
link rel=stylesheet type=text/css tal:attributes=href 
context/++resource++files/styles.css /
/head
  
body

ul id=navigation
li[ a tal:attributes=href 
context/@@index.html/@@absolute_urlhome/a ]/li

/ul

div id=content
metal:block define-slot=body
This is the content.
/metal:block
/div

/body
/html

/metal:block
/metal:block

(shortened a bit)

The styles.css is the ressource my last posts were about.

index.html is registered like that:

pages
for=xgm.interfaces.IXGM
layer=xgm.interfaces.IXGMSkin
permission=zope.Public
class=.views.ViewClass 

page
name=index.html
template=index.pt /

 /pages

This works perfect as far as only pages use this template who are registered 
on the same interface like the other ines (IXGM).

Now I have a third party package (Blog) which should generally be independent 
to all that but should use the template.pt which called with ++skin++xgm.

html metal:use-macro=views/standard_macros/view
  body
div metal:fill-slot=body
  h1 tal:content=context/title/h1
  div tal:content=context/description /

  div class=row tal:repeat=item view/getSortedBlogEntries
   tal:content=structure item/@@details.html /
/div
  /body
/html

is registered on the default layer. Since the xgm layer derives from the 
default layer it correctly uses my template.pt.
But the problem is now when a view from the Blog object are called links in 
the template like

a tal:attributes=href context/@@index.html/@@absolute_urlhome/a

do not work anymore, since context is the Blog and not a IXGM object anymore. 
Therefore the lookup fails.

Sorry for the long mail, I hope I was able to explain what my problem is.

Thanks,

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


Re: [Zope3-Users] Re: Skinning problem

2007-01-20 Thread Florian Lindner
Am Freitag, 19. Januar 2007 08:53 schrieb Marius Gedminas:
 On Thu, Jan 18, 2007 at 10:10:20PM +0100, Florian Lindner wrote:
  Yes, it works fine but now I have another problem:
 
  The tempate contains links like:
 
  a tal:attributes=href
  context/@@contact.html/@@absolute_urlkontakt/a
 
  contact.html is registered for the interface (IXGM) of the object in
  which the object that should use the template (IBlog) resides. But in the
  IBlog context there is no contact.html.

 So, if I understand you correctly, you have URLs like

No... Please see my mail to Philipp in the thread.

Thanks,

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


Re: [Zope3-Users] Re: Skinning problem

2007-01-18 Thread Florian Lindner
Am Donnerstag, 18. Januar 2007 16:24 schrieb Philipp von Weitershausen:
 Marius Gedminas wrote:
  On Wed, Jan 17, 2007 at 09:50:58PM +0100, Florian Lindner wrote:
  Hello,
  I have a ressourceDirectory with a file styles.css
 
  resourceDirectory
  directory=files
  name=files
  /
 
  I refer to it in my default template:
 
  link rel=stylesheet type=text/css tal:attributes=href
  context/@@/files/styles.css /
 
  That's no good.  The /@@/ view  only works when context is a site.
  Besides, I'm not sure you can use it in a TALES expression like this.
 
  You want
 
link rel=stylesheet type=text/css
  tal:attributes=href context/++resource++files/styles.css /
 
  I think.  (I'm sure href context/++resource++name.css is the right
  solution for plain resource files, but I haven't used resourceDirectory
  much.)

 It works like that for resourceDirectory resources as well.

Yes, it works fine but now I have another problem:

The tempate contains links like:

a tal:attributes=href context/@@contact.html/@@absolute_urlkontakt/a

contact.html is registered for the interface (IXGM) of the object in which the 
object that should use the template (IBlog) resides. But in the IBlog context 
there is no contact.html.
What is the best way to work around this?

- Register contact HTML for all interfaces?
- Make them static (no TAL) links?

Both are ways I don't really like.

Thanks,

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


Re: [Zope3-Users] Can't rename objects

2007-01-17 Thread Florian Lindner
Am Mittwoch, 17. Januar 2007 08:39 schrieb David Johnson:
 See my post about 2 weeks ago.  If you Adapter to
 IContainerNameChooser rename will not be allowed.

 Do not adapt to IContainerNameChosoer.

But I want to choose names for certain kind of objects. It works when I'm not 
implementing IContainerNamesContainer.


 On Jan 16, 2007, at 10:37 PM, Florian Lindner wrote:
  Am Dienstag, 16. Januar 2007 22:15 schrieb Christian Theune:
  Do you have a specific exception with traceback that prevents you
  from
  renaming?
 
  So far I have tried it only using the ZMI (logged in as manager).
  There is no
  rename button and also if I add another object I can't name it,
  it's just
  names like Folder-n. Just no possibility to even try.
  How to test it best programmatically?
 
  The security declarations are:
 
  require permission=zope.Public interface=.interfaces.IXGM /
  require permission=zope.ManageContent
  set_schema=.interfaces.IXGM /
 
  Thanks,
 
  Florian
 
  Christian
 
  Am Dienstag, den 16.01.2007, 21:05 +0100 schrieb Florian Lindner:
  Hello,
  I have a container object to which I can add and remove object
  but can
  not rename them. I suspet my I namechooser to be faulty:
 
  from zope.app.container.interfaces import INameChooser
  from zope.app.container.contained import NameChooser
 
  class XGMNameChooser(NameChooser):
  implements(INameChooser)
 
  def chooseName(self, name, object):
  if IAbbreviation.providedBy(object):
  # my name choosing code
  return n
  else:
  return super(XGMNameChooser, self).chooseName(name,
  object)
 
 
  registered like that:
 
  adapter
  for=.interfaces.IXGM
  provides=zope.app.container.interfaces.INameChooser
  factory=.xgm.XGMNameChooser
  /
 
 
  furthermore the objects interface implements:
 
  IContainer, IContained, IPossibleSite, IAttributeAnnotatable,
  IContainerNamesContainer.
 
  the class itself:
 
  BTreeContainer, SiteManagerContainer
 
  What's wrong?
 
  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 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


Re: [Zope3-Users] Can't rename objects

2007-01-17 Thread Florian Lindner
Am Mittwoch, 17. Januar 2007 00:44 schrieb Marius Gedminas:
 On Tue, Jan 16, 2007 at 09:05:59PM +0100, Florian Lindner wrote:
  I have a container object to which I can add and remove object but can
  not rename them. I suspet my I namechooser to be faulty:

 That might be true.

  from zope.app.container.interfaces import INameChooser
  from zope.app.container.contained import NameChooser
 
  class XGMNameChooser(NameChooser):
  implements(INameChooser)
 
  def chooseName(self, name, object):
  if IAbbreviation.providedBy(object):
  # my name choosing code
  return n

 I'm not sure I remember things correctly, but shouldn't your name
 chooser verify and optionally accept ``name`` here, if you want the
 user's desired name to ever be used?

  else:
  return super(XGMNameChooser, self).chooseName(name, object)
 
 
  registered like that:
 
  adapter
  for=.interfaces.IXGM
  provides=zope.app.container.interfaces.INameChooser
  factory=.xgm.XGMNameChooser
  /
 
 
  furthermore the objects interface implements:
 
  IContainer, IContained, IPossibleSite, IAttributeAnnotatable,
  IContainerNamesContainer.

 IContainerNamesContainer means the user will *never* get to specify the
 names used for the elements stored in this container, instead the names
 will *always* be computed automatically by the name chooser.

 Remove this interface and you will get your Rename button in the ZMI.

Thanks, that does the trick.
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Can't rename objects

2007-01-16 Thread Florian Lindner
Hello,
I have a container object to which I can add and remove object but can not 
rename them. I suspet my I namechooser to be faulty:

from zope.app.container.interfaces import INameChooser
from zope.app.container.contained import NameChooser

class XGMNameChooser(NameChooser):
implements(INameChooser)

def chooseName(self, name, object):
if IAbbreviation.providedBy(object):
# my name choosing code
return n
else:
return super(XGMNameChooser, self).chooseName(name, object)


registered like that:

adapter
for=.interfaces.IXGM
provides=zope.app.container.interfaces.INameChooser
factory=.xgm.XGMNameChooser
/


furthermore the objects interface implements:

IContainer, IContained, IPossibleSite, IAttributeAnnotatable, 
IContainerNamesContainer.

the class itself:

BTreeContainer, SiteManagerContainer

What's wrong?

Thanks,

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


Re: [Zope3-Users] Can't rename objects

2007-01-16 Thread Florian Lindner
Am Dienstag, 16. Januar 2007 22:15 schrieb Christian Theune:
 Do you have a specific exception with traceback that prevents you from
 renaming?

So far I have tried it only using the ZMI (logged in as manager). There is no 
rename button and also if I add another object I can't name it, it's just 
names like Folder-n. Just no possibility to even try.
How to test it best programmatically?

The security declarations are:

require permission=zope.Public interface=.interfaces.IXGM /
require permission=zope.ManageContent set_schema=.interfaces.IXGM /

Thanks,

Florian



 Christian

 Am Dienstag, den 16.01.2007, 21:05 +0100 schrieb Florian Lindner:
  Hello,
  I have a container object to which I can add and remove object but can
  not rename them. I suspet my I namechooser to be faulty:
 
  from zope.app.container.interfaces import INameChooser
  from zope.app.container.contained import NameChooser
 
  class XGMNameChooser(NameChooser):
  implements(INameChooser)
 
  def chooseName(self, name, object):
  if IAbbreviation.providedBy(object):
  # my name choosing code
  return n
  else:
  return super(XGMNameChooser, self).chooseName(name, object)
 
 
  registered like that:
 
  adapter
  for=.interfaces.IXGM
  provides=zope.app.container.interfaces.INameChooser
  factory=.xgm.XGMNameChooser
  /
 
 
  furthermore the objects interface implements:
 
  IContainer, IContained, IPossibleSite, IAttributeAnnotatable,
  IContainerNamesContainer.
 
  the class itself:
 
  BTreeContainer, SiteManagerContainer
 
  What's wrong?
 
  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] Blog for Zope3

2007-01-14 Thread Florian Lindner
Hello,
is there a blog package for Zope3? It doesn't need to mature just usable would 
be ok...

Thanks,

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


[Zope3-Users] getUtilitiesFor without context

2007-01-10 Thread Florian Lindner
Hello,
I have some local utilites registered. Now I try to call them from a function 
that don't have a context:

utils = getUtilitiesFor(INewsfeed)
for i in utils:
print Utility called:, i.__name__
i.sendNotification()

but that always deliver no utilities. How do get them without supplying a 
context. (the function is called regularly from a scheduler object, therefore 
it needs to be static)

Thanks,

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


Re: [Zope3-Users] getUtilitiesFor without context

2007-01-10 Thread Florian Lindner
Am Mittwoch, 10. Januar 2007 22:14 schrieb Tom Dossis:
 Florian Lindner wrote:
  Hello,
  I have some local utilites registered. Now I try to call them from a
  function that don't have a context:
 
  utils = getUtilitiesFor(INewsfeed)
  for i in utils:
  print Utility called:, i.__name__
  i.sendNotification()
 
  but that always deliver no utilities. How do get them without supplying a
  context. (the function is called regularly from a scheduler object,
  therefore it needs to be static)

 I'm not sure what a 'scheduler object' is, 

It's in the zope3 trunk.

 but it sounds like you don't 
 have you don't have a current site.

 You can confirm this with:

   from zope.app.component import hooks
   print hooks.getSite()
   # None

That is what happens.

 Use:
   # work out what your site
   hook.set(site)

Mhh, the hook object does not exist, hooks does not have a attribute set. What 
object do you refer to?


 before your util lookups.

Thanks,

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


[Zope3-Users] Utility registration vanished after restart?

2007-01-02 Thread Florian Lindner
Hello,
I have two object that are registed in content space. The first one with the 
ZMI the other one programmatically with:

getSiteManager().registerUtility(self, INewsfeed, self.__name__)

both registration show up fine in the ZMI registration tab. But after a 
restart of Zope both object are unregistred again.
Is this behavior correct? Why that?

Thanks,

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


Re: [Zope3-Users] Re: register and unregister Utility

2006-12-30 Thread Florian Lindner
Am Mittwoch, 27. Dezember 2006 21:42 schrieb Jürgen Kartnaller:
 Florian Lindner wrote:
  Am Mittwoch, 27. Dezember 2006 19:15 schrieb Jürgen Kartnaller:
  component.provideUtility for a global utility.
 
  I've found that.
 
  See zope.component.interfaces.IComponentRegistrationConvenience
 
  Ok, for registering. But what to call for unregistering? (I have a global
  utility)

 zope.component.getGlobalRegistry() implements IComponentRegistry

  Or for local utilities registered in a site manager you use the site
  manager :
 
  sm.registerUtility
  sm.unregisterUtility
 
  See zope.component.interfaces.IComponentRegistry
 
  Ok, there is the unregisterUtility function. Where do I get an object
  implementing this interface?

I have done it this way now:

from zope import component
components = component.registry.Components()
components.registerUtility(self, INewsfeed, self.__name__)

(example from registry.txt from apidoc)

It works so far that no error is raised. But I wonder why the object is not 
shown as registered in the ZMI?

Thanks,

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


[Zope3-Users] register and unregister Utility

2006-12-27 Thread Florian Lindner
Hello,
easy question but I just don't finde the approbiate function. How to register 
and unregister programmatically an utility?

Thanks,

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


Re: [Zope3-Users] Re: register and unregister Utility

2006-12-27 Thread Florian Lindner
Am Mittwoch, 27. Dezember 2006 19:15 schrieb Jürgen Kartnaller:
 component.provideUtility for a global utility.

I've found that.

 See zope.component.interfaces.IComponentRegistrationConvenience

Ok, for registering. But what to call for unregistering? (I have a global 
utility)

 Or for local utilities registered in a site manager you use the site
 manager :

 sm.registerUtility
 sm.unregisterUtility

 See zope.component.interfaces.IComponentRegistry

Ok, there is the unregisterUtility function. Where do I get an object 
implementing this interface?

Thanks,

Florian

 Jürgen

 Florian Lindner wrote:
  Hello,
  easy question but I just don't finde the approbiate function. How to
  register and unregister programmatically an utility?
 
  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


Re: [Zope3-Users] Periodically refresh RSS feeds

2006-12-19 Thread Florian Lindner
Am Dienstag, 19. Dezember 2006 08:17 schrieb Christian Theune:
 Hi,

 Florian Lindner wrote:
  Hello,
  I have the following situation:
 
  An object represents an RSS feed. It should be updated like every 20
  minutes. If there is something new a Jabber message should be send out.
 
  Currently I have it implemented with an scheduler loop that emits an
  refreshRSSFeed event evey 20 minutes. My problem is that a handler for an
  event must be a static function, but I want a handler function to be
  called as a member of every instantiated RSS feed object.
 
  Another idea I have:
  Implement an utility where the RSS feeds could register a function that
  is called every 20 minutes.
  Another way would be that this utility takes an URL and monitors the URL
  for changes and only notifies the RSS Feed object in case of a change.
 
  How would you do that?

 So there's two problems here: scheduling and notifying persistent
 objects about an event.

No, only the notifying problem.

 I don't have a good idea about the scheduling right now, except the hint
 that using a 'zopectl run' script might be worthwhile.  I'm not sure
 what a 'scheduler function is'.

I use the scheduler package from the Zope3 trunk and so far it works for me.

 About notifying persistent objects: There is a method
 'getAllUtilitiesRegisteredFor(interface)' which might help you. Have a
 look at zope/app/catalog/catalog.py beginning from line 150
 (indexDocSubscriber) how the catalog handles events and dispatches them
 to multiple catalogs. I think this pretty much matches your use case if
 you make each RSS feed a (named) utility.

The RSS feed is a object that users could add and remove to arbitrary 
(sub-folders of there home-dir) folders. I would rather regard it as content 
object and I don't like adding utilities to content space (I have never 
really understood why content- and software-space have been mixed up).
It would be possible, I think even technically superior to the next solution 
but somehome I don't like.

 Of course you could also have a utility that maintains references to all
 RSS feed objects and simply loops over them and calls a method for
 refreshing.

That's something I had mentioned in my posting too. It has advantage that the 
feeds could decide if they want to be called or not, whereas by 
the utility-way they would always be called.


Thanks for your input,

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


Re: [Zope3-Users] Periodically refresh RSS feeds

2006-12-19 Thread Florian Lindner
Am Dienstag, 19. Dezember 2006 09:44 schrieb Thierry Florac:
 Le mardi 19 décembre 2006 à 08:17 +0100, Christian Theune a écrit :
  Hi,
 
  Florian Lindner wrote:
   Hello,
   I have the following situation:
  
[...]

 Hi,

 I had a several problem to handle regular alerts which I solved in
 this way :
  - scheduling in done via the schedule package, available from Zope3
 SVN ; I created an AlertManager utility which is a subclass of
 scheduler.CronTask (because my alerts are launched at fixed time, but
 you can use other classes)

That's what I already use.

  - objects which can raise alerts are registered with a specific
 interface IAlert
  - when the AlertManager is launched, it opens a new connection (via
 ZEO.ClientStorage), search for registered components (via
 zapi.getAllUtilitiesRegisteredFor(IAlert)) and call one of the
 interface's methods which may raise the alert. In my use case an email
 is sent, but it could be any kind of alert that Python can handle.

This is the same approach that Christian suggested. I have answered to his 
posting.

Thanks,

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


Re: [Zope3-Users] Periodically refresh RSS feeds

2006-12-19 Thread Florian Lindner
Am Dienstag, 19. Dezember 2006 13:03 schrieb Christian Theune:
 Hi,

 Florian Lindner wrote:
  That's something I had mentioned in my posting too. It has advantage that
  the feeds could decide if they want to be called or not, whereas by
  the utility-way they would always be called.

 Considering your hesitation towards the component architecture, here's
 some more input:

I have no hesitations towards the component architecture. If I had I would not 
use Zope3. ;-)

 Nowadays, registering a (persistent) object as a utility expresses
 basically the same functionality. If it wants to be called, you can
 register it as a utility for an interface (and maybe a name), if you
 don't want to, you don't (or you unregister it).

 What you automatically get is:

 - you don't have to write your own registry code (again),
 - the CA is optimized to do this kind of lookups

Ok, these are two strong points.


 The distinction between software and content space was pretty much
 removed now. Even content objects are software, or not?

Ehh, got me...
Ok, I'm convinced, I'll probably do it this way.


Regards,

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


Re: [Zope3-Users] Re: Function that is called when object is fullyinstantiated

2006-11-28 Thread Florian Lindner
Am Dienstag, 28. November 2006 02:47 schrieb Roger Ineichen:
 Hi Florian

  def sendMessage(self, message, toJID):
  if status == available:
  self.client.send(xmpp.protocol.Message(toJID, message))


sendMessage is never called. Anyway, changed it to self.status, tried it but 
changed nothing.
Any other idea?

Thanks,

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


Re: [Zope3-Users] no object attributes on IObjectAddedEvent / IObjectCreatedEvent?

2006-11-24 Thread Florian Lindner
Am Freitag, 24. November 2006 16:55 schrieb Dominique Lederer:
 hi

 just tried to retrive some objects attributes (from an object i created
 vie ZMI) on the IObjectCreatedEvent. Got just emty attributes, so i
 tried it with IObjectAddedEvent, but my attributes are still in initial
 state .

 it works with IObjectModifiedEvent, but thats not my use-case.

 is there any other event i have to use to retrieve my attributes after
 an object has been created?

Quotation from a posting from Fred Drake about the same problem:


Are you using browser:addform?  There are four different attributes
that can be used to tailor when attributes of the object are set:
arguments, keyword_arguments, set_before_add, and set_after_add.
Fields that are input but not included in any of these are set after
adding the object to it's container.


Regards,

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


[Zope3-Users] Function that is called when object is fully instantiated

2006-11-19 Thread Florian Lindner
Hello,
is there a function (of a utility) that is called when the object is fully 
instantiated? The __init__ function AFAIK is called before it is fully 
instantiated and the properties from the schema are not applied yet.

Thanks,

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


Re: [Zope3-Users] Many problems with static-apidoc script...

2006-10-28 Thread Florian Lindner
Am Samstag, 28. Oktober 2006 01:18 schrieb KLEIN Stéphane:
 Hi,

 I've one zope3 instance in : ~/zope/instance/2/

 When I do :

 cd ~/zope/instance/2/bin
 ./static-apidoc -d ~/zope/doc/

 I've this error :

[...]


 What is my mistake ? How can I use static-apidoc script ?

At the moment you can't really use it. It's broken. I've lately done some work 
at it but were not able to fix it entirely.

You should get this: (with the SVN trunk)

horus bin # ./static-apidoc -d /home/florian/z3-doc/
INFO: PublisherBrowser is broken. Please use OnlineBrowser instead 
(--webserver).

with the webserver option:

horus bin # ./static-apidoc --webserver -d /home/florian/z3-doc/
INFO: Starting retrieval.
[...]

it should work. Don't forget to set username and password and a zope instance 
needs to be running. The scripts runs fine (when I tried it the last time) 
but the generated HTML pages are not changed from dynamic to static apidoc 
entirely and therefore not really work.

Regards,

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


[Zope3-Users] edit form is not being used

2006-10-26 Thread Florian Lindner
Hello,
I have an INewsfeed which is derived from IContentItem.

There is an editform defined:

editform
schema=..interfaces.INewsfeed
name=edit.html
permission=zope.ManageContent
layer=CS.skin.interfaces.IZMISkin
menu=zmi_views title=Edit
/

IContentItem does not define a form of the same name.

But when I click inside the ZMI on an newsfeed item the edit form is not used 
and only an metadata dialog is shown.

The introspector shows it:

Edit 
 
Registriert: 
/home/florian/Desktop/zope/lib/python/CS/Newsfeed/browser/configure.zcml 
(Zeile 19) 
Notwendig:  CS.Newsfeed.interfaces.INewsfeed,  CS.skin.interfaces.IZMISkin 
stellt bereit:  zope.app.menus.zmi_views  
Factory-Pfad: zope.app.publisher.browser.menu.BrowserMenuItem

But why is not used?

Thanks,

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


Re: [Zope3-Users] Logout

2006-09-22 Thread Florian Lindner
Am Freitag, 22. September 2006 09:42 schrieb FB:
 Hi,

 On Thu, Sep 21, 2006 at 07:25:06AM -0500, David Johnson wrote:
  Does anyone know how to logout? We've been using logout.html as the
  logout page for Zope Realm Basic Auth, and it does not seem to log us
  out.  We're using IE 6.

 It's not possible to log out when Basic Auth is used (except if you want
 your users to install a fancy browser extension like Webdeveloper for
 Firefox). 

I don't think that's right for the trunk. This feature was checked in lately:

Log message for revision 69975:
  Fix issue 239. Logout feature for Basic HTTP auth.

However I haven't tried it.

Regards,

Florian

 Use a different auth method (=PAU credential plugin) like 
 cookie-base-auth.
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Books example

2006-09-09 Thread Florian Lindner
Am Freitag, 8. September 2006 09:03 schrieb Sébastien VINOT:
 Hello,

 I'm using both books to learn Zope3 :
  - Web component Development with Zope 3 (Philipp Von Weitershausen)

The home page of this book is at http://worldcookery.com/

  - Zope 3 (Stephan Ritcher)

http://www.zope.org/Wikis/DevSite/Projects/ComponentArchitecture/Zope3Book but 
I don't know if it's in sync with the printed version.


 I read somewhere that examples are updated somewhere on the web but I
 can't find out where (I have to admit I did not dig into the second at
 the moment). Does someone know where example are available ?

Regards,

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


Re: [Zope3-Users] How does the static-apidoc script works?

2006-09-07 Thread Florian Lindner
Am Mittwoch, 6. September 2006 12:25 schrieb Stephan Richter:
 On Monday 14 August 2006 17:46, Florian Lindner wrote:
  ow does that script works? Executing gives an error:
 
  [EMAIL PROTECTED] ~/Zope3 $ python utilities/static-apidoc
  /home/florian/z3-doc/ Traceback (most recent call last):
    File utilities/static-apidoc, line 37, in ?
      main()
    File /home/florian/Zope3/src/zope/app/apidoc/static.py, line 504, in
  main maker.start()
    File /home/florian/Zope3/src/zope/app/apidoc/static.py, line 200, in
  start self.browser._links_factory.urltags = urltags
    File /home/florian/Zope3/src/mechanize/_mechanize.py, line 505, in
  __getattr__
      raise AttributeError(
  AttributeError: class 'zope.app.apidoc.static.PublisherBrowser'
  instance has no attribute _links_factory (perhaps you forgot to
  .select_form()?)

 You know, this is probably due to a new mechanize version. You would have
 to update the scripts probably to the latest mechanize.

I've managed to fix the script so far that it works with the OnlineBrowser() 
(self.browser = OnlineBrowser()).

If I use the PublisherBrowser() I get a ConfigurationError:

- return chooseClasses(method, environment)
  /home/florian/Zope3/src/zope/app/publication/httpfactory.py(33)chooseClasses()
- factory = factoryRegistry.lookup(method, content_type, environment)
  
/home/florian/Zope3/src/zope/app/publication/requestpublicationregistry.py(97)lookup()
- raise ConfigurationError('No registered publisher found '

Should I modify it in a way that it always uses the OnlineBrowser() and check 
in? 
Maybe I will have time to look into the problem with PublisherBrowser() but I 
doubt so since is examina time in university...

Here is some output from the script:

[EMAIL PROTECTED] ~/Zope3/utilities $ python static-apidoc /home/florian/z3-doc/
INFO: Starting retrieval.
Link   166: 
http://localhost:8080/++apidoc++/Code/ZConfig/schema/BaseParser/index.html
WARNING: Internal Server Error (500): 
http://localhost:8080/++apidoc++/Code/ZConfig/schema/BaseParser
WARNING: +- Reference: http://localhost:8080/++apidoc++/Code/staticmenu.html
Link   553: 
http://localhost:8080/++apidoc++/Code/zope/app/authentication/idpicker/IdPicker/index.html
WARNING: Internal Server Error (500): 
http://localhost:8080/++apidoc++/Code/zope/app/authentication/idpicker/IdPicker
WARNING: +- Reference: http://localhost:8080/++apidoc++/Code/staticmenu.html
Link   650: 
http://localhost:8080/++apidoc++/Code/zope/app/container/contained/ContainerModifiedEvent/index.html
WARNING: Internal Server Error (500): 
http://localhost:8080/++apidoc++/Code/zope/app/container/contained/ContainerModifiedEvent
WARNING: +- Reference: http://localhost:8080/++apidoc++/Code/staticmenu.html
Link   656: 
http://localhost:8080/++apidoc++/Code/zope/app/container/contained/ObjectMovedEvent/index.html
WARNING: Internal Server Error (500): 
http://localhost:8080/++apidoc++/Code/zope/app/container/contained/ObjectMovedEvent
WARNING: +- Reference: http://localhost:8080/++apidoc++/Code/staticmenu.html
Link  1198: 
http://localhost:8080/++apidoc++/Code/zope/app/workflow/stateful/xmlimportexport/XMLFormatChecker/index.html
WARNING: Internal Server Error (500): 
http://localhost:8080/++apidoc++/Code/zope/app/workflow/stateful/xmlimportexport/XMLFormatChecker
WARNING: +- Reference: http://localhost:8080/++apidoc++/Code/staticmenu.html
Link  1200: 
http://localhost:8080/++apidoc++/Code/zope/app/workflow/stateful/xmlimportexport/XMLStatefulImporter/index.html
WARNING: Internal Server Error (500): 
http://localhost:8080/++apidoc++/Code/zope/app/workflow/stateful/xmlimportexport/XMLStatefulImporter
WARNING: +- Reference: http://localhost:8080/++apidoc++/Code/staticmenu.html
Link  1237: 
http://localhost:8080/++apidoc++/Code/zope/component/interfaces/RegistrationEvent/index.html
WARNING: Internal Server Error (500): 
http://localhost:8080/++apidoc++/Code/zope/component/interfaces/RegistrationEvent
WARNING: +- Reference: http://localhost:8080/++apidoc++/Code/staticmenu.html
Link  1269: 
http://localhost:8080/++apidoc++/Code/zope/configuration/xmlconfig/ConfigurationHandler/index.html
WARNING: Internal Server Error (500): 
http://localhost:8080/++apidoc++/Code/zope/configuration/xmlconfig/ConfigurationHandler
WARNING: +- Reference: http://localhost:8080/++apidoc++/Code/staticmenu.html
Link  1365: 
http://localhost:8080/++apidoc++/Code/zope/fssync/metadata/EntriesHandler/index.html
WARNING: Internal Server Error (500): 
http://localhost:8080/++apidoc++/Code/zope/fssync/metadata/EntriesHandler
WARNING: +- Reference: http://localhost:8080/++apidoc++/Code/staticmenu.html
Link  1846: http://localhost:8080/++apidoc++/Interface/file/index.htm


I terminated it at this point. At the end it gets very slow, about one link 
every two seconds, but it seems to work.

Should I check in?

Regards,

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

Re: [Zope3-Users] Generate edit form from user setting

2006-08-22 Thread Florian Lindner
Am Donnerstag, 17. August 2006 23:04 schrieb Fred Drake:
 On 8/17/06, Florian Lindner [EMAIL PROTECTED] wrote:
  I have a zope.app.preference.preference.PreferenceGroup based on an
  IUserSettings interface for which I want to generate an edit form.
  I've tried to do it with a class based on EditForm but that does not
  worked for me since the EditFrom changes the self.context object. If I
  simply replace self.context by the object I got from UserPreferences it
  complains about PreferenceGroup being not adaptable to IUserSettings (and
  it's right about that).

 Sounds like you want to create an adapter.  The adapter is what's used
 for getting/setting values.

I also thought about that. But if I write an adapter from PreferenceGroup to 
IUserSettings to all that the adapter would do is to assign values the values 
from the PreferenceGroup to IUserSettings. Ok it's more generic but at the 
end the same like assigned the values to the request itself.

Is it okay to change self.context in the __init__ method of the view class 
with a PreferenceGroup object? (I just didn't know it it's not confusing the 
something in the ComponentArchitecture...)


  Of course I need to initialize the from with the values from the the
  PreferenceGroup object. Is there a better way than modifying the request
  like request.form['form.max_size'] for each field? I couldn't find one in
  the documentation but I'm almost sure there is a more elegant solution
  (since it's Zope!).

 Did you look at the get_rendered argument to
 zope.formlib.form.FormField?  Though I suspect the adapter I suggested
 above would do the trick.

Mmmhh, that's also one call for each field. I think I'll try it with the 
adapter.

Regards,

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


[Zope3-Users] Blog package

2006-08-17 Thread Florian Lindner
Hello,
is there a blog package for Zope3 around?

Thanks,

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


[Zope3-Users] How does the static-apidoc script works?

2006-08-14 Thread Florian Lindner
Hello,
how does that script works? Executing gives an error:

[EMAIL PROTECTED] ~/Zope3 $ python utilities/static-apidoc /home/florian/z3-doc/
Traceback (most recent call last):
  File utilities/static-apidoc, line 37, in ?
main()
  File /home/florian/Zope3/src/zope/app/apidoc/static.py, line 504, in main
maker.start()
  File /home/florian/Zope3/src/zope/app/apidoc/static.py, line 200, in start
self.browser._links_factory.urltags = urltags
  File /home/florian/Zope3/src/mechanize/_mechanize.py, line 505, in 
__getattr__
raise AttributeError(
AttributeError: class 'zope.app.apidoc.static.PublisherBrowser' instance has 
no attribute _links_factory (perhaps you forgot to .select_form()?)


and the z3-doc directoy is empty.

Thanks,

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


[Zope3-Users] Re: default defaultView

2006-08-10 Thread Florian Lindner
Am Mittwoch, 9. August 2006 00:27 schrieb Philipp von Weitershausen:
 Florian Lindner wrote:
  Hello,
  is there a kind of default defaultView?
  So when a object is called and no defaultView is defined that a view like
  index.html is called? I thought yes, but a test has not proven that.
 
  If there is really no such default, why? I think a little bit more
  (optional) convention over configuration would be good for Zope...

 zope.app/browser.zcml says:

   browser:defaultView name=index.html /

 So, as you can see, we indeed have a default default view. It's index.html.

That's what I thought too. But:

I go to an object and get an 404 error. Now add this ZCML to configure.zcml:

defaultView
name=index.html
for=CS.Link.interfaces.ILink
layer=CS.skin.interfaces.ICentershockSkin
/

and the same URL work. You see that there is already a view named index.html

page
name=index.html
for=CS.Link.interfaces.ILink
template=link.pt
permission=zope.View
layer=CS.skin.interfaces.ICentershockSkin
/

But why is it not used as the default view?

Thanks,

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


[Zope3-Users] nextURL not working as expected

2006-08-07 Thread Florian Lindner
Hello,
I habe a view class derived from zope.formlib.form.AddForm:

class AddLink(form.AddForm):
form_fields = form.fields(ILink)

def createAndAdd(self, data):
self.link = Link()
self.link.title = data['title']
self.link.description = data['description']
self.link.URL = data['URL']

self.context[data[title]] = self.link

return self.link

def nextURL(self):
return absoluteURL(self.link, self.request)

The view is registered for zope.app.container.interfaces.IAdding

After I have added the object I except to be redirected to the URL returned in 
nextURL. Instead I am always redirected to the add form again. It seems that 
nextURL is not even called. Why?

Thanks,

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


Re: [Zope3-Users] zope3's TAL ZPT reference

2006-08-07 Thread Florian Lindner
Am Montag, 7. August 2006 14:57 schrieb Michele Amori:
 Hello all,
 actually I'm a zope newbie. I must develop web applications with zope 3.2,
 in the next future, so I'd like some help from this ML.
 I'm searching for a ZPT (or TAL) reference for Zope 3...where is it?

Take a look here:

http://www.zope.org/Documentation/Books/ZopeBook/2_6Edition/AppendixC.stx

Regards,

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


Re: [Zope3-Users] Formlib and invariants

2006-07-19 Thread Florian Lindner
Am Mittwoch, 19. Juli 2006 03:25 schrieb Darryl Cousins:
 Hi All,

 I've had a bit of a struggle getting formlib error views to play nicely
 with invariants. That is the problem I have found to trouble me is in
 the zope.formlib.form.FormBase method error_views.

 When I use the schema:

 class IMemberRegisterForm(IMemberData, IMemberDetails):
 Schema for a member register form.

 new_password = Password(
 title=_(Choose a Password),
 required=True)

 verify_password = Password(
 title=_(Verify Password),
 required=True)

 @invariant
 def passwordsMatch(register):
 if register.new_password != register.verify_password:
 msg = _(Entered passwords do not match)
 error = ('verify_password', _(Passwords), msg)
 raise Invalid(error)

[...]

I am not sure if I've understood you correctly, but I've solved the same 
problem (raise error if passwords are not equal) this way:


class PasswordsAreNotEqual(ValidationError):
The passwords are not equal.
interface.implements(IWidgetInputError)

class IRegistrationForm(interface.Interface):
For entering the data for registration.

password = Password(title=uPassword,
description=uYour password.,
required=True)
 
password2 = Password(title=uVerify Password,
required=True)

@interface.invariant
def arePasswordsEqual(obj):
if obj.password != obj.password2:
raise PasswordsAreNotEqual


Hope this helps,

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


Re: [Zope3-Users] Create catalog index via script

2006-06-18 Thread Florian Lindner
Am Samstag, 17. Juni 2006 10:38 schrieb Achim Domma:
 Hi,

 I have a workspace object, which I initialize in the
 IObjectCreatedEvent. I try to add a catalog with an index like this:

 ensureUtility(workspace,zope.app.intid.interfaces.IIntIds,'',IntIds,asObjec
t=True)
 catalog=ensureUtility(workspace,zope.app.catalog.interfaces.ICatalog,'',Cat
alog,asObject=True) catalog[tmp]=CategoryIndex()

 workspace derives from Folder and is already a Site at this point. The
 last line causes the following error:

 ComponentLookupError: (InterfaceClass
 zope.app.intid.interfaces.IIntIds, '')

 If I remove the line, it works fine. I can see the Catalog in my
 Workspace and can add the CategoryIndex without problem!?

 Seems like I'm missing something in the setup of the IIntIds utility,
 but I have no idea what it is.

I assume that you have made workspace a site before? How does that code look 
like? Do you have this expression:

hooks.setSite(workspace)

Without that expression I used to have the same error.

Regards,

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


[Zope3-Users] Using restructered text

2006-06-15 Thread Florian Lindner
Hello,
how can I use (render to html) restructered text that is in a static file?

Thanks,

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


[Zope3-Users] Problem with 3.3 beta1

2006-06-07 Thread Florian Lindner
Hello,
my code works with svn, but not with beta1:

  File /home/xgmde/Zope3//lib/python/zope/component/_api.py, line 207, in 
getUtility
raise ComponentLookupError(interface, name)
ComponentLookupError: (InterfaceClass zope.app.intid.interfaces.IIntIds, '')

The problem is clear but it should not appear. It occurs upon adding my 
object. This object performs some initializations:


def onObjectAdded(event):
if IXGM.providedBy(event.object):
if not ISite.providedBy(event.object):
# Make it a site
xgm = event.object
site_manager = LocalSiteManager(xgm)
xgm.setSiteManager(site_manager)

intid = ensureUtility(xgm, IIntIds, '', IntIds , asObject = True)

cat = ensureUtility(xgm, ICatalog, '', Catalog, asObject = True)

abbr_index = TextIndex(abbreviation, IAbbreviation)
cat[AbbreviationIndex] = abbr_index


When I trace into that I can see that the intid is really created and also at 
the correct place.

Anyone knows whats wrong?


Thanks,

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


Re: [Zope3-Users] Utilities

2006-06-05 Thread Florian Lindner
Am Montag, 5. Juni 2006 08:14 schrieb David Johnson:
 What is the best to find the nearest utility without using a name?

 zapi.getUtility() seems to require a name (though the documentation
 implies otherwise). zapi.getAllRegisiteredUtilitiesFor() works but it
 seems to me if you have lots of utilities in other contexts, it would
 query those as well, and thereby be slow in a large application.

getUtility does not require a name.

Example:

from zope.app.zapi import getUtility
from zope.app.homefolder.interfaces import IHomeFolderManager
hfm = getUtility(IHomeFolderManager)

Regards,

Florian



 I come across this problem frequently and haven't figured out the best
 way to deal with it.
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] Generating loginForm with formlib

2006-06-02 Thread Florian Lindner
Am Donnerstag, 1. Juni 2006 22:27 schrieb Stephan Richter:
 On Thursday 20 April 2006 09:38, Florian Lindner wrote:
  but formlib generates the two fields with name=form.login therefore the
  session credentials plugin is able to extract the credentials.
 
  How can I use formlib to generate a login form?

 I think we used a custom written form. ;-) But you need to find a way to
 turn off the widget prefix. It is probably a matter of overriding the
 setUpWidgets() method.

As you know I've checked in a change to the the session credentials plugin. So 
this problem has vanished.

Regards,

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


[Zope3-Users] Again unicode problem (in configure.zcml)

2006-05-30 Thread Florian Lindner
Hello,
Zope gives this message on startup:

  File /home/florian/Zope3/src/zope/schema/_bootstrapfields.py, line 165, in 
_validate
raise WrongType(value, self._type)
zope.configuration.xmlconfig.ZopeXMLConfigurationError: 
File /home/florian/Desktop/zope/etc/site.zcml, line 7.2-7.55
ZopeXMLConfigurationError: 
File /home/florian/Desktop/zope/etc/package-includes/xgm-configure.zcml, 
line 1.0-1.25
ZopeXMLConfigurationError: 
File /home/florian/Desktop/zope/lib/python/xgm/configure.zcml, line 
2.4-2.34
ZopeXMLConfigurationError: 
File /home/florian/Desktop/zope/lib/python/xgm/browser/configure.zcml, line 
2.4-2.31
ZopeXMLConfigurationError: 
File /home/florian/Desktop/zope/lib/python/xgm/browser/skin/configure.zcml, 
line 3.4-7.6
ConfigurationError: ('Invalid value for', 'layer', ('', 
type 'unicode'))


The directive Zope is complaining about:

resourceDirectory
directory=files
name=files
layer=xgm.interfaces.IXGMSkin
/


but when I remove this one, it complains about the next one.

Weird thing is: the file is not even unicode:

[EMAIL PROTECTED] ~/Desktop/zope/lib/python/xgm/browser/skin $ file 
configure.zcml
configure.zcml: ASCII text, with CRLF line terminators

Anyone know what's wrong?

Thanks,

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


Re: [Zope3-Users] How to use catalog.searchResults

2006-05-21 Thread Florian Lindner
Am Sonntag, 21. Mai 2006 17:58 schrieb mats.nordgren:
  (Pdb) catalog.searchResults(AbbreviationIndex = ABC)
  *** TypeError: ('two-length tuple expected', 'ABC')
 
  (Pdb) catalog.searchResults([AbbreviationIndex ,ABC])
  *** TypeError: searchResults() takes exactly 1 argument (2 given)
 
  (Pdb) res = catalog.searchResults()
  (Pdb) res == None
  True
 
  How to use it?

 Have you tried

 catalog.searchResults(idx=('AbbreviationIndex', 'ABC'))

Do you mean idx as a placeholder for something or really idx?

it gives:

(Pdb) results = catalog.searchResults(idx=('AbbreviationIndex', 'ABC'))
*** KeyError: 'idx'


Regards,

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


[Zope3-Users] How to use catalog.searchResults

2006-05-20 Thread Florian Lindner
Hello,
I have a catalog:

(Pdb) catalog
zope.app.catalog.catalog.Catalog object at 0xb4a3f66c

with one index:

(Pdb) for i in catalog.keys(): print i
AbbreviationIndex

but I can't find a way to use the search results function:

(Pdb) catalog.searchResults(AbbreviationIndex = ABC)
*** TypeError: ('two-length tuple expected', 'ABC')

(Pdb) catalog.searchResults([AbbreviationIndex ,ABC])
*** TypeError: searchResults() takes exactly 1 argument (2 given)

(Pdb) res = catalog.searchResults()
(Pdb) res == None
True

How to use it?

Thanks,

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


[Zope3-Users] Calling method of superclass

2006-05-17 Thread Florian Lindner He
Hello,
should be a simple problem, but...

I have a class that is registered as a NameChooser:

from zope.app.container.contained import NameChooser

  class XGMNameChooser(NameChooser):
implements(INameChooser)

def chooseName(self, name, object):
if IAbbreviation.providedBy(object):
[...]
return n
else:
return super(NameChooser, self).chooseName(name, object)

I want to take care only of the objects that are of type IAbbrevation. But I 
can't call the 

File /home/florian/Desktop/zope/lib/python/xgm/xgm.py, line 35, in 
chooseName
return super(NameChooser, self).chooseName(name, object)
AttributeError: 'super' object has no attribute 'chooseName'

What am I doing wrong?

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


Re: [Zope3-Users] How to make catalog working?

2006-05-17 Thread Florian Lindner
Am Dienstag, 16. Mai 2006 21:51 schrieb Frank Burkhardt:
 Hi,

 On Tue, May 16, 2006 at 07:08:34PM +0200, Florian Lindner wrote:
  Am Dienstag, 16. Mai 2006 12:02 schrieb Frank Burkhardt:

 [snip]

   The IntID utility has to be registered *before* all the objects you
   want to find. No object created before you had a registered IntID
   will ever be found.
  
   Have a look at
  
http://zope3.mpg.de/suchen (Das Prinzip)
 
  I've done that and it does not help.

 Are you sure, your object implements the interface, you're indexing? Use
 the introspector to find out.

I got the problem now.

My object was not adaptable to IKeyReference. It's now by subclassing 
Persistent.

Regards,

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


Re: [Zope3-Users] How to make catalog working?

2006-05-16 Thread Florian Lindner
Am Dienstag, 16. Mai 2006 12:02 schrieb Frank Burkhardt:
 Hi,

 On Mon, May 15, 2006 at 11:16:09PM +0200, Florian Lindner wrote:
  Hello,
  I've added some content objects of interface IFoo to my site.
  Then I added a catalog to my site (and also a IntID utility). I
  registered both. To the catalog I've added a FieldIndex and a TextIndex,
  set the interface to IFoo and the fieldname to a field that IFoo has. I
  registered both indexes.

 The IntID utility has to be registered *before* all the objects you
 want to find. No object created before you had a registered IntID
 will ever be found.

 Have a look at

  http://zope3.mpg.de/suchen (Das Prinzip)

I've done that and it does not help.

The IntID utility says that 3 objects are registered, but the catalog indexes 
are still zero count.

Thanks.

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


Re: [Zope3-Users] How to make catalog working?

2006-05-16 Thread Florian Lindner
Am Dienstag, 16. Mai 2006 13:23 schrieb Jim Washington:
 Frank Burkhardt wrote:
  Hi,
 
  On Mon, May 15, 2006 at 11:16:09PM +0200, Florian Lindner wrote:
  Hello,
  I've added some content objects of interface IFoo to my site.
  Then I added a catalog to my site (and also a IntID utility). I
  registered both. To the catalog I've added a FieldIndex and a TextIndex,
  set the interface to IFoo and the fieldname to a field that IFoo has. I
  registered both indexes.
 
  The IntID utility has to be registered *before* all the objects you
  want to find. No object created before you had a registered IntID
  will ever be found.
 
  Have a look at
 
   http://zope3.mpg.de/suchen (Das Prinzip)

 You can get the IntIDs utility to register objects after they are created.

 Something like the below will register and catalog a bunch of items:

 def catalog_items(self):
 intids = zapi.getUtility(IIntIds,[name])
 catalog = zapi.getUtility(ICatalog,[name])
 for item in some_function_that_returns_the_items():
 catalog.index_doc(intids.register(item), item)

 The most important part is the intids.register(item) statement.

The problem is not that objects have been created before the IntIDs utility.

The IntID utility says that 3 objects are registered, but the catalog indexes 
are still zero count.

Thanks,

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


Re: [Zope3-Users] How to make catalog working?

2006-05-16 Thread Florian Lindner
Am Dienstag, 16. Mai 2006 21:51 schrieb Frank Burkhardt:
 Hi,

 On Tue, May 16, 2006 at 07:08:34PM +0200, Florian Lindner wrote:
  Am Dienstag, 16. Mai 2006 12:02 schrieb Frank Burkhardt:

 [snip]

   The IntID utility has to be registered *before* all the objects you
   want to find. No object created before you had a registered IntID
   will ever be found.
  
   Have a look at
  
http://zope3.mpg.de/suchen (Das Prinzip)
 
  I've done that and it does not help.

 Are you sure, your object implements the interface, you're indexing? Use
 the introspector to find out.

Direkt bereitgestellte Schnittstellen
Keine Schnittstelle direkt bereitgestellt

Bereitgestellte Schnittstellen
xgm.interfaces.IAbbreviation ---
zope.annotation.interfaces.IAttributeAnnotatable 
zope.app.container.interfaces.IContained

I've marked the interface that I've configured the indexes on.

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


[Zope3-Users] Problem with Umlauts

2006-05-08 Thread Florian Lindner
Hello,
I have an schema like that:

class IAbbreviation(Interface):
abbreviation = TextLine(
title = uAbkürzung,
required = True)

meaning = TextLine(
title = uBedeutung,
required = True)

description = TextLine(
title = uErklärung,
required = False)


but in all Forms (ZMI or formlib generated) the German Umlauts are displayed 
like Abkürzung which should be Abkürzung.

Anyone got an idea what's wrong?

Thanks,

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


Re: [Zope3-Users] Problem with Umlauts

2006-05-08 Thread Florian Lindner
Am Montag, 8. Mai 2006 22:16 schrieb Egon Frerich:
 Hi Florian,

 do you have the first line

 # -*- coding: utf8 -*-

 in your python module? 

No.

 And is the source encoded in UTF-8? 

Yes.
But with the line above added to the file it works now. Never heard of that 
line...

Thanks,

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


[Zope3-Users] formlib: Some additional text

2006-05-05 Thread Florian Lindner
Hello,
I've a normal formlib:

class xy(Formlib):
form_fields = IInterface

page
   class .views.xy /

(pseudo-code)

Now I want to place some additional text above the form stuff. But I want to 
keep all this usefull JavaScript stuff that form lib inserts.

How can I do that?

Thanks,

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


Re: [Zope3-Users] formlib: Some additional text

2006-05-05 Thread Florian Lindner
Am Freitag, 5. Mai 2006 17:10 schrieb Fred Drake:
 On 5/5/06, Florian Lindner [EMAIL PROTECTED] wrote:
  Now I want to place some additional text above the form stuff. But I
  want to keep all this usefull JavaScript stuff that form lib inserts.

 Can you use the extra_info slot?

I think that would work. (I've looked at its position in 
zope/formlib/pageform.pt).

But how can I fill that slot?

I've tried by adding a template to the configure.zcml:


html metal:use-macro=context/@@standard_macros/page
body
metal:block fill-slot=body

/metal:block

/body
/html

@@standard_macros/page is my template in my skin. The skin is derived from the 
rotterdam skin.

Where do I add the fill-slot? I've tried a various locations in the template 
above but nothing has a real effect.

Thanks,

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


[Zope3-Users] Static vocabulary

2006-04-30 Thread Florian Lindner
Hello,
I want to define an vocabulary schema field with a fixed sets of values. How 
can I do that? How can I define it directly in ZCML?

Thanks,

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


[Zope3-Users] Generating loginForm with formlib

2006-04-20 Thread Florian Lindner
Hello,
I want to generate a login form for the PAU session credentials plugin. The 
plugin expects a form that have a login and a password field.

I've created a interface:

class ILoginForm(Interface):
For generating the login form.

login = TextLine(title=uUsername,
required=True)

password = Password(title=uPassword,
required=True)

but formlib generates the two fields with name=form.login therefore the 
session credentials plugin is able to extract the credentials.

How can I use formlib to generate a login form?

Thanks,

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


Re: [Zope3-Users] Programatically add plugins to PAU

2006-04-12 Thread Florian Lindner
Am Mittwoch, 12. April 2006 08:50 schrieb Stephan Richter:
 On Wednesday 12 April 2006 02:39, Michael Howitz wrote:
  This is how we did it in a project:
  createAuthenticationUtils is called on handling the ObjectAddedEvent for
  the folder (which is programmatically made a site) which should contain
  the PAU.

 Interesting. We did, of course, something similar too in our current
 project. This either means that (a) PAU is too hard to set up and/or (b)
 that we need another helper layer.

 I would like to think the problem is (b), because I like the flexibility of
 PAU. The configuration package we wrote is step one, but it would be good
 to agree on a set of high-level helper functions too.

I think it's fine the way it is beside one thing.


# This is fine, it's added just like all the other utilites.

pau = ensureUtility(cs, IPluggableAuthentication, '', 
PluggableAuthentication , asObject = True)



# This is ok for adding, but I got no idea how to register it. A nice thing 
would be function like ensurePlugin that works analog to ensureUtility (adds 
und registers a plugin, does the NameChooser call if needed, ...)

principal_folder = PrincipalFolder(prefix = cs)
pau[PrincipalFolder] = principal_folder


# This is pretty straightforward but I was not expecting to give a string, 
rather I thougt it expected a Interface or something like that.

pau.credentialsPlugins = (u'Session Credentials',)



The only thing I would change is to add a ensurePlugin function to either the 
pau object itself or also as part of zope.app.appsetup. (like all the other 
ensure* functions).

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


Re: [Zope3-Users] Programatically add plugins to PAU

2006-04-12 Thread Florian Lindner
Am Mittwoch, 12. April 2006 08:39 schrieb Michael Howitz:
 Florian Lindner wrote:
  Hello,
  I've a PluggableAuthentication and want to add and register some plugins
  to it.
 
  Adding works fine:
 
  principal_folder =
  zope.app.authentication.principalfolder.PrincipalFolder(prefix = cs)
 
  pau[PrincipalFolder] = principal_folder
 
  and I think I can select it with:
 
  pau.credentialsPlugins = [principal_folder]
 
  but how to register it before?
 
  And how do I select credential plugins?

 This is how we did it in a project:
 createAuthenticationUtils is called on handling the ObjectAddedEvent for
 the folder (which is programmatically made a site) which should contain
 the PAU.

  reg = site.UtilityRegistration(name, interface, utility)

Thanks for the code. One question: Of what type is site?

Thanks,

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


[Zope3-Users] ZPT traverser for finding site

2006-03-28 Thread Florian Lindner
Hello,
is there a ZPT traverser for finding the nearest site in Zope3?

a tal:attributes=href site/registrationForm/absoluteURLregister/a/li

because registrationForm is registered in my object which forms the site.

Thanks,

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


[Zope3-Users] Deprecate conditionally

2006-03-27 Thread Florian Lindner
Hello,
I want show a deprecation warning only if a argument of a function is set to 
False.

def foo(arg1, arg2, arg3 = False):

if not arg3:
arg3 = deprecation.deprecated(arg3, arg3=False is deprecated.)

But that does not show anything. How do it correctly?

Thanks,

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


[Zope3-Users] New way of using skins

2006-03-08 Thread Florian Lindner
Hello,

I have:

zope:interface
interface=.interfaces.ICentershockSkin
type=zope.publisher.interfaces.browser.IBrowserSkinType
name=centershock
/


class ICentershockSkin(zope.app.rotterdam.Rotterdam):


What do I have to give for the layer or type (what is the difference?) 
attributes of view / pages / ... directives?

layer = centershock does not seem to work anymore (for what is name attribute 
of the interface directive?).

layer=CS.skin.interfaces.ICentershockLayer seems to work but do I always 
have to give the lenghty python path??


Thanks,

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


[Zope3-Users] Creating objects in software space when making site

2006-03-06 Thread Florian Lindner
Hello,
my content object depends on a number of utilities to be present. It is 
usually also used as a site. During development it happens often that I 
delete and recreate it.
Can I install a hook or something so I can make that these utilies are being 
created when my objects becomes a site? How do I create utitlies in software 
space?

Thanks,

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


[Zope3-Users] Wierd import problem

2006-02-28 Thread Florian Lindner
Hello,
I've a wierd problem which is supposed to be plain simple but I can't see 
it...

Zope3 gives on startup:


  File /home/florian/Desktop/zope/lib/python/CS/user_management/views.py, 
line 2, in ?
from interfaces import IRegistrationForm
  File 
/home/florian/Desktop/zope/lib/python/CS/user_management/interfaces.py, 
line 5, in ?
from views import UserRegistrationField
zope.configuration.xmlconfig.ZopeXMLConfigurationError: File 
/home/florian/Desktop/zope/etc/site.zcml, line 7.2-7.55
ZopeXMLConfigurationError: File 
/home/florian/Desktop/zope/etc/package-includes/cs-configure.zcml, line 
1.0-1.24
ZopeXMLConfigurationError: File 
/home/florian/Desktop/zope/lib/python/CS/configure.zcml, line 20.4-20.42
ZopeXMLConfigurationError: File 
/home/florian/Desktop/zope/lib/python/CS/user_management/configure.zcml, 
line 3.4-11.38
ImportError: cannot import name UserRegistrationField



my views.py has:


class UserRegistrationField(TextLine):
implements(ITextLine)

def _validate(self, value):
super(UserRegistrationField, self)._validate(value)
[...]


and my interfaces.py:

from views import UserRegistrationField

both are in the same directory. If I remove the the import everything goes 
well. If I cutpaste the code from views.py to interfaces it works too.

What am I doing wrong here?


Thanks,

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


  1   2   >