Discussion:
[silva-dev] zope.schema - overriding field with no value
Jonathan Bowlas
2011-06-14 16:10:14 UTC
Permalink
When creating a silva extension how would I go about overriding a non
required field with no value.

For example I have a TextLine field:

analytics_tracker_code = schema.TextLine(
title=u"Google Analytics Tracker Code",
description=u"Google Analytics Tracker Code ID (e.g 'UA-XXXXXX-X').",
required=False)

However if I add a value to this field using the edit form of my
extension and then later decide I want to remove the value by deleting
it via the form. The existing entry is retained as there is nothing to
overwrite it.

What can I do to get the field back to None? I tried setting
default=None, but that doesn't work.

Cheers

Jon
--
Jonathan Bowlas
Web Support Officer
Media Services
University College London
Email: j.bowlas at ucl.ac.uk
Sylvain Viollon
2011-06-14 16:28:26 UTC
Permalink
On Tue, 14 Jun 2011 17:10:14 +0100
Jonathan Bowlas <j.bowlas at ucl.ac.uk> wrote:

Hello,
Post by Jonathan Bowlas
When creating a silva extension how would I go about overriding a non
required field with no value.
analytics_tracker_code = schema.TextLine(
title=u"Google Analytics Tracker Code",
description=u"Google Analytics Tracker Code ID (e.g
'UA-XXXXXX-X').", required=False)
However if I add a value to this field using the edit form of my
extension and then later decide I want to remove the value by deleting
it via the form. The existing entry is retained as there is nothing to
overwrite it.
What can I do to get the field back to None? I tried setting
default=None, but that doesn't work.
Yes, it is a bug I know and that people already reported to me.

I will have a look tomorrow.

Regards,

Sylvain,
--
Sylvain Viollon -- Infrae
t +31 10 243 7051 -- http://infrae.com
Hoevestraat 10 3033GC Rotterdam -- The Netherlands
Sylvain Viollon
2011-06-16 10:03:05 UTC
Permalink
On Tue, 14 Jun 2011 18:28:26 +0200
Post by Sylvain Viollon
On Tue, 14 Jun 2011 17:10:14 +0100
Hello,
Post by Sylvain Viollon
Yes, it is a bug I know and that people already reported to me.
I will have a look tomorrow.
Sorry for the delay.

This should be fixes on the buildout:

https://svn.infrae.com/buildout/silva/branch/Silva-2.3

I will have soon to release a 2.3.2. Please tell me if it works.

Regards,

Sylvain,
--
Sylvain Viollon -- Infrae
t +31 10 243 7051 -- http://infrae.com
Hoevestraat 10 3033GC Rotterdam -- The Netherlands
Jonathan Bowlas
2011-06-16 12:12:42 UTC
Permalink
Hi Sylvain,

Sorry but this doesn't appear to have made any difference.

I can delete the value in the TextLine field so that it is blank in
the edit view of my extension but the original value is still returned
when I render it from my Layout. i.e. the original value doesn't get
overidden with the new blank value.

J
Post by Sylvain Viollon
On Tue, 14 Jun 2011 18:28:26 +0200
Post by Sylvain Viollon
On Tue, 14 Jun 2011 17:10:14 +0100
?Hello,
Post by Sylvain Viollon
? Yes, it is a bug I know and that people already reported to me.
? I will have a look tomorrow.
?Sorry for the delay.
?https://svn.infrae.com/buildout/silva/branch/Silva-2.3
?I will have soon to release a 2.3.2. Please tell me if it works.
?Regards,
?Sylvain,
--
Sylvain Viollon -- Infrae
t +31 10 243 7051 -- http://infrae.com
Hoevestraat 10 3033GC Rotterdam -- The Netherlands
_______________________________________________
silva-dev mailing list
silva-dev at lists.infrae.com
https://lists.infrae.com/mailman/listinfo/silva-dev
Sylvain Viollon
2011-06-17 10:18:13 UTC
Permalink
On Thu, 16 Jun 2011 13:12:42 +0100
Post by Jonathan Bowlas
Hi Sylvain,
Hello,
Post by Jonathan Bowlas
Sorry but this doesn't appear to have made any difference.
I can delete the value in the TextLine field so that it is blank in
the edit view of my extension but the original value is still returned
when I render it from my Layout. i.e. the original value doesn't get
overidden with the new blank value.
With this new buildout ?

You should a checkout of zeam.form.ztk that fixes the bug. I tested
it with a Silva Link (url field if you switch the relative option) on
different instances.

Can you do the same test ?

(Maybe you have an another bug).

Regards,

Sylvain,
--
Sylvain Viollon -- Infrae
t +31 10 243 7051 -- http://infrae.com
Hoevestraat 10 3033GC Rotterdam -- The Netherlands
Jonathan Bowlas
2011-06-17 13:04:19 UTC
Permalink
Hi Sylvain,

I do appologise, it does work.

I was using the wrong buildout profile, simple-instance.cfg instead of
the silva-development.cfg.

Many thanks.

Jon
Post by Sylvain Viollon
On Thu, 16 Jun 2011 13:12:42 +0100
Post by Jonathan Bowlas
Hi Sylvain,
?Hello,
Post by Jonathan Bowlas
Sorry but this doesn't appear to have made any difference.
I can delete the value in the TextLine field so that it is blank in
the edit view of my extension but the original value is still returned
when I render it from my Layout. i.e. the original value doesn't get
overidden with the new blank value.
?With this new buildout ?
?You should a checkout of zeam.form.ztk that fixes the bug. I tested
?it with a Silva Link (url field if you switch the relative option) on
?different instances.
?Can you do the same test ?
?(Maybe you have an another bug).
?Regards,
?Sylvain,
--
Sylvain Viollon -- Infrae
t +31 10 243 7051 -- http://infrae.com
Hoevestraat 10 3033GC Rotterdam -- The Netherlands
Loading...