Mailing List Archive

More browser views
Hi,

I'm currently working on a project which will hopefully have no TTW code
so I was hoping to be do without skins - currently I have a my skin on top
of CMFDefault but it is just main_template and some CSS. If I drop the CMF
skins entirely I hit some problems as quite a few forms exist only in the
skins so I'd like to start work on views where required. I suggest keeping
all the views in "browser" but adding some packages such as "content",
"membership" and "workflow". I started work on login and logout but I hit
some problems with CookieCrumbler expecting the login form to have a URL.
What does a view need to provide to work nicely with this?

Charlie
--
Charlie Clark
Managing Director
Clark Consulting & Research
German Office
Helmholtzstr. 20
Düsseldorf
D- 40215
Tel: +49-211-600-3657
Mobile: +49-178-782-6226
_______________________________________________
Zope-CMF maillist - Zope-CMF@zope.org
https://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests
Re: More browser views [ In reply to ]
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 4/7/10 13:09 , Charlie Clark wrote:
> Hi,
>
> I'm currently working on a project which will hopefully have no TTW code
> so I was hoping to be do without skins - currently I have a my skin on top
> of CMFDefault but it is just main_template and some CSS. If I drop the CMF
> skins entirely I hit some problems as quite a few forms exist only in the
> skins so I'd like to start work on views where required. I suggest keeping
> all the views in "browser" but adding some packages such as "content",
> "membership" and "workflow". I started work on login and logout but I hit
> some problems with CookieCrumbler expecting the login form to have a URL.
> What does a view need to provide to work nicely with this?

I think I would change the cookie crumbler to expect both: Either a page
with an ID that the cookie crumbler can traverse to (which is what it
does right now), or an ID for a view that you could traverse to using
the "@@" notation.

jens

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (Darwin)

iEYEARECAAYFAku8cMkACgkQRAx5nvEhZLKA2wCfR5xR38bgjTgBIuabsp8osacZ
bqcAnA3houfP+WQiB0pe+Hnq4/QHPhh9
=cq8q
-----END PGP SIGNATURE-----
_______________________________________________
Zope-CMF maillist - Zope-CMF@zope.org
https://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests
Re: More browser views [ In reply to ]
Am 07.04.2010, 13:47 Uhr, schrieb Jens Vagelpohl <jens@dataflake.org>:

> I think I would change the cookie crumbler to expect both: Either a page
> with an ID that the cookie crumbler can traverse to (which is what it
> does right now), or an ID for a view that you could traverse to using
> the "@@" notation.

Sort of:

try:
page.getId()
except AttributeError:
page.restrictedTraverse() # or getMultiAdapter((context, request), name=)

I'm a bit hazy on traversal. Actually I'm a bit useless on it!

Charlie
--
Charlie Clark
Managing Director
Clark Consulting & Research
German Office
Helmholtzstr. 20
Düsseldorf
D- 40215
Tel: +49-211-600-3657
Mobile: +49-178-782-6226
_______________________________________________
Zope-CMF maillist - Zope-CMF@zope.org
https://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests
Re: More browser views [ In reply to ]
Hi!


Charlie Clark wrote:
> I'm currently working on a project which will hopefully have no TTW code
> so I was hoping to be do without skins - currently I have a my skin on top
> of CMFDefault but it is just main_template and some CSS. If I drop the CMF
> skins entirely I hit some problems as quite a few forms exist only in the
> skins so I'd like to start work on views where required. I suggest keeping
> all the views in "browser" but adding some packages such as "content",
> "membership" and "workflow". I started work on login and logout but I hit
> some problems with CookieCrumbler expecting the login form to have a URL.
> What does a view need to provide to work nicely with this?

I have a LoginFormView and a MailPasswordFormView in my private
repository. They allow to insert the email address instead of the member
id. The views look up the first user that matches the email address.

Maybe I should add them to CMFDefault? I guess they need just a few
changes to be ready for checkin.


Cheers,

Yuppie
_______________________________________________
Zope-CMF maillist - Zope-CMF@zope.org
https://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests
Re: More browser views [ In reply to ]
Am 07.04.2010, 14:27 Uhr, schrieb yuppie <y.2010@wcm-solutions.de>:

> I have a LoginFormView and a MailPasswordFormView in my private
> repository. They allow to insert the email address instead of the member
> id. The views look up the first user that matches the email address.

No changes required to CookieCrumber?

