Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Erro ao remover ou despublicar uma Agenda associada à uma Title Agenda #56

Open
idgserpro opened this issue Mar 7, 2016 · 4 comments
Labels

Comments

@idgserpro
Copy link
Member

Quando removo ou despublico uma Agenda associada com uma Title Agenda, ocorre o erro:

2016-03-07 17:12:13 ERROR plone.subrequest Error handling subrequest to http://localhost:8080/Plone/teste/@@agenda/c24d15bd-fdf8-411c-bffc-67b36b68be16
Traceback (most recent call last):
  File "/home/user/cache-python/eggs/plone.subrequest-1.6.9-py2.7.egg/plone/subrequest/__init__.py", line 136, in subrequest
    bind=1)
  File "/home/user/cache-python/eggs/Zope2-2.13.23-py2.7.egg/ZPublisher/mapply.py", line 78, in mapply
    else: return object(*args)
  File "/home/user/cache-python/eggs/plone.tiles-1.5.1-py2.7.egg/plone/tiles/esi.py", line 59, in __call__
    return self.index(*args, **kwargs)
  File "/home/user/cache-python/eggs/Zope2-2.13.23-py2.7.egg/Products/Five/browser/pagetemplatefile.py", line 125, in __call__
    return self.im_func(im_self, *args, **kw)
  File "/home/user/cache-python/eggs/Zope2-2.13.23-py2.7.egg/Products/Five/browser/pagetemplatefile.py", line 59, in __call__
    sourceAnnotations=getattr(debug_flags, 'sourceAnnotations', 0),
  File "/home/user/cache-python/eggs/zope.pagetemplate-3.6.3-py2.7.egg/zope/pagetemplate/pagetemplate.py", line 132, in pt_render
    strictinsert=0, sourceAnnotations=sourceAnnotations
  File "/home/user/cache-python/eggs/zope.pagetemplate-3.6.3-py2.7.egg/zope/pagetemplate/pagetemplate.py", line 240, in __call__
    interpreter()
  File "/home/user/cache-python/eggs/zope.tal-3.5.2-py2.7.egg/zope/tal/talinterpreter.py", line 271, in __call__
    self.interpret(self.program)
  File "/home/user/cache-python/eggs/zope.tal-3.5.2-py2.7.egg/zope/tal/talinterpreter.py", line 343, in interpret
    handlers[opcode](self, args)
  File "/home/user/cache-python/eggs/zope.tal-3.5.2-py2.7.egg/zope/tal/talinterpreter.py", line 821, in do_loop_tal
    self.interpret(block)
  File "/home/user/cache-python/eggs/zope.tal-3.5.2-py2.7.egg/zope/tal/talinterpreter.py", line 343, in interpret
    handlers[opcode](self, args)
  File "/home/user/cache-python/eggs/zope.tal-3.5.2-py2.7.egg/zope/tal/talinterpreter.py", line 533, in do_optTag_tal
    self.do_optTag(stuff)
  File "/home/user/cache-python/eggs/zope.tal-3.5.2-py2.7.egg/zope/tal/talinterpreter.py", line 518, in do_optTag
    return self.no_tag(start, program)
  File "/home/user/cache-python/eggs/zope.tal-3.5.2-py2.7.egg/zope/tal/talinterpreter.py", line 513, in no_tag
    self.interpret(program)
  File "/home/user/cache-python/eggs/zope.tal-3.5.2-py2.7.egg/zope/tal/talinterpreter.py", line 343, in interpret
    handlers[opcode](self, args)
  File "/home/user/cache-python/eggs/zope.tal-3.5.2-py2.7.egg/zope/tal/talinterpreter.py", line 852, in do_condition
    self.interpret(block)
  File "/home/user/cache-python/eggs/zope.tal-3.5.2-py2.7.egg/zope/tal/talinterpreter.py", line 343, in interpret
    handlers[opcode](self, args)
  File "/home/user/cache-python/eggs/zope.tal-3.5.2-py2.7.egg/zope/tal/talinterpreter.py", line 533, in do_optTag_tal
    self.do_optTag(stuff)
  File "/home/user/cache-python/eggs/zope.tal-3.5.2-py2.7.egg/zope/tal/talinterpreter.py", line 518, in do_optTag
    return self.no_tag(start, program)
  File "/home/user/cache-python/eggs/zope.tal-3.5.2-py2.7.egg/zope/tal/talinterpreter.py", line 513, in no_tag
    self.interpret(program)
  File "/home/user/cache-python/eggs/zope.tal-3.5.2-py2.7.egg/zope/tal/talinterpreter.py", line 343, in interpret
    handlers[opcode](self, args)
  File "/home/user/cache-python/eggs/zope.tal-3.5.2-py2.7.egg/zope/tal/talinterpreter.py", line 620, in do_insertText_tal
    text = self.engine.evaluateText(stuff[0])
  File "/home/user/cache-python/eggs/Zope2-2.13.23-py2.7.egg/Products/PageTemplates/Expressions.py", line 225, in evaluateText
    text = self.evaluate(expr)
  File "/home/user/cache-python/eggs/zope.tales-3.5.3-py2.7.egg/zope/tales/tales.py", line 696, in evaluate
    return expression(self)
  File "/home/user/cache-python/eggs/zope.tales-3.5.3-py2.7.egg/zope/tales/expressions.py", line 217, in __call__
    return self._eval(econtext)
  File "/home/user/cache-python/eggs/Zope2-2.13.23-py2.7.egg/Products/PageTemplates/Expressions.py", line 155, in _eval
    return render(ob, econtext.vars)
  File "/home/user/cache-python/eggs/Zope2-2.13.23-py2.7.egg/Products/PageTemplates/Expressions.py", line 117, in render
    ob = ob()
  File "/home/user/sites/portal.buildout/src/brasil.gov.agenda/src/brasil/gov/agenda/tiles/agenda.py", line 135, in period
    return self._period(self._last_modified())
  File "/home/user/sites/portal.buildout/src/brasil.gov.agenda/src/brasil/gov/agenda/tiles/agenda.py", line 94, in _last_modified
    last_modified = int(agenda.modified().strftime('%s'))
AttributeError: 'NoneType' object has no attribute 'modified'
2016-03-07 17:12:13 ERROR plone.transformchain Unexpected error whilst trying to apply transform chain
Traceback (most recent call last):
  File "/home/user/cache-python/eggs/plone.transformchain-1.0.4-py2.7.egg/plone/transformchain/transformer.py", line 48, in __call__
    newResult = handler.transformIterable(result, encoding)
  File "/home/user/cache-python/eggs/plone.app.blocks-3.0.1-py2.7.egg/plone/app/blocks/transform.py", line 166, in transformIterable
    result.tree = tiles.renderTiles(self.request, result.tree)
  File "/home/user/cache-python/eggs/plone.app.blocks-3.0.1-py2.7.egg/plone/app/blocks/tiles.py", line 52, in renderTiles
    tileTree = utils.resolve(tileHref)
  File "/home/user/cache-python/eggs/plone.app.blocks-3.0.1-py2.7.egg/plone/app/blocks/utils.py", line 64, in resolve
    resolved = resolveResource(url)
  File "/home/user/cache-python/eggs/plone.app.blocks-3.0.1-py2.7.egg/plone/app/blocks/utils.py", line 104, in resolveResource
    raise RuntimeError(resolved)
RuntimeError:   <h2>Site Error</h2>
  <p>An error was encountered while publishing this resource.
  </p>
  <p><strong><type 'exceptions.AttributeError'></strong></p>

  Sorry, a site error occurred.<p><p>Traceback (innermost last):</p>
<ul>

<li>  Module plone.subrequest, line 136, in subrequest</li>

<li>  Module ZPublisher.mapply, line 78, in mapply</li>

<li>  Module plone.tiles.esi, line 59, in __call__</li>

<li>  Module Products.Five.browser.pagetemplatefile, line 125, in __call__</li>

<li>  Module Products.Five.browser.pagetemplatefile, line 59, in __call__</li>

<li>  Module zope.pagetemplate.pagetemplate, line 132, in pt_render</li>

<li>  Module zope.pagetemplate.pagetemplate, line 240, in __call__</li>

<li>  Module zope.tal.talinterpreter, line 271, in __call__</li>

<li>  Module zope.tal.talinterpreter, line 343, in interpret</li>

<li>  Module zope.tal.talinterpreter, line 821, in do_loop_tal</li>

<li>  Module zope.tal.talinterpreter, line 343, in interpret</li>

<li>  Module zope.tal.talinterpreter, line 533, in do_optTag_tal</li>

<li>  Module zope.tal.talinterpreter, line 518, in do_optTag</li>

<li>  Module zope.tal.talinterpreter, line 513, in no_tag</li>

<li>  Module zope.tal.talinterpreter, line 343, in interpret</li>

<li>  Module zope.tal.talinterpreter, line 852, in do_condition</li>

<li>  Module zope.tal.talinterpreter, line 343, in interpret</li>

<li>  Module zope.tal.talinterpreter, line 533, in do_optTag_tal</li>

<li>  Module zope.tal.talinterpreter, line 518, in do_optTag</li>

<li>  Module zope.tal.talinterpreter, line 513, in no_tag</li>

<li>  Module zope.tal.talinterpreter, line 343, in interpret</li>

<li>  Module zope.tal.talinterpreter, line 620, in do_insertText_tal</li>

<li>  Module Products.PageTemplates.Expressions, line 225, in evaluateText</li>

<li>  Module zope.tales.tales, line 696, in evaluate<br />
<b>URL: /home/user/sites/portal.buildout/src/brasil.gov.agenda/src/brasil/gov/agenda/tiles/templates/agenda.pt</b><br />
<b>Line 40, Column 38</b><br />
<b>Expression: &lt;PathExpr standard:u'view/period'&gt;</b><br />
<b>Names:</b><pre>{'args': (),
 'container': &lt;Cover at /Plone/teste&gt;,
 'context': &lt;Cover at /Plone/teste&gt;,
 'default': &lt;object object at 0xb7593b58&gt;,
 'here': &lt;Cover at /Plone/teste&gt;,
 'loop': {},
 'nothing': None,
 'options': {},
 'repeat': &lt;Products.PageTemplates.Expressions.SafeMapping object at 0xb3ac5f54&gt;,
 'request': &lt;HTTPRequest, URL=http://localhost:8080/Plone/teste/@@agenda/c24d15bd-fdf8-411c-bffc-67b36b68be16&gt;,
 'root': &lt;Application at &gt;,
 'template': &lt;Products.Five.browser.pagetemplatefile.ViewPageTemplateFile object at 0xb3793b6c&gt;,
 'traverse_subpath': [],
 'user': &lt;SpecialUser 'Anonymous User'&gt;,
 'view': &lt;Products.Five.metaclass.AgendaTile object at 0xb1baa1ec&gt;,
 'views': &lt;Products.Five.browser.pagetemplatefile.ViewMapper object at 0xb1baa8cc&gt;}</pre></li>

<li>  Module zope.tales.expressions, line 217, in __call__</li>

<li>  Module Products.PageTemplates.Expressions, line 155, in _eval</li>

<li>  Module Products.PageTemplates.Expressions, line 117, in render</li>

<li>  Module brasil.gov.agenda.tiles.agenda, line 135, in period</li>

<li>  Module brasil.gov.agenda.tiles.agenda, line 94, in _last_modified</li>

</ul><p>AttributeError: 'NoneType' object has no attribute 'modified'
</p></p>
  <hr noshade="noshade"/>

  <p>Troubleshooting Suggestions</p>

  <ul>
  <li>The URL may be incorrect.</li>
  <li>The parameters passed to this resource may be incorrect.</li>
  <li>A resource that this resource relies on may be
      encountering an error.</li>
  </ul>

  <p>For more detailed information about the error, please
  refer to the error log.
  </p>

  <p>If the error persists please contact the site maintainer.
  Thank you for your patience.
  </p>

Minha pergunta é: Qual deve ser o comportamente quando removo uma Agenda associdada à uma Title Agenda? Deveria ser removido o link, como é feito pela tile de notícias?

@idgserpro idgserpro changed the title Erro ao remover os despublicar uma Agenda associada à uma Title Agenda Erro ao remover ou despublicar uma Agenda associada à uma Title Agenda Mar 7, 2016
@idgserpro idgserpro added the bug label Mar 7, 2016
@hvelarde
Copy link
Member

hvelarde commented Mar 7, 2016

o problema está nesta linha: https://github.com/plonegovbr/brasil.gov.agenda/blob/master/src/brasil/gov/agenda/tiles/agenda.py#L93

como o objeto foi apagado uuidToObject retorna None; o certo seria depender o menos possível do objeto original na hora do render; o tile deve continuar mostrando a informação do objeto, mesmo sem ele existir.

@idgserpro
Copy link
Member Author

@hvelarde o problema é que essa informação é a data da modificação. Ou seja ela é dinâmica.

@hvelarde
Copy link
Member

hvelarde commented Mar 8, 2016

@idgserpro pode retornar um string vazio nesse caso.

@idgserpro
Copy link
Member Author

o tile deve continuar mostrando a informação do objeto, mesmo sem ele existir.

Relacionado: collective/collective.cover#589 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants