occasional AttributeError on image field

classic Classic list List threaded Threaded
5 messages Options
khink khink
Reply | Threaded
Open this post in threaded view
|

occasional AttributeError on image field

In our error logs, i see errors for URLs like
(...)article/@@edit/++widget++form.widgets.IImageAttachment.image/@@download/filename.jpg
which i cannot reproduce, not even in our live environment. Has anyone
seen similar errors?

I'm guessing it's something to with different zope servers: We don't tie
logged-in users to the instance they logged in on anymore. (We used to,
but we stopped doing it after hearing Christian Theune's talk on
PloneConf, where he said that it's not necessary anymore.)

This is the whole traceback:
Traceback (innermost last):
  Module ZPublisher.Publish, line 126, in publish
  Module ZPublisher.mapply, line 77, in mapply
  Module ZPublisher.Publish, line 46, in call_object
  Module plone.formwidget.namedfile.widget, line 183, in __call__
  Module z3c.form.datamanager, line 56, in get
AttributeError: image

And i don't know if it matters, but the image field comes from a
behavior "IImageAttachment":

...
from plone.directives import form, dexterity
from plone.namedfile.field import NamedBlobImage
...

class IImageAttachment(form.Schema):
     """Add images to content
     """

     form.fieldset(
             'images',
             label=_(u'image_form_title', default='Images'),
             fields=('image', 'image_caption', 'image_credit',
'image_expires'),
         )

dexterity.write_permission(image='freitag.behavior.imageattachment.addimages.write')
     image = NamedBlobImage(
         title=_(u'image_form_label', default=u"Image"),
         description=_(u'image_form_help',
                       default=u"Please upload an image. <br/><b>Image
size is 630x400</b>"),
         required=False,
     )

...


------------------------------------------------------------------------------
LogMeIn Central: Instant, anywhere, Remote PC access and management.
Stay in control, update software, and manage PCs from one command center
Diagnose problems and improve visibility into emerging IT issues
Automate, monitor and manage. Do more in less time with Central
http://p.sf.net/sfu/logmein12331_d2d
_______________________________________________
Plone-Users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-users
Nathan Van Gheem Nathan Van Gheem
Reply | Threaded
Open this post in threaded view
|

Re: occasional AttributeError on image field

I've seen this with HEAD requests for those type of urls.


On Mon, Nov 5, 2012 at 4:43 AM, Kees Hink <[hidden email]> wrote:
In our error logs, i see errors for URLs like
(...)article/@@edit/++widget++form.widgets.IImageAttachment.image/@@download/filename.jpg
which i cannot reproduce, not even in our live environment. Has anyone
seen similar errors?

I'm guessing it's something to with different zope servers: We don't tie
logged-in users to the instance they logged in on anymore. (We used to,
but we stopped doing it after hearing Christian Theune's talk on
PloneConf, where he said that it's not necessary anymore.)

This is the whole traceback:
Traceback (innermost last):
  Module ZPublisher.Publish, line 126, in publish
  Module ZPublisher.mapply, line 77, in mapply
  Module ZPublisher.Publish, line 46, in call_object
  Module plone.formwidget.namedfile.widget, line 183, in __call__
  Module z3c.form.datamanager, line 56, in get
AttributeError: image

And i don't know if it matters, but the image field comes from a
behavior "IImageAttachment":

...
from plone.directives import form, dexterity
from plone.namedfile.field import NamedBlobImage
...

class IImageAttachment(form.Schema):
     """Add images to content
     """

     form.fieldset(
             'images',
             label=_(u'image_form_title', default='Images'),
             fields=('image', 'image_caption', 'image_credit',
'image_expires'),
         )

dexterity.write_permission(image='freitag.behavior.imageattachment.addimages.write')
     image = NamedBlobImage(
         title=_(u'image_form_label', default=u"Image"),
         description=_(u'image_form_help',
                       default=u"Please upload an image. <br/><b>Image
size is 630x400</b>"),
         required=False,
     )

...


------------------------------------------------------------------------------
LogMeIn Central: Instant, anywhere, Remote PC access and management.
Stay in control, update software, and manage PCs from one command center
Diagnose problems and improve visibility into emerging IT issues
Automate, monitor and manage. Do more in less time with Central
http://p.sf.net/sfu/logmein12331_d2d
_______________________________________________
Plone-Users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-users


------------------------------------------------------------------------------
LogMeIn Central: Instant, anywhere, Remote PC access and management.
Stay in control, update software, and manage PCs from one command center
Diagnose problems and improve visibility into emerging IT issues
Automate, monitor and manage. Do more in less time with Central
http://p.sf.net/sfu/logmein12331_d2d
_______________________________________________
Plone-Users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-users
khink khink
Reply | Threaded
Open this post in threaded view
|

Re: occasional AttributeError on image field

Thanks! In our case, it's all GETs though. (We already filter the HEAD
requests in nginx.)

We've re-enabled sticky sessions, so let's see if it surfaces again.

On 11/05/2012 02:56 PM, Nathan Van Gheem wrote:

> I've seen this with HEAD requests for those type of urls.
>
>
> On Mon, Nov 5, 2012 at 4:43 AM, Kees Hink
> <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     In our error logs, i see errors for URLs like
>     (...)article/@@edit/++widget++form.widgets.IImageAttachment.image/@@download/filename.jpg
>     which i cannot reproduce, not even in our live environment. Has anyone
>     seen similar errors?
>
>     I'm guessing it's something to with different zope servers: We don't tie
>     logged-in users to the instance they logged in on anymore. (We used to,
>     but we stopped doing it after hearing Christian Theune's talk on
>     PloneConf, where he said that it's not necessary anymore.)
>
>     This is the whole traceback:
>     Traceback (innermost last):
>        Module ZPublisher.Publish, line 126, in publish
>        Module ZPublisher.mapply, line 77, in mapply
>        Module ZPublisher.Publish, line 46, in call_object
>        Module plone.formwidget.namedfile.widget, line 183, in __call__
>        Module z3c.form.datamanager, line 56, in get
>     AttributeError: image
>
>     And i don't know if it matters, but the image field comes from a
>     behavior "IImageAttachment":
>
>     ....
>     from plone.directives import form, dexterity
>     from plone.namedfile.field import NamedBlobImage
>     ....
>
>     class IImageAttachment(form.Schema):
>           """Add images to content
>           """
>
>           form.fieldset(
>                   'images',
>                   label=_(u'image_form_title', default='Images'),
>                   fields=('image', 'image_caption', 'image_credit',
>     'image_expires'),
>               )
>
>     dexterity.write_permission(image='freitag.behavior.imageattachment.addimages.write')
>           image = NamedBlobImage(
>               title=_(u'image_form_label', default=u"Image"),
>               description=_(u'image_form_help',
>                             default=u"Please upload an image. <br/><b>Image
>     size is 630x400</b>"),
>               required=False,
>           )
>
>     ....
>
>
>     ------------------------------------------------------------------------------
>     LogMeIn Central: Instant, anywhere, Remote PC access and management.
>     Stay in control, update software, and manage PCs from one command center
>     Diagnose problems and improve visibility into emerging IT issues
>     Automate, monitor and manage. Do more in less time with Central
>     http://p..sf.net/sfu/logmein12331_d2d
>     <http://p.sf.net/sfu/logmein12331_d2d>
>     _______________________________________________
>     Plone-Users mailing list
>     [hidden email]
>     <mailto:[hidden email]>
>     https://lists.sourceforge.net/lists/listinfo/plone-users
>
>
>
>
> ------------------------------------------------------------------------------
> LogMeIn Central: Instant, anywhere, Remote PC access and management.
> Stay in control, update software, and manage PCs from one command center
> Diagnose problems and improve visibility into emerging IT issues
> Automate, monitor and manage. Do more in less time with Central
> http://p.sf.net/sfu/logmein12331_d2d
>
>
>
> _______________________________________________
> Plone-Users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/plone-users
>


------------------------------------------------------------------------------
LogMeIn Central: Instant, anywhere, Remote PC access and management.
Stay in control, update software, and manage PCs from one command center
Diagnose problems and improve visibility into emerging IT issues
Automate, monitor and manage. Do more in less time with Central
http://p.sf.net/sfu/logmein12331_d2d
_______________________________________________
Plone-Users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-users
khink khink
Reply | Threaded
Open this post in threaded view
|

Re: occasional AttributeError on image field

In reply to this post by khink
Follow-up: We made sessions sticky again on monday (2 days ago), and the
error occurred again today. So that definitely wasn't it.

On 11/05/2012 11:43 AM, Kees Hink wrote:

> In our error logs, i see errors for URLs like
> (...)article/@@edit/++widget++form.widgets.IImageAttachment.image/@@download/filename.jpg
> which i cannot reproduce, not even in our live environment. Has anyone
> seen similar errors?
>
> I'm guessing it's something to with different zope servers: We don't tie
> logged-in users to the instance they logged in on anymore. (We used to,
> but we stopped doing it after hearing Christian Theune's talk on
> PloneConf, where he said that it's not necessary anymore.)
>
> This is the whole traceback:
> Traceback (innermost last):
>    Module ZPublisher.Publish, line 126, in publish
>    Module ZPublisher.mapply, line 77, in mapply
>    Module ZPublisher.Publish, line 46, in call_object
>    Module plone.formwidget.namedfile.widget, line 183, in __call__
>    Module z3c.form.datamanager, line 56, in get
> AttributeError: image
>
> And i don't know if it matters, but the image field comes from a
> behavior "IImageAttachment":
>
> ....
> from plone.directives import form, dexterity
> from plone.namedfile.field import NamedBlobImage
> ....
>
> class IImageAttachment(form.Schema):
>       """Add images to content
>       """
>
>       form.fieldset(
>               'images',
>               label=_(u'image_form_title', default='Images'),
>               fields=('image', 'image_caption', 'image_credit',
> 'image_expires'),
>           )
>
> dexterity.write_permission(image='freitag.behavior.imageattachment.addimages.write')
>       image = NamedBlobImage(
>           title=_(u'image_form_label', default=u"Image"),
>           description=_(u'image_form_help',
>                         default=u"Please upload an image. <br/><b>Image
> size is 630x400</b>"),
>           required=False,
>       )
>
> ....
>
>
> ------------------------------------------------------------------------------
> LogMeIn Central: Instant, anywhere, Remote PC access and management.
> Stay in control, update software, and manage PCs from one command center
> Diagnose problems and improve visibility into emerging IT issues
> Automate, monitor and manage. Do more in less time with Central
> http://p.sf.net/sfu/logmein12331_d2d
>


------------------------------------------------------------------------------
LogMeIn Central: Instant, anywhere, Remote PC access and management.
Stay in control, update software, and manage PCs from one command center
Diagnose problems and improve visibility into emerging IT issues
Automate, monitor and manage. Do more in less time with Central
http://p.sf.net/sfu/logmein12331_d2d
_______________________________________________
Plone-Users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-users
Dieter Maurer Dieter Maurer
Reply | Threaded
Open this post in threaded view
|

Re: occasional AttributeError on image field

Kees Hink <[hidden email]> writes:

> Follow-up: We made sessions sticky again on monday (2 days ago), and the
> error occurred again today. So that definitely wasn't it.
>
> On 11/05/2012 11:43 AM, Kees Hink wrote:
>> In our error logs, i see errors for URLs like
>> (...)article/@@edit/++widget++form.widgets.IImageAttachment.image/@@download/filename.jpg
>> which i cannot reproduce, not even in our live environment. Has anyone
>> seen similar errors?
>>
>> I'm guessing it's something to with different zope servers: We don't tie
>> logged-in users to the instance they logged in on anymore. (We used to,
>> but we stopped doing it after hearing Christian Theune's talk on
>> PloneConf, where he said that it's not necessary anymore.)
>>
>> This is the whole traceback:
>> Traceback (innermost last):
>>    Module ZPublisher.Publish, line 126, in publish
>>    Module ZPublisher.mapply, line 77, in mapply
>>    Module ZPublisher.Publish, line 46, in call_object
>>    Module plone.formwidget.namedfile.widget, line 183, in __call__
>>    Module z3c.form.datamanager, line 56, in get
>> AttributeError: image

Not a solution but maybe an approach to find out the problem cause --
provided the problem shows itself also occasionally in a
developper instance:

You could install "Products.PDBDebugMode". If your instance
runs in debug mode, an exception (as the above) will enter the
Python debugger and you can analyse the state leading to the
problem in detail.


Alternatively, you could have a look at the code.

You could start with the last traceback line: for what object
"z3c.form.datamanager" is looking for an "image" attribute?
Should it have such an attribute? Did it get the wrong object?

If this does not reveal the problem cause, you could have
a look at the "widget" namespace implementation and especially
its member "form.widgets.IImageAttachment.image".
If the name has been chosen perfectly, then what it may do
it adapt the object to "IImageAttachment" and select "image".
Once you have verified the code that is is really what it should do,
you could check what an "IImageAttachment" adaptation yields
in your context and why it may not have an "image" attribute.


>> And i don't know if it matters, but the image field comes from a
>> behavior "IImageAttachment":
>>
>> ....
>> from plone.directives import form, dexterity
>> from plone.namedfile.field import NamedBlobImage
>> ....
>>
>> class IImageAttachment(form.Schema):
>>       """Add images to content
>>       """
>>
>>       form.fieldset(
>>               'images',
>>               label=_(u'image_form_title', default='Images'),
>>               fields=('image', 'image_caption', 'image_credit',
>> 'image_expires'),
>>           )

I read this that as:
An instance providing "IImageAttachment" should have a field
"image" (within a fieldset "images").

I do not know the dexterity details, e.g. whether fields are
directly available as attributes or instead as attributes of
an intermediate object. Maybe, the documentation can tell you.
Or a look at an appropriate object.


------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_nov
_______________________________________________
Plone-Users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-users