> Maybe I should add them to CMFDefault? I guess they need just a few
> changes to be ready for checkin.

Sounds great. As Tres has noted with ursine_globals - Views can have their
own tests. Oops, more work! ;-)

Charlie
--
Charlie Clark
Managing Director
Clark Consulting & Research
German Office
Helmholtzstr. 20
Düsseldorf
D- 40215
Tel: +49-211-600-3657
Mobile: +49-178-782-6226
_______________________________________________
Zope-CMF maillist - Zope-CMF@zope.org
https://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests
Re: More browser views [ In reply to ]
Hi!


Charlie Clark wrote:
> Am 07.04.2010, 14:27 Uhr, schrieb yuppie<y.2010@wcm-solutions.de>:
>
>> I have a LoginFormView and a MailPasswordFormView in my private
>> repository. They allow to insert the email address instead of the member
>> id. The views look up the first user that matches the email address.
>
> No changes required to CookieCrumber?

Where is auto_login_page used? A quick look at the code tells me it is
only used for the unauth redirect. And that seems to be generally
broken, at least on trunk :(

Never noticed that. Doesn't work with my view either.


Cheers,

Yuppie
_______________________________________________
Zope-CMF maillist - Zope-CMF@zope.org
https://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests
Re: More browser views [ In reply to ]
yuppie wrote:
> Where is auto_login_page used? A quick look at the code tells me it is
> only used for the unauth redirect. And that seems to be generally
> broken, at least on trunk :(
>
> Never noticed that. Doesn't work with my view either.

See https://bugs.launchpad.net/zope-cmf/+bug/558340

Cheers, Yuppie
_______________________________________________
Zope-CMF maillist - Zope-CMF@zope.org
https://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests
Re: More browser views [ In reply to ]
Hi!


Charlie Clark wrote:
> Am 07.04.2010, 13:47 Uhr, schrieb Jens Vagelpohl<jens@dataflake.org>:
>
>> I think I would change the cookie crumbler to expect both: Either a page
>> with an ID that the cookie crumbler can traverse to (which is what it
>> does right now), or an ID for a view that you could traverse to using
>> the "@@" notation.
>
> Sort of:
>
> try:
> page.getId()
> except AttributeError:
> page.restrictedTraverse() # or getMultiAdapter((context, request), name=)
>
> I'm a bit hazy on traversal. Actually I'm a bit useless on it!

getUnauthorizedURL is already using restrictedTraverse. This only fails
because it starts from self instead of the parent (=portal root) and the
login form is usually not registered for the cookie crumbler.

And it tries to call absolute_url(). Views don't have that method.


An other approach would be to look up the URLs in the Actions tool. The
login URL is already specified in the 'user/login' Action, an invisible
logged_out Action could be added. Long time ago the cookie crumbler had
a stand alone version, so there are no dependencies on other tools. But
now I would prefer to avoid redundant settings.


Cheers,

Yuppie
_______________________________________________
Zope-CMF maillist - Zope-CMF@zope.org
https://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests
Re: More browser views [ In reply to ]
Am 09.04.2010, 12:06 Uhr, schrieb yuppie <y.2010@wcm-solutions.de>:

> getUnauthorizedURL is already using restrictedTraverse. This only fails
> because it starts from self instead of the parent (=portal root) and the
> login form is usually not registered for the cookie crumbler.
> And it tries to call absolute_url(). Views don't have that method.

Thanks for the explanation.

Adding a method to the view is easy enough:

def absolute_url(self):
return "%s/%s" % (self.utool(),
self.context.auto_login_page)

Although this exposes some of the drawbacks of the current implementation.

> An other approach would be to look up the URLs in the Actions tool. The
> login URL is already specified in the 'user/login' Action, an invisible
> logged_out Action could be added. Long time ago the cookie crumbler had
> a stand alone version, so there are no dependencies on other tools. But
> now I would prefer to avoid redundant settings.

Makes sense. I can see logging in and out as special cases of actions -
you shouldn't really be able to do without them. But they shouldn't be
hard-coded into CookieCrumbler.

Any idea why CookieCrumbler is a Folder?

Charlie
--
Charlie Clark
Managing Director
Clark Consulting & Research
German Office
Helmholtzstr. 20
Düsseldorf
D- 40215
Tel: +49-211-600-3657
Mobile: +49-178-782-6226
_______________________________________________
Zope-CMF maillist - Zope-CMF@zope.org
https://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests
Re: More browser views [ In reply to ]
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 4/9/10 13:29 , Charlie Clark wrote:
> Any idea why CookieCrumbler is a Folder?

They can contain objects that can be used as login/logout pages, such as
DTML methods or Page Templates.

Needless to say, this is more useful when using a CookieCrumbler as a
standalone object without a portal. The CMF does not need this, and I
would even say it only adds confusion and should be removed.

jens

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (Darwin)

iEYEARECAAYFAku/Ec8ACgkQRAx5nvEhZLK3jACgpjEwDmt+0ZDUq1/flgfN4B8e
l2sAoKBp5kOE3vjnsx/6FKnL8VTo/2Rm
=Dcy8
-----END PGP SIGNATURE-----
_______________________________________________
Zope-CMF maillist - Zope-CMF@zope.org
https://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests
Re: More browser views [ In reply to ]
Am 09.04.2010, 13:38 Uhr, schrieb Jens Vagelpohl <jens@dataflake.org>:

> They can contain objects that can be used as login/logout pages, such as
> DTML methods or Page Templates.

Ah, that's how exUserFolder works.

> Needless to say, this is more useful when using a CookieCrumbler as a
> standalone object without a portal. The CMF does not need this, and I
> would even say it only adds confusion and should be removed.

+1 for that.

I also noticed that ICookieCrumbler is an interface without a purpose at
the moment. Probably a good time to flesh it out and clean up the
implementation afterwards.

Charlie
--
Charlie Clark
Managing Director
Clark Consulting & Research
German Office
Helmholtzstr. 20
Düsseldorf
D- 40215
Tel: +49-211-600-3657
Mobile: +49-178-782-6226
_______________________________________________
Zope-CMF maillist - Zope-CMF@zope.org
https://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests
Re: More browser views [ In reply to ]
Hi!


Charlie Clark wrote:
> Am 07.04.2010, 14:27 Uhr, schrieb yuppie<y.2010@wcm-solutions.de>:
>> Maybe I should add them to CMFDefault? I guess they need just a few
>> changes to be ready for checkin.
>
> Sounds great. As Tres has noted with ursine_globals - Views can have their
> own tests. Oops, more work! ;-)

At least I have some functional doctests. I hope that's sufficient.

LoginFormView and MailPasswordFormView are now checked in on the trunk.
But so far they are not hooked up by a profile.

http://svn.zope.org/?rev=110737&view=rev


These issues still need to be resolved:

- Someone has to modify CookieCrumber to make it work with views.

- Maybe the "Constraint not satisfied" error for invalid member IDs or
email addresses gives too much information: Anonymous users can check
that way if a user with a specific email address or member ID exists.
What do others think? Is that a security hole big enough to care about?

- Maybe the code makes some implicit assumptions about the
authentication process that are not always correct. Would be nice if
some people could test the views in their customized context. Right now
you have to call "path/to/siteroot/login.html" directly for testing.


Cheers,

Yuppie
_______________________________________________
Zope-CMF maillist - Zope-CMF@zope.org
https://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests
Re: More browser views [ In reply to ]
Am 09.04.2010, 13:38 Uhr, schrieb Jens Vagelpohl <jens@dataflake.org>:

> Needless to say, this is more useful when using a CookieCrumbler as a
> standalone object without a portal. The CMF does not need this, and I
> would even say it only adds confusion and should be removed.

I'm ready to commit this (now inherits from UniqueObject, PropertyManager
and SimpleItem) but wanted to run the tests to check. Assuming I'm using
the CMF-buildout checkout what's the correct way of doing this?

