SHARE
TWEET

Untitled

a guest Jan 23rd, 2012 23 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. replaceafill@system76:~/sandboxes/flourish$ bzr diff
  2. === modified file 'src/schooltool/schoolyear/browser/schoolyear.py'
  3. --- src/schooltool/schoolyear/browser/schoolyear.py     2011-11-21 19:30:28 +0000
  4. +++ src/schooltool/schoolyear/browser/schoolyear.py     2012-01-10 20:49:53 +0000
  5. @@ -44,6 +44,7 @@
  6.  from zope.security.checker import canAccess
  7.  
  8.  from z3c.form import form, field, button
  9. +from z3c.form.interfaces import IDataConverter
  10.  from z3c.form.util import getSpecification
  11.  from z3c.form.validator import NoInputData
  12.  from z3c.form.validator import WidgetsValidatorDiscriminators
  13. @@ -627,9 +628,11 @@
  14.          # XXX: hack to display the overlap error next to the widget!
  15.          rv = super(FlourishOverlapValidator, self).validate(value)
  16.          last_widget = self.view.widgets['last']
  17. +        last_field = last_widget.field
  18.          last_value = self.request.get(last_widget.name)
  19. +        converter = getMultiAdapter((last_field, last_widget), IDataConverter)
  20.          try:
  21. -            last_value = last_widget._toFieldValue(last_value)
  22. +            last_value = converter.toFieldValue(last_value)
  23.          except:
  24.              return
  25.          try:
  26.  
  27. === modified file 'src/schooltool/term/browser/term.py'
  28. --- src/schooltool/term/browser/term.py 2011-11-21 10:32:13 +0000
  29. +++ src/schooltool/term/browser/term.py 2012-01-10 20:53:48 +0000
  30. @@ -22,7 +22,7 @@
  31.  import datetime
  32.  import itertools
  33.  
  34. -from zope.component import adapts
  35. +from zope.component import adapts, getMultiAdapter
  36.  from zope.interface.exceptions import Invalid
  37.  from zope.interface import implements
  38.  from zope.interface import Interface
  39. @@ -35,6 +35,7 @@
  40.  from zope.security.checker import canAccess
  41.  from zope.traversing.browser.absoluteurl import absoluteURL
  42.  
  43. +from z3c.form.interfaces import IDataConverter
  44.  from z3c.form.util import getSpecification
  45.  from z3c.form.validator import NoInputData
  46.  from z3c.form.validator import WidgetsValidatorDiscriminators
  47. @@ -511,9 +512,11 @@
  48.          # XXX: hack to display the overlap error next to the widget!
  49.          super(FlourishOverlapValidator, self).validate(value)
  50.          last_widget = self.view.widgets['last']
  51. +        last_field = last_widget.field
  52.          last_value = self.request.get(last_widget.name)
  53. +        converter = getMultiAdapter((last_field, last_widget), IDataConverter)
  54.          try:
  55. -            last_value = last_widget._toFieldValue(last_value)
  56. +            last_value = converter.toFieldValue(last_value)
  57.          except:
  58.              return
  59.          try:
  60.  
  61. replaceafill@system76:~/sandboxes/flourish$
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top