Re: [zope-pt] Página de apresentação (data de pub licação)

2009-01-29 Por tôpico Lucas Aquino
Carmelita,

Esse erro ocorre quando vc não tem noticias publicadas, ou foi publicado
antes do ano 1900.
O effective não é um index obrigatório. Geralmente utiliza-se a data de
modificação do conteúdo, *modified*.
Mas tenta publicar as notícias, ou troca no template, o effective pelo
modified. Que funciona :)

Att,



2009/1/29 Carmelita Cristina Tolentino crist...@arquivar.com.br

Oi Lucas



 Está dando um erro, já tentei colocar esse código de várias formas, mas não
 funciona.

 O erro é o seguinte:





 Traceback (innermost last):

   Module ZPublisher.Publish, line 119, in publish

   Module ZPublisher.mapply, line 88, in mapply

   Module ZPublisher.Publish, line 42, in call_object

   Module Shared.DC.Scripts.Bindings, line 313, in __call__

   Module Shared.DC.Scripts.Bindings, line 350, in _bindAndExec

   Module Products.PageTemplates.ZopePageTemplate, line 330, in _exec

   Module Products.PageTemplates.ZopePageTemplate, line 427, in pt_render

   Module Products.PageTemplates.PageTemplate, line 89, in pt_render

   Module zope.pagetemplate.pagetemplate, line 117, in pt_render

   Module zope.tal.talinterpreter, line 271, in __call__

   Module zope.tal.talinterpreter, line 346, in interpret

   Module zope.tal.talinterpreter, line 891, in do_useMacro

   Module zope.tal.talinterpreter, line 346, in interpret

   Module zope.tal.talinterpreter, line 536, in do_optTag_tal

   Module zope.tal.talinterpreter, line 521, in do_optTag

   Module zope.tal.talinterpreter, line 516, in no_tag

   Module zope.tal.talinterpreter, line 346, in interpret

   Module zope.tal.talinterpreter, line 949, in do_defineSlot

   Module zope.tal.talinterpreter, line 346, in interpret

   Module zope.tal.talinterpreter, line 891, in do_useMacro

   Module zope.tal.talinterpreter, line 346, in interpret

   Module zope.tal.talinterpreter, line 824, in do_loop_tal

   Module zope.tal.talinterpreter, line 346, in interpret

   Module zope.tal.talinterpreter, line 536, in do_optTag_tal

   Module zope.tal.talinterpreter, line 521, in do_optTag

   Module zope.tal.talinterpreter, line 516, in no_tag

   Module zope.tal.talinterpreter, line 346, in interpret

   Module zope.tal.talinterpreter, line 623, in do_insertText_tal

   Module Products.PageTemplates.Expressions, line 228, in evaluateText

   Module zope.tales.tales, line 696, in evaluate

- URL: portlet_destaques

- Line 39, Column 13

- Expression: PythonExpr obj.effective.strftime('%d-%m-%Y')

- Names:

   {'container': PloneSite at / Plone ,

'context': PloneSite at / Plone ,

'default': object object at 0x0072A528,

'here': PloneSite at /Plone,

'loop': {u'obj': Products.PageTemplates.Expressions.PathIterator 
 object at 0x1232B3D0},

'nothing': None,

'options': {'args': ()},

'repeat': Products.PageTemplates.Expressions.SafeMapping object at 
 0x121A39B8,

'request': HTTPRequest, URL=http://localhost:8080/index_html,

'root': Application at ,

'template': ZopePageTemplate at /index_html,

'traverse_subpath': [],

'user': PropertiedUser 'admin'}

   Module Products.PageTemplates.ZRPythonExpr, line 49, in __call__

- __traceback_info__: obj.effective.strftime('%d-%m-%Y')

   Module PythonExpr, line 1, in expression

   Module DateTime.DateTime, line 1494, in strftime

 ValueError: year=1000 is before 1900; the datetime strftime() methods require 
 year = 1900




  




-- 
Lucas Aquino
Liberiun
lucasaqu...@liberiun.com
http://www.liberiun.com
+55 61 3468-2662


Re: [zope-pt] Página de apresentação (data de pub licação)

2009-01-28 Por tôpico Lucas Aquino
Posso sim...

Como esta o seu codigo... manda aí...

att

2009/1/28 Carmelita Cristina Tolentino crist...@arquivar.com.br

Oi Lucas, também tentei fazer dessa forma, mas não deu certo. Pode me
 ajudar?

 .


   




-- 
Lucas Aquino
Liberiun
lucasaqu...@liberiun.com
http://www.liberiun.com
+55 61 3468-2662


Re: [zope-pt] Página de apresentação (data de pub licação)

2009-01-28 Por tôpico Lucas Aquino
Opa,

Inserir a data de publicação, logo após o título, onde o index effective
será formatado pelo strftime():
 
a href= class=tile tal:attributes=href obj/getURL;
  title
obj/Description
span tal:replace=obj/pretty_title_or_id
   titulo_ou_id
/span
*!--  Data de Publicacao  --

span class=portletItemDetails
tal:content=python:obj.effective.strftime('%d -
%m - %Y') 06-06-2006/span

!--  /Data de Publicacao  --*
 /a
  
Deve resolver...
att,

2009/1/28 Carmelita Cristina Tolentino crist...@arquivar.com.br

Segue o código que usei:







 html xmlns:tal=http://xml.zope.org/namespaces/tal;

   xmlns:metal=http://xml.zope.org/namespaces/metal;

   i18n:domain=plone

 body

 div metal:define-macro=portlet

  tal:define=results

  python:here.portal_catalog.searchResults(portal_type='News Item',

  path=' /sala_imprensa/',

  sort_on ='Date',

  sort_order='reverse',

  review_state='published')[:4];



 dl id=portlet-salaimprensa

 dt class=portletHeader

 img src=imagens/circ_verde.gif/nbsp;Sala de Imprensa

 /dt



tal:links tal:repeat=obj results

dd tal:define=oddrow repeat/obj/odd

tal:attributes=class python:test('portletItem')



 a href=

class=tile

tal:attributes=href obj/getURL;

title obj/Description

 span tal:replace=obj/pretty_title_or_id

titulo_ou_id

 /span

 /a

 /dd



  /tal:links





 /dl

   p align=right

a href=/sala_imprensa/mais.../a

   /p



 /div

 /body

 /html




  




-- 
Lucas Aquino
Liberiun
lucasaqu...@liberiun.com
http://www.liberiun.com
+55 61 3468-2662


Re: [zope-pt] Página de apresentação (data de pub licação)

2009-01-27 Por tôpico Lucas Aquino
Opa,

A data de publicação é um index de catalog - *effective*, daí tu pode
formatar com o strftime().

Exemplo:

div tal:define=results python:context.portal_catalog(.)

tal:links tal:repeat=obj results

   h1 tal:content=*python:obj.effective.strftime('%d - %m - %Y')* 
06-06-2006 /h1

/tal:links

/div

[ ]'s




2009/1/27 crc.castro crc.cas...@yahoo.com.br

   Estou criando uma página de apresentação para o meu portal (Plone
 3.1.4)no meu portlet eu chamo o título da notícia de uma
 determidada pasta. Gostaria que junto com essa notícia, também
 aparecesse a data de publicação dela.
 Alguém sabe como me ajudar?

 Meu código:

 html xmlns:tal=http://xml.zope.org/namespaces/tal;
 xmlns:metal=http://xml.zope.org/namespaces/metal;
 i18n:domain=plone
 body
 div metal:define-macro=portlet
 tal:define=results
 python:here.portal_catalog.searchResults(portal_type='Document',

 path='Plone/destaques',

 sort_on ='Date',
 sort_order='reverse',
 review_state='published')[:3];

 dl id=portlet-destaques
 dt class=portletHeader
 DESTAQUES
 /dt

 tal:links tal:repeat=obj results
 dd tal:define=oddrow repeat/obj/odd
 tal:attributes=class python:test('portletItem')

 a href=
 class=tile
 tal:attributes=href obj/getURL;
 title obj/Description

 tal:block replace=structure
 here/imagens/icon_destaques.gif/

 span tal:replace=obj/pretty_title_or_id
 titulo_ou_id
 /span
 /a
 /dd
 /tal:links
 /dl
 p align=right
 a href=Plone/destaquesmais.../a
 /p
 /div
 /body
 /html

  




-- 
Lucas Aquino
Liberiun
lucasaqu...@liberiun.com
http://www.liberiun.com
+55 61 3468-2662