bin/test -s Products.CMFCore brings up an error related to ZopeUndo

Charlie
--
Charlie Clark
Managing Director
Clark Consulting & Research
German Office
Helmholtzstr. 20
Düsseldorf
D- 40215
Tel: +49-211-600-3657
Mobile: +49-178-782-6226
_______________________________________________
Zope-CMF maillist - Zope-CMF@zope.org
https://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests
Re: More browser views [ In reply to ]
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 4/14/10 15:43 , Charlie Clark wrote:
> Am 09.04.2010, 13:38 Uhr, schrieb Jens Vagelpohl <jens@dataflake.org>:
>
>> Needless to say, this is more useful when using a CookieCrumbler as a
>> standalone object without a portal. The CMF does not need this, and I
>> would even say it only adds confusion and should be removed.
>
> I'm ready to commit this (now inherits from UniqueObject, PropertyManager
> and SimpleItem) but wanted to run the tests to check. Assuming I'm using
> the CMF-buildout checkout what's the correct way of doing this?
>
> bin/test -s Products.CMFCore brings up an error related to ZopeUndo

Traceback?

jens

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (Darwin)

iEYEARECAAYFAkvFx5sACgkQRAx5nvEhZLKvKwCgubw2WJ8JPIgM1G36MPaX47to
dPEAoI6hZyhZGWMiOsK0w+J2/xfEEu1Z
=Hdcb
-----END PGP SIGNATURE-----
_______________________________________________
Zope-CMF maillist - Zope-CMF@zope.org
https://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests
Re: More browser views [ In reply to ]
Am 14.04.2010, 15:48 Uhr, schrieb Jens Vagelpohl <jens@dataflake.org>:

> Traceback?

fuchsia:trunk charlieclark$ bin/test -s Products.CMFCore
Traceback (most recent call last):
File "bin/test", line 107, in <module>
'--test-path',
'/Users/charlieclark/Sites/cmf-svn/CMF.buildout/trunk/src/five.localsitemanager/src',
File
"/Users/charlieclark/Sites/cmf-svn/CMF.buildout/trunk/eggs/zope.testing-3.9.3-py2.6.egg/zope/testing/testrunner/__init__.py",
line 32, in run
failed = run_internal(defaults, args, script_parts=script_parts)
File
"/Users/charlieclark/Sites/cmf-svn/CMF.buildout/trunk/eggs/zope.testing-3.9.3-py2.6.egg/zope/testing/testrunner/__init__.py",
line 45, in run_internal
runner.run()
File
"/Users/charlieclark/Sites/cmf-svn/CMF.buildout/trunk/eggs/zope.testing-3.9.3-py2.6.egg/zope/testing/testrunner/runner.py",
line 126, in run
feature.global_setup()
File
"/Users/charlieclark/Sites/cmf-svn/CMF.buildout/trunk/eggs/zope.testing-3.9.3-py2.6.egg/zope/testing/testrunner/find.py",
line 418, in global_setup
tests = find_tests(self.runner.options, self.runner.found_suites)
File
"/Users/charlieclark/Sites/cmf-svn/CMF.buildout/trunk/eggs/zope.testing-3.9.3-py2.6.egg/zope/testing/testrunner/find.py",
line 117, in find_tests
for suite in found_suites:
File
"/Users/charlieclark/Sites/cmf-svn/CMF.buildout/trunk/eggs/zope.testing-3.9.3-py2.6.egg/zope/testing/testrunner/find.py",
line 127, in find_suites
for fpath, package in find_test_files(options):
File
"/Users/charlieclark/Sites/cmf-svn/CMF.buildout/trunk/eggs/zope.testing-3.9.3-py2.6.egg/zope/testing/testrunner/find.py",
line 184, in find_test_files
for f, package in find_test_files_(options):
File
"/Users/charlieclark/Sites/cmf-svn/CMF.buildout/trunk/eggs/zope.testing-3.9.3-py2.6.egg/zope/testing/testrunner/find.py",
line 212, in find_test_files_
for (p, package) in test_dirs(options, {}):
File
"/Users/charlieclark/Sites/cmf-svn/CMF.buildout/trunk/eggs/zope.testing-3.9.3-py2.6.egg/zope/testing/testrunner/find.py",
line 268, in test_dirs
p = import_name(p)
File
"/Users/charlieclark/Sites/cmf-svn/CMF.buildout/trunk/eggs/zope.testing-3.9.3-py2.6.egg/zope/testing/testrunner/find.py",
line 335, in import_name
__import__(name)
File
"/Users/charlieclark/Sites/cmf-svn/CMF.buildout/trunk/src/Products.CMFCore/Products/CMFCore/__init__.py",
line 18, in <module>
import PortalFolder
File
"/Users/charlieclark/Sites/cmf-svn/CMF.buildout/trunk/src/Products.CMFCore/Products/CMFCore/PortalFolder.py",
line 26, in <module>
from OFS.Folder import Folder
File
"/Users/charlieclark/Sites/cmf-svn/CMF.buildout/trunk/src/Zope2/src/OFS/Folder.py",
line 32, in <module>
from OFS.ObjectManager import ObjectManager
File
"/Users/charlieclark/Sites/cmf-svn/CMF.buildout/trunk/src/Zope2/src/OFS/ObjectManager.py",
line 49, in <module>
from webdav.NullResource import NullResource
File
"/Users/charlieclark/Sites/cmf-svn/CMF.buildout/trunk/src/Zope2/src/webdav/NullResource.py",
line 33, in <module>
from OFS.SimpleItem import Item_w__name__
File
"/Users/charlieclark/Sites/cmf-svn/CMF.buildout/trunk/src/Zope2/src/OFS/SimpleItem.py",
line 45, in <module>
from App.Undo import UndoSupport
File
"/Users/charlieclark/Sites/cmf-svn/CMF.buildout/trunk/src/Zope2/src/App/Undo.py",
line 29, in <module>
from ZopeUndo.Prefix import Prefix
ImportError: No module named ZopeUndo.Prefix
fuchsia:trunk charlieclark$ bin/zopepy

>>> from ZopeUndo.Prefix import Prefix
Traceback (most recent call last):
File "<console>", line 1, in <module>
ImportError: No module named ZopeUndo.Prefix

Charlie
--
Charlie Clark
Managing Director
Clark Consulting & Research
German Office
Helmholtzstr. 20
Düsseldorf
D- 40215
Tel: +49-211-600-3657
Mobile: +49-178-782-6226
_______________________________________________
Zope-CMF maillist - Zope-CMF@zope.org
https://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests
Re: More browser views [ In reply to ]
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 4/14/10 15:49 , Charlie Clark wrote:
> File
> "/Users/charlieclark/Sites/cmf-svn/CMF.buildout/trunk/src/Zope2/src/OFS/SimpleItem.py",
> line 45, in <module>
> from App.Undo import UndoSupport
> File
> "/Users/charlieclark/Sites/cmf-svn/CMF.buildout/trunk/src/Zope2/src/App/Undo.py",
> line 29, in <module>
> from ZopeUndo.Prefix import Prefix
> ImportError: No module named ZopeUndo.Prefix

Have you updated your sandbox and re-run bin/buildout? Several items
were pulled out of Zope just recently, including ZopeUndo, and they are
pulled in as separate eggs during the buildout.

jens

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (Darwin)

iEYEARECAAYFAkvFyXEACgkQRAx5nvEhZLK8AwCfTpxrgib36C8SN+8+kmg2vHpP
2wUAn2juI4e1P12HChJ2MJwhh9iDYCBZ
=ccNT
-----END PGP SIGNATURE-----
_______________________________________________
Zope-CMF maillist - Zope-CMF@zope.org
https://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests
Re: More browser views [ In reply to ]
Am 14.04.2010, 15:56 Uhr, schrieb Jens Vagelpohl <jens@dataflake.org>:

> Have you updated your sandbox and re-run bin/buildout? Several items
> were pulled out of Zope just recently, including ZopeUndo, and they are
> pulled in as separate eggs during the buildout.

The sandbox is kept pretty up to date but I'd forgotten to run buildout
again. Some minor tests to fix it seems before I can commit.

Charlie
--
Charlie Clark
Managing Director
Clark Consulting & Research
German Office
Helmholtzstr. 20
Düsseldorf
D- 40215
Tel: +49-211-600-3657
Mobile: +49-178-782-6226
_______________________________________________
Zope-CMF maillist - Zope-CMF@zope.org
https://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests
Re: More browser views [ In reply to ]
Am 14.04.2010, 16:11 Uhr, schrieb Charlie Clark
<charlie.clark@clark-consulting.eu>:

> The sandbox is kept pretty up to date but I'd forgotten to run buildout
> again. Some minor tests to fix it seems before I can commit.

Changes required to make tests pass:

* explicitly set the CookieCrumbler's id if passed on creation (like a
folder). Ids are required by GenericSetup's import/export tests

I assumed it would be a good idea to make CookieCrumbler a unique object
like the other tools but this breaks CookieCrumbler's own tests which
depend on _setId() being used.

So - should CookieCrumbler be unique?

Incidentally when setId() is called Python 2.6 complains about the error
message itself:

Error Type: TypeError
Error Value: exceptions must be old-style classes or derived from
BaseException, not str

Do we need to fix this.

Charlie
--
Charlie Clark
Managing Director
Clark Consulting & Research
German Office
Helmholtzstr. 20
Düsseldorf
D- 40215
Tel: +49-211-600-3657
Mobile: +49-178-782-6226
_______________________________________________
Zope-CMF maillist - Zope-CMF@zope.org
https://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests