WebCal in trunk

View: New views
8 Messages — Rating Filter:   Alert me  

WebCal in trunk

by Rob Healey-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Greetings:

I ran WebCal report in trunk, and I got a crash.  Here is what I got.....

229461: ERROR: _ReportDialog.py: line 640: Failed to run report.
Traceback (most recent call last):
  File "/home/Frog/gramps32/src/ReportBase/_ReportDialog.py", line 615, in report
    MyReport.write_report()
  File "/home/Frog/gramps32/src/plugins/webreport/WebCal.py", line 1344, in write_report
    self.webcalendar(cal_year)
  File "/home/Frog/gramps32/src/plugins/webreport/WebCal.py", line 898, in webcalendar
    monthly_calendar = self.calendar_build("wc", year, month)
  File "/home/Frog/gramps32/src/plugins/webreport/WebCal.py", line 764, in calendar_build
    day_list = get_day_list(event_date, holiday_list, bday_anniv_list)
  File "/home/Frog/gramps32/src/plugins/webreport/WebCal.py", line 1817, in get_day_list
    + '</em>')
  File "/home/Frog/gramps32/src/TransUtils.py", line 115, in sgettext
    sep_idx = msgid.rfind(sep)
AttributeError: 'Html' object has no attribute 'rfind'

Sincerely yours,
Rob G. Healey


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Gramps-devel mailing list
Gramps-devel@...
https://lists.sourceforge.net/lists/listinfo/gramps-devel

Re : WebCal in trunk

by Jerome :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> "/home/Frog/gramps32/src/plugins/webreport/WebCal.py",
> line 1817, in get_day_list
>     + '</em>')
>   File "/home/Frog/gramps32/src/TransUtils.py",
> line 115, in sgettext
>     sep_idx = msgid.rfind(sep)
>
> AttributeError: 'Html' object has no attribute
> 'rfind'

Greetings:

'Html' and sgettext entry (msgid & context) !
Looks like it was my modification ... (note, with lower case)

http://gramps.svn.sourceforge.net/viewvc/gramps/trunk/src/plugins/webreport/WebCal.py?r1=13349&r2=13352

but WebCal.py", line 1817 is something else !

 1815    txt_str = _(text + ', <em>'
 1816    + (_('%s old') % str(age_str) if nyears else _('birth'))
 1817    + '</em>')

I see few places using 'Html' string :

* plugins/lib/libhtml.py but not modules called or translation with context _('contex|string').

* plugins/docgen/HtmlDoc.py

* plugins/lib/libhtmlbackend.py

Possible conflit somewhere with the context value used on
http://gramps.svn.sourceforge.net/viewvc/gramps/trunk/src/plugins/webreport/WebCal.py?r1=13349&r2=13352 ? Strange it was working on NarrativeWeb, WebCal and was a cosmetic modification !

Does it crash on NarrativeWeb (libhtml) or "graphical" calendar ?
http://www.gramps-project.org/wiki/index.php?title=Gramps_3.1_Wiki_Manual_-_Reports_-_part_4#Calendar


Sincerely yours,
Jérôme R.

--- En date de : Jeu 29.10.09, Rob Healey <robhealey1@...> a écrit :

> De: Rob Healey <robhealey1@...>
> Objet: [Gramps-devel] WebCal in trunk
> À: "Gramps Development List" <gramps-devel@...>
> Date: Jeudi 29 Octobre 2009, 1h07
> Greetings:
>
> I ran WebCal report in trunk, and I got a crash.  Here is
> what I got.....
>
> 229461: ERROR: _ReportDialog.py: line 640: Failed to run
> report.
> Traceback (most recent call last):
>   File
> "/home/Frog/gramps32/src/ReportBase/_ReportDialog.py",
> line 615, in report
>
>     MyReport.write_report()
>   File
> "/home/Frog/gramps32/src/plugins/webreport/WebCal.py",
> line 1344, in write_report
>     self.webcalendar(cal_year)
>   File
> "/home/Frog/gramps32/src/plugins/webreport/WebCal.py",
> line 898, in webcalendar
>
>     monthly_calendar =
> self.calendar_build("wc", year, month)
>   File
> "/home/Frog/gramps32/src/plugins/webreport/WebCal.py",
> line 764, in calendar_build
>     day_list = get_day_list(event_date, holiday_list,
> bday_anniv_list)
>
>   File
> "/home/Frog/gramps32/src/plugins/webreport/WebCal.py",
> line 1817, in get_day_list
>     + '</em>')
>   File "/home/Frog/gramps32/src/TransUtils.py",
> line 115, in sgettext
>     sep_idx = msgid.rfind(sep)
>
> AttributeError: 'Html' object has no attribute
> 'rfind'
>
> Sincerely yours,
> Rob G. Healey
>
>
>
> -----La pièce jointe associée suit-----
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference
> in SF, CA
> is the only developer event you need to attend this year.
> Jumpstart your
> developing skills, take BlackBerry mobile applications to
> market and stay
> ahead of the curve. Join us from November 9 - 12, 2009.
> Register now!
> http://p.sf.net/sfu/devconference
> -----La pièce jointe associée suit-----
>
> _______________________________________________
> Gramps-devel mailing list
> Gramps-devel@...
> https://lists.sourceforge.net/lists/listinfo/gramps-devel
>

__________________________________________________
Do You Yahoo!?
En finir avec le spam? Yahoo! Mail vous offre la meilleure protection possible contre les messages non sollicités
http://mail.yahoo.fr Yahoo! Mail

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Gramps-devel mailing list
Gramps-devel@...
https://lists.sourceforge.net/lists/listinfo/gramps-devel

Re: Re : WebCal in trunk

by Benny Malengier :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

2009/10/29 jerome <romjerome@...>:

> http://gramps.svn.sourceforge.net/viewvc/gramps/trunk/src/plugins/webreport/WebCal.py?r1=13349&r2=13352

This change should be ok

> but WebCal.py", line 1817 is something else !
>
>  1815    txt_str = _(text + ', <em>'
>  1816    + (_('%s old') % str(age_str) if nyears else _('birth'))
>  1817    + '</em>')

This is not ok, the translator cannor translate variables! So this
should change to something like
txt_str = text +  ', <em>'  + (_('%s old') % str(age_str) if nyears
else _('birth')) + '</em>'

So text is probably a Html object, and _ does not work on that, nor should it.

Benny

> I see few places using 'Html' string :
>
> * plugins/lib/libhtml.py but not modules called or translation with context _('contex|string').
>
> * plugins/docgen/HtmlDoc.py
>
> * plugins/lib/libhtmlbackend.py
>
> Possible conflit somewhere with the context value used on
> http://gramps.svn.sourceforge.net/viewvc/gramps/trunk/src/plugins/webreport/WebCal.py?r1=13349&r2=13352 ? Strange it was working on NarrativeWeb, WebCal and was a cosmetic modification !
>
> Does it crash on NarrativeWeb (libhtml) or "graphical" calendar ?
> http://www.gramps-project.org/wiki/index.php?title=Gramps_3.1_Wiki_Manual_-_Reports_-_part_4#Calendar
>
>
> Sincerely yours,
> Jérôme R.
>
> --- En date de : Jeu 29.10.09, Rob Healey <robhealey1@...> a écrit :
>
>> De: Rob Healey <robhealey1@...>
>> Objet: [Gramps-devel] WebCal in trunk
>> À: "Gramps Development List" <gramps-devel@...>
>> Date: Jeudi 29 Octobre 2009, 1h07
>> Greetings:
>>
>> I ran WebCal report in trunk, and I got a crash.  Here is
>> what I got.....
>>
>> 229461: ERROR: _ReportDialog.py: line 640: Failed to run
>> report.
>> Traceback (most recent call last):
>>   File
>> "/home/Frog/gramps32/src/ReportBase/_ReportDialog.py",
>> line 615, in report
>>
>>     MyReport.write_report()
>>   File
>> "/home/Frog/gramps32/src/plugins/webreport/WebCal.py",
>> line 1344, in write_report
>>     self.webcalendar(cal_year)
>>   File
>> "/home/Frog/gramps32/src/plugins/webreport/WebCal.py",
>> line 898, in webcalendar
>>
>>     monthly_calendar =
>> self.calendar_build("wc", year, month)
>>   File
>> "/home/Frog/gramps32/src/plugins/webreport/WebCal.py",
>> line 764, in calendar_build
>>     day_list = get_day_list(event_date, holiday_list,
>> bday_anniv_list)
>>
>>   File
>> "/home/Frog/gramps32/src/plugins/webreport/WebCal.py",
>> line 1817, in get_day_list
>>     + '</em>')
>>   File "/home/Frog/gramps32/src/TransUtils.py",
>> line 115, in sgettext
>>     sep_idx = msgid.rfind(sep)
>>
>> AttributeError: 'Html' object has no attribute
>> 'rfind'
>>
>> Sincerely yours,
>> Rob G. Healey
>>
>>
>>
>> -----La pièce jointe associée suit-----
>>
>> ------------------------------------------------------------------------------
>> Come build with us! The BlackBerry(R) Developer Conference
>> in SF, CA
>> is the only developer event you need to attend this year.
>> Jumpstart your
>> developing skills, take BlackBerry mobile applications to
>> market and stay
>> ahead of the curve. Join us from November 9 - 12, 2009.
>> Register now!
>> http://p.sf.net/sfu/devconference
>> -----La pièce jointe associée suit-----
>>
>> _______________________________________________
>> Gramps-devel mailing list
>> Gramps-devel@...
>> https://lists.sourceforge.net/lists/listinfo/gramps-devel
>>
>
> __________________________________________________
> Do You Yahoo!?
> En finir avec le spam? Yahoo! Mail vous offre la meilleure protection possible contre les messages non sollicités
> http://mail.yahoo.fr Yahoo! Mail
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> Gramps-devel mailing list
> Gramps-devel@...
> https://lists.sourceforge.net/lists/listinfo/gramps-devel
>

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Gramps-devel mailing list
Gramps-devel@...
https://lists.sourceforge.net/lists/listinfo/gramps-devel

Re: Re : WebCal in trunk

by Jerome :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> This is not ok, the translator cannor translate variables! So this
> should change to something like
> txt_str = text +  ', <em>'  + (_('%s old') % str(age_str) if nyears
> else _('birth')) + '</em>'

I was also in the loop/operation ... (only a part !)
http://gramps.svn.sourceforge.net/viewvc/gramps?view=rev&revision=13314

I get the translation and no crash by using WebCal on trunk !
+ on branch (3.1)
http://gramps.svn.sourceforge.net/viewvc/gramps?view=rev&revision=13313

But I had not seen _(text  ... :-[
I will do the change. Thank you !

Benny Malengier a écrit :

> 2009/10/29 jerome <romjerome@...>:
>
>> http://gramps.svn.sourceforge.net/viewvc/gramps/trunk/src/plugins/webreport/WebCal.py?r1=13349&r2=13352
>
> This change should be ok
>
>> but WebCal.py", line 1817 is something else !
>>
>>  1815    txt_str = _(text + ', <em>'
>>  1816    + (_('%s old') % str(age_str) if nyears else _('birth'))
>>  1817    + '</em>')
>
> This is not ok, the translator cannor translate variables! So this
> should change to something like
> txt_str = text +  ', <em>'  + (_('%s old') % str(age_str) if nyears
> else _('birth')) + '</em>'
>
> So text is probably a Html object, and _ does not work on that, nor should it.
>
> Benny
>
>> I see few places using 'Html' string :
>>
>> * plugins/lib/libhtml.py but not modules called or translation with context _('contex|string').
>>
>> * plugins/docgen/HtmlDoc.py
>>
>> * plugins/lib/libhtmlbackend.py
>>
>> Possible conflit somewhere with the context value used on
>> http://gramps.svn.sourceforge.net/viewvc/gramps/trunk/src/plugins/webreport/WebCal.py?r1=13349&r2=13352 ? Strange it was working on NarrativeWeb, WebCal and was a cosmetic modification !
>>
>> Does it crash on NarrativeWeb (libhtml) or "graphical" calendar ?
>> http://www.gramps-project.org/wiki/index.php?title=Gramps_3.1_Wiki_Manual_-_Reports_-_part_4#Calendar
>>
>>
>> Sincerely yours,
>> Jérôme R.
>>
>> --- En date de : Jeu 29.10.09, Rob Healey <robhealey1@...> a écrit :
>>
>>> De: Rob Healey <robhealey1@...>
>>> Objet: [Gramps-devel] WebCal in trunk
>>> À: "Gramps Development List" <gramps-devel@...>
>>> Date: Jeudi 29 Octobre 2009, 1h07
>>> Greetings:
>>>
>>> I ran WebCal report in trunk, and I got a crash.  Here is
>>> what I got.....
>>>
>>> 229461: ERROR: _ReportDialog.py: line 640: Failed to run
>>> report.
>>> Traceback (most recent call last):
>>>   File
>>> "/home/Frog/gramps32/src/ReportBase/_ReportDialog.py",
>>> line 615, in report
>>>
>>>     MyReport.write_report()
>>>   File
>>> "/home/Frog/gramps32/src/plugins/webreport/WebCal.py",
>>> line 1344, in write_report
>>>     self.webcalendar(cal_year)
>>>   File
>>> "/home/Frog/gramps32/src/plugins/webreport/WebCal.py",
>>> line 898, in webcalendar
>>>
>>>     monthly_calendar =
>>> self.calendar_build("wc", year, month)
>>>   File
>>> "/home/Frog/gramps32/src/plugins/webreport/WebCal.py",
>>> line 764, in calendar_build
>>>     day_list = get_day_list(event_date, holiday_list,
>>> bday_anniv_list)
>>>
>>>   File
>>> "/home/Frog/gramps32/src/plugins/webreport/WebCal.py",
>>> line 1817, in get_day_list
>>>     + '</em>')
>>>   File "/home/Frog/gramps32/src/TransUtils.py",
>>> line 115, in sgettext
>>>     sep_idx = msgid.rfind(sep)
>>>
>>> AttributeError: 'Html' object has no attribute
>>> 'rfind'
>>>
>>> Sincerely yours,
>>> Rob G. Healey
>>>
>>>
>>>
>>> -----La pièce jointe associée suit-----
>>>
>>> ------------------------------------------------------------------------------
>>> Come build with us! The BlackBerry(R) Developer Conference
>>> in SF, CA
>>> is the only developer event you need to attend this year.
>>> Jumpstart your
>>> developing skills, take BlackBerry mobile applications to
>>> market and stay
>>> ahead of the curve. Join us from November 9 - 12, 2009.
>>> Register now!
>>> http://p.sf.net/sfu/devconference
>>> -----La pièce jointe associée suit-----
>>>
>>> _______________________________________________
>>> Gramps-devel mailing list
>>> Gramps-devel@...
>>> https://lists.sourceforge.net/lists/listinfo/gramps-devel
>>>
>> __________________________________________________
>> Do You Yahoo!?
>> En finir avec le spam? Yahoo! Mail vous offre la meilleure protection possible contre les messages non sollicités
>> http://mail.yahoo.fr Yahoo! Mail
>>
>> ------------------------------------------------------------------------------
>> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
>> is the only developer event you need to attend this year. Jumpstart your
>> developing skills, take BlackBerry mobile applications to market and stay
>> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
>> http://p.sf.net/sfu/devconference
>> _______________________________________________
>> Gramps-devel mailing list
>> Gramps-devel@...
>> https://lists.sourceforge.net/lists/listinfo/gramps-devel
>>
>


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Gramps-devel mailing list
Gramps-devel@...
https://lists.sourceforge.net/lists/listinfo/gramps-devel

Re: Re : WebCal in trunk

by Benny Malengier :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

2009/10/30 Jérôme <romjerome@...>:

>> This is not ok, the translator cannor translate variables! So this
>> should change to something like
>> txt_str = text +  ', <em>'  + (_('%s old') % str(age_str) if nyears
>> else _('birth')) + '</em>'
>
> I was also in the loop/operation ... (only a part !)
> http://gramps.svn.sourceforge.net/viewvc/gramps?view=rev&revision=13314
>
> I get the translation and no crash by using WebCal on trunk !
> + on branch (3.1)
> http://gramps.svn.sourceforge.net/viewvc/gramps?view=rev&revision=13313
>
> But I had not seen _(text  ... :-[
> I will do the change. Thank you !

Ok, remember, if it is in a loop, do the gettext lookup outside the loop, so

var1_str  = _('%(year)s old')
var2_str = _('birth')

and use those inside the loop.

Benny


>
> Benny Malengier a écrit :
>>
>> 2009/10/29 jerome <romjerome@...>:
>>
>>>
>>> http://gramps.svn.sourceforge.net/viewvc/gramps/trunk/src/plugins/webreport/WebCal.py?r1=13349&r2=13352
>>
>> This change should be ok
>>
>>> but WebCal.py", line 1817 is something else !
>>>
>>>  1815    txt_str = _(text + ', <em>'
>>>  1816    + (_('%s old') % str(age_str) if nyears else _('birth'))
>>>  1817    + '</em>')
>>
>> This is not ok, the translator cannor translate variables! So this
>> should change to something like
>> txt_str = text +  ', <em>'  + (_('%s old') % str(age_str) if nyears
>> else _('birth')) + '</em>'
>>
>> So text is probably a Html object, and _ does not work on that, nor should
>> it.
>>
>> Benny
>>
>>> I see few places using 'Html' string :
>>>
>>> * plugins/lib/libhtml.py but not modules called or translation with
>>> context _('contex|string').
>>>
>>> * plugins/docgen/HtmlDoc.py
>>>
>>> * plugins/lib/libhtmlbackend.py
>>>
>>> Possible conflit somewhere with the context value used on
>>>
>>> http://gramps.svn.sourceforge.net/viewvc/gramps/trunk/src/plugins/webreport/WebCal.py?r1=13349&r2=13352
>>> ? Strange it was working on NarrativeWeb, WebCal and was a cosmetic
>>> modification !
>>>
>>> Does it crash on NarrativeWeb (libhtml) or "graphical" calendar ?
>>>
>>> http://www.gramps-project.org/wiki/index.php?title=Gramps_3.1_Wiki_Manual_-_Reports_-_part_4#Calendar
>>>
>>>
>>> Sincerely yours,
>>> Jérôme R.
>>>
>>> --- En date de : Jeu 29.10.09, Rob Healey <robhealey1@...> a écrit
>>> :
>>>
>>>> De: Rob Healey <robhealey1@...>
>>>> Objet: [Gramps-devel] WebCal in trunk
>>>> À: "Gramps Development List" <gramps-devel@...>
>>>> Date: Jeudi 29 Octobre 2009, 1h07
>>>> Greetings:
>>>>
>>>> I ran WebCal report in trunk, and I got a crash.  Here is
>>>> what I got.....
>>>>
>>>> 229461: ERROR: _ReportDialog.py: line 640: Failed to run
>>>> report.
>>>> Traceback (most recent call last):
>>>>  File
>>>> "/home/Frog/gramps32/src/ReportBase/_ReportDialog.py",
>>>> line 615, in report
>>>>
>>>>    MyReport.write_report()
>>>>  File
>>>> "/home/Frog/gramps32/src/plugins/webreport/WebCal.py",
>>>> line 1344, in write_report
>>>>    self.webcalendar(cal_year)
>>>>  File
>>>> "/home/Frog/gramps32/src/plugins/webreport/WebCal.py",
>>>> line 898, in webcalendar
>>>>
>>>>    monthly_calendar =
>>>> self.calendar_build("wc", year, month)
>>>>  File
>>>> "/home/Frog/gramps32/src/plugins/webreport/WebCal.py",
>>>> line 764, in calendar_build
>>>>    day_list = get_day_list(event_date, holiday_list,
>>>> bday_anniv_list)
>>>>
>>>>  File
>>>> "/home/Frog/gramps32/src/plugins/webreport/WebCal.py",
>>>> line 1817, in get_day_list
>>>>    + '</em>')
>>>>  File "/home/Frog/gramps32/src/TransUtils.py",
>>>> line 115, in sgettext
>>>>    sep_idx = msgid.rfind(sep)
>>>>
>>>> AttributeError: 'Html' object has no attribute
>>>> 'rfind'
>>>>
>>>> Sincerely yours,
>>>> Rob G. Healey
>>>>
>>>>
>>>>
>>>> -----La pièce jointe associée suit-----
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Come build with us! The BlackBerry(R) Developer Conference
>>>> in SF, CA
>>>> is the only developer event you need to attend this year.
>>>> Jumpstart your
>>>> developing skills, take BlackBerry mobile applications to
>>>> market and stay
>>>> ahead of the curve. Join us from November 9 - 12, 2009.
>>>> Register now!
>>>> http://p.sf.net/sfu/devconference
>>>> -----La pièce jointe associée suit-----
>>>>
>>>> _______________________________________________
>>>> Gramps-devel mailing list
>>>> Gramps-devel@...
>>>> https://lists.sourceforge.net/lists/listinfo/gramps-devel
>>>>
>>> __________________________________________________
>>> Do You Yahoo!?
>>> En finir avec le spam? Yahoo! Mail vous offre la meilleure protection
>>> possible contre les messages non sollicités
>>> http://mail.yahoo.fr Yahoo! Mail
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
>>> is the only developer event you need to attend this year. Jumpstart your
>>> developing skills, take BlackBerry mobile applications to market and stay
>>> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
>>> http://p.sf.net/sfu/devconference
>>> _______________________________________________
>>> Gramps-devel mailing list
>>> Gramps-devel@...
>>> https://lists.sourceforge.net/lists/listinfo/gramps-devel
>>>
>>
>
>

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Gramps-devel mailing list
Gramps-devel@...
https://lists.sourceforge.net/lists/listinfo/gramps-devel

Re: Re : WebCal in trunk

by Gerald Britton-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hey Jerome,

I took a look at this module because of this thread and found a neat
simplification here:

def _has_webpage_extension(url):
    """
    determine if a filename has an extension or not...

    url = filename to be checked
    """

    for ext in _WEB_EXT:
        if url.endswith(ext):
            return True
    return False

===
The "for" loop (with the 'return False' that follows it) is the same as:

    return any(url.endswith(ext) for ext in _WEB_EXT)

The advantage is that using the "any" function, the names "url" and
"endswith" and "ext" are looked up only once.  With the for loop, it
happens with every iteration.  For example, you can disassemble the
two fragments:

>>> t1='''
... for ext in _WEB_EXT:
...   if url.endswith(ext):
...     print True
... print False
... '''
>>>
>>> dis(compile(t1,'','exec'))
  2           0 SETUP_LOOP              39 (to 42)
              3 LOAD_NAME                0 (_WEB_EXT)
              6 GET_ITER
        >>    7 FOR_ITER                31 (to 41)
             10 STORE_NAME               1 (ext)

  3          13 LOAD_NAME                2 (url)
             16 LOAD_ATTR                3 (endswith)
             19 LOAD_NAME                1 (ext)
             22 CALL_FUNCTION            1
             25 JUMP_IF_FALSE            9 (to 37)
             28 POP_TOP

  4          29 LOAD_NAME                4 (True)
             32 PRINT_ITEM
             33 PRINT_NEWLINE
             34 JUMP_ABSOLUTE            7
        >>   37 POP_TOP
             38 JUMP_ABSOLUTE            7
        >>   41 POP_BLOCK

  5     >>   42 LOAD_NAME                5 (False)
             45 PRINT_ITEM
             46 PRINT_NEWLINE
             47 LOAD_CONST               0 (None)
             50 RETURN_VALUE


>>> t2 = '''any(url.endswith(ext) for ext in _WEB_EXT)'''
>>> dis(compile(t2,'','exec'))
  1           0 LOAD_NAME                0 (any)
              3 LOAD_CONST               0 (<code object <genexpr> at
0xb77821d0, file "", line 1>)
              6 MAKE_FUNCTION            0
              9 LOAD_NAME                1 (_WEB_EXT)
             12 GET_ITER
             13 CALL_FUNCTION            1
             16 CALL_FUNCTION            1
             19 POP_TOP
             20 LOAD_CONST               1 (None)
             23 RETURN_VALUE
>>>


On Fri, Oct 30, 2009 at 6:10 AM, Jérôme <romjerome@...> wrote:

>> This is not ok, the translator cannor translate variables! So this
>> should change to something like
>> txt_str = text +  ', <em>'  + (_('%s old') % str(age_str) if nyears
>> else _('birth')) + '</em>'
>
> I was also in the loop/operation ... (only a part !)
> http://gramps.svn.sourceforge.net/viewvc/gramps?view=rev&revision=13314
>
> I get the translation and no crash by using WebCal on trunk !
> + on branch (3.1)
> http://gramps.svn.sourceforge.net/viewvc/gramps?view=rev&revision=13313
>
> But I had not seen _(text  ... :-[
> I will do the change. Thank you !
>
> Benny Malengier a écrit :
>> 2009/10/29 jerome <romjerome@...>:
>>
>>> http://gramps.svn.sourceforge.net/viewvc/gramps/trunk/src/plugins/webreport/WebCal.py?r1=13349&r2=13352
>>
>> This change should be ok
>>
>>> but WebCal.py", line 1817 is something else !
>>>
>>>  1815    txt_str = _(text + ', <em>'
>>>  1816    + (_('%s old') % str(age_str) if nyears else _('birth'))
>>>  1817    + '</em>')
>>
>> This is not ok, the translator cannor translate variables! So this
>> should change to something like
>> txt_str = text +  ', <em>'  + (_('%s old') % str(age_str) if nyears
>> else _('birth')) + '</em>'
>>
>> So text is probably a Html object, and _ does not work on that, nor should it.
>>
>> Benny
>>
>>> I see few places using 'Html' string :
>>>
>>> * plugins/lib/libhtml.py but not modules called or translation with context _('contex|string').
>>>
>>> * plugins/docgen/HtmlDoc.py
>>>
>>> * plugins/lib/libhtmlbackend.py
>>>
>>> Possible conflit somewhere with the context value used on
>>> http://gramps.svn.sourceforge.net/viewvc/gramps/trunk/src/plugins/webreport/WebCal.py?r1=13349&r2=13352 ? Strange it was working on NarrativeWeb, WebCal and was a cosmetic modification !
>>>
>>> Does it crash on NarrativeWeb (libhtml) or "graphical" calendar ?
>>> http://www.gramps-project.org/wiki/index.php?title=Gramps_3.1_Wiki_Manual_-_Reports_-_part_4#Calendar
>>>
>>>
>>> Sincerely yours,
>>> Jérôme R.
>>>
>>> --- En date de : Jeu 29.10.09, Rob Healey <robhealey1@...> a écrit :
>>>
>>>> De: Rob Healey <robhealey1@...>
>>>> Objet: [Gramps-devel] WebCal in trunk
>>>> À: "Gramps Development List" <gramps-devel@...>
>>>> Date: Jeudi 29 Octobre 2009, 1h07
>>>> Greetings:
>>>>
>>>> I ran WebCal report in trunk, and I got a crash.  Here is
>>>> what I got.....
>>>>
>>>> 229461: ERROR: _ReportDialog.py: line 640: Failed to run
>>>> report.
>>>> Traceback (most recent call last):
>>>>   File
>>>> "/home/Frog/gramps32/src/ReportBase/_ReportDialog.py",
>>>> line 615, in report
>>>>
>>>>     MyReport.write_report()
>>>>   File
>>>> "/home/Frog/gramps32/src/plugins/webreport/WebCal.py",
>>>> line 1344, in write_report
>>>>     self.webcalendar(cal_year)
>>>>   File
>>>> "/home/Frog/gramps32/src/plugins/webreport/WebCal.py",
>>>> line 898, in webcalendar
>>>>
>>>>     monthly_calendar =
>>>> self.calendar_build("wc", year, month)
>>>>   File
>>>> "/home/Frog/gramps32/src/plugins/webreport/WebCal.py",
>>>> line 764, in calendar_build
>>>>     day_list = get_day_list(event_date, holiday_list,
>>>> bday_anniv_list)
>>>>
>>>>   File
>>>> "/home/Frog/gramps32/src/plugins/webreport/WebCal.py",
>>>> line 1817, in get_day_list
>>>>     + '</em>')
>>>>   File "/home/Frog/gramps32/src/TransUtils.py",
>>>> line 115, in sgettext
>>>>     sep_idx = msgid.rfind(sep)
>>>>
>>>> AttributeError: 'Html' object has no attribute
>>>> 'rfind'
>>>>
>>>> Sincerely yours,
>>>> Rob G. Healey
>>>>
>>>>
>>>>
>>>> -----La pièce jointe associée suit-----
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Come build with us! The BlackBerry(R) Developer Conference
>>>> in SF, CA
>>>> is the only developer event you need to attend this year.
>>>> Jumpstart your
>>>> developing skills, take BlackBerry mobile applications to
>>>> market and stay
>>>> ahead of the curve. Join us from November 9 - 12, 2009.
>>>> Register now!
>>>> http://p.sf.net/sfu/devconference
>>>> -----La pièce jointe associée suit-----
>>>>
>>>> _______________________________________________
>>>> Gramps-devel mailing list
>>>> Gramps-devel@...
>>>> https://lists.sourceforge.net/lists/listinfo/gramps-devel
>>>>
>>> __________________________________________________
>>> Do You Yahoo!?
>>> En finir avec le spam? Yahoo! Mail vous offre la meilleure protection possible contre les messages non sollicités
>>> http://mail.yahoo.fr Yahoo! Mail
>>>
>>> ------------------------------------------------------------------------------
>>> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
>>> is the only developer event you need to attend this year. Jumpstart your
>>> developing skills, take BlackBerry mobile applications to market and stay
>>> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
>>> http://p.sf.net/sfu/devconference
>>> _______________________________________________
>>> Gramps-devel mailing list
>>> Gramps-devel@...
>>> https://lists.sourceforge.net/lists/listinfo/gramps-devel
>>>
>>
>
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> Gramps-devel mailing list
> Gramps-devel@...
> https://lists.sourceforge.net/lists/listinfo/gramps-devel
>



--
Gerald Britton

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Gramps-devel mailing list
Gramps-devel@...
https://lists.sourceforge.net/lists/listinfo/gramps-devel

Re: Re : WebCal in trunk

by Benny Malengier :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Gerald,

Jerome learned some programming python because he was translating
GRAMPS in French, not the other way around. I am sure he is thrilled
to learn iterators (the for statement in the argument not being
evaluated completely before any is called) as well as the fact you can
compile and disect code in python, but think it is nevertheless best
you commit this improvement.

Benny

2009/10/30 Gerald Britton <gerald.britton@...>:

> Hey Jerome,
>
> I took a look at this module because of this thread and found a neat
> simplification here:
>
> def _has_webpage_extension(url):
>    """
>    determine if a filename has an extension or not...
>
>    url = filename to be checked
>    """
>
>    for ext in _WEB_EXT:
>        if url.endswith(ext):
>            return True
>    return False
>
> ===
> The "for" loop (with the 'return False' that follows it) is the same as:
>
>    return any(url.endswith(ext) for ext in _WEB_EXT)
>
> The advantage is that using the "any" function, the names "url" and
> "endswith" and "ext" are looked up only once.  With the for loop, it
> happens with every iteration.  For example, you can disassemble the
> two fragments:
>
>>>> t1='''
> ... for ext in _WEB_EXT:
> ...   if url.endswith(ext):
> ...     print True
> ... print False
> ... '''
>>>>
>>>> dis(compile(t1,'','exec'))
>  2           0 SETUP_LOOP              39 (to 42)
>              3 LOAD_NAME                0 (_WEB_EXT)
>              6 GET_ITER
>        >>    7 FOR_ITER                31 (to 41)
>             10 STORE_NAME               1 (ext)
>
>  3          13 LOAD_NAME                2 (url)
>             16 LOAD_ATTR                3 (endswith)
>             19 LOAD_NAME                1 (ext)
>             22 CALL_FUNCTION            1
>             25 JUMP_IF_FALSE            9 (to 37)
>             28 POP_TOP
>
>  4          29 LOAD_NAME                4 (True)
>             32 PRINT_ITEM
>             33 PRINT_NEWLINE
>             34 JUMP_ABSOLUTE            7
>        >>   37 POP_TOP
>             38 JUMP_ABSOLUTE            7
>        >>   41 POP_BLOCK
>
>  5     >>   42 LOAD_NAME                5 (False)
>             45 PRINT_ITEM
>             46 PRINT_NEWLINE
>             47 LOAD_CONST               0 (None)
>             50 RETURN_VALUE
>
>
>>>> t2 = '''any(url.endswith(ext) for ext in _WEB_EXT)'''
>>>> dis(compile(t2,'','exec'))
>  1           0 LOAD_NAME                0 (any)
>              3 LOAD_CONST               0 (<code object <genexpr> at
> 0xb77821d0, file "", line 1>)
>              6 MAKE_FUNCTION            0
>              9 LOAD_NAME                1 (_WEB_EXT)
>             12 GET_ITER
>             13 CALL_FUNCTION            1
>             16 CALL_FUNCTION            1
>             19 POP_TOP
>             20 LOAD_CONST               1 (None)
>             23 RETURN_VALUE
>>>>
>
>
> On Fri, Oct 30, 2009 at 6:10 AM, Jérôme <romjerome@...> wrote:
>>> This is not ok, the translator cannor translate variables! So this
>>> should change to something like
>>> txt_str = text +  ', <em>'  + (_('%s old') % str(age_str) if nyears
>>> else _('birth')) + '</em>'
>>
>> I was also in the loop/operation ... (only a part !)
>> http://gramps.svn.sourceforge.net/viewvc/gramps?view=rev&revision=13314
>>
>> I get the translation and no crash by using WebCal on trunk !
>> + on branch (3.1)
>> http://gramps.svn.sourceforge.net/viewvc/gramps?view=rev&revision=13313
>>
>> But I had not seen _(text  ... :-[
>> I will do the change. Thank you !
>>
>> Benny Malengier a écrit :
>>> 2009/10/29 jerome <romjerome@...>:
>>>
>>>> http://gramps.svn.sourceforge.net/viewvc/gramps/trunk/src/plugins/webreport/WebCal.py?r1=13349&r2=13352
>>>
>>> This change should be ok
>>>
>>>> but WebCal.py", line 1817 is something else !
>>>>
>>>>  1815    txt_str = _(text + ', <em>'
>>>>  1816    + (_('%s old') % str(age_str) if nyears else _('birth'))
>>>>  1817    + '</em>')
>>>
>>> This is not ok, the translator cannor translate variables! So this
>>> should change to something like
>>> txt_str = text +  ', <em>'  + (_('%s old') % str(age_str) if nyears
>>> else _('birth')) + '</em>'
>>>
>>> So text is probably a Html object, and _ does not work on that, nor should it.
>>>
>>> Benny
>>>
>>>> I see few places using 'Html' string :
>>>>
>>>> * plugins/lib/libhtml.py but not modules called or translation with context _('contex|string').
>>>>
>>>> * plugins/docgen/HtmlDoc.py
>>>>
>>>> * plugins/lib/libhtmlbackend.py
>>>>
>>>> Possible conflit somewhere with the context value used on
>>>> http://gramps.svn.sourceforge.net/viewvc/gramps/trunk/src/plugins/webreport/WebCal.py?r1=13349&r2=13352 ? Strange it was working on NarrativeWeb, WebCal and was a cosmetic modification !
>>>>
>>>> Does it crash on NarrativeWeb (libhtml) or "graphical" calendar ?
>>>> http://www.gramps-project.org/wiki/index.php?title=Gramps_3.1_Wiki_Manual_-_Reports_-_part_4#Calendar
>>>>
>>>>
>>>> Sincerely yours,
>>>> Jérôme R.
>>>>
>>>> --- En date de : Jeu 29.10.09, Rob Healey <robhealey1@...> a écrit :
>>>>
>>>>> De: Rob Healey <robhealey1@...>
>>>>> Objet: [Gramps-devel] WebCal in trunk
>>>>> À: "Gramps Development List" <gramps-devel@...>
>>>>> Date: Jeudi 29 Octobre 2009, 1h07
>>>>> Greetings:
>>>>>
>>>>> I ran WebCal report in trunk, and I got a crash.  Here is
>>>>> what I got.....
>>>>>
>>>>> 229461: ERROR: _ReportDialog.py: line 640: Failed to run
>>>>> report.
>>>>> Traceback (most recent call last):
>>>>>   File
>>>>> "/home/Frog/gramps32/src/ReportBase/_ReportDialog.py",
>>>>> line 615, in report
>>>>>
>>>>>     MyReport.write_report()
>>>>>   File
>>>>> "/home/Frog/gramps32/src/plugins/webreport/WebCal.py",
>>>>> line 1344, in write_report
>>>>>     self.webcalendar(cal_year)
>>>>>   File
>>>>> "/home/Frog/gramps32/src/plugins/webreport/WebCal.py",
>>>>> line 898, in webcalendar
>>>>>
>>>>>     monthly_calendar =
>>>>> self.calendar_build("wc", year, month)
>>>>>   File
>>>>> "/home/Frog/gramps32/src/plugins/webreport/WebCal.py",
>>>>> line 764, in calendar_build
>>>>>     day_list = get_day_list(event_date, holiday_list,
>>>>> bday_anniv_list)
>>>>>
>>>>>   File
>>>>> "/home/Frog/gramps32/src/plugins/webreport/WebCal.py",
>>>>> line 1817, in get_day_list
>>>>>     + '</em>')
>>>>>   File "/home/Frog/gramps32/src/TransUtils.py",
>>>>> line 115, in sgettext
>>>>>     sep_idx = msgid.rfind(sep)
>>>>>
>>>>> AttributeError: 'Html' object has no attribute
>>>>> 'rfind'
>>>>>
>>>>> Sincerely yours,
>>>>> Rob G. Healey
>>>>>
>>>>>
>>>>>
>>>>> -----La pièce jointe associée suit-----
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>> Come build with us! The BlackBerry(R) Developer Conference
>>>>> in SF, CA
>>>>> is the only developer event you need to attend this year.
>>>>> Jumpstart your
>>>>> developing skills, take BlackBerry mobile applications to
>>>>> market and stay
>>>>> ahead of the curve. Join us from November 9 - 12, 2009.
>>>>> Register now!
>>>>> http://p.sf.net/sfu/devconference
>>>>> -----La pièce jointe associée suit-----
>>>>>
>>>>> _______________________________________________
>>>>> Gramps-devel mailing list
>>>>> Gramps-devel@...
>>>>> https://lists.sourceforge.net/lists/listinfo/gramps-devel
>>>>>
>>>> __________________________________________________
>>>> Do You Yahoo!?
>>>> En finir avec le spam? Yahoo! Mail vous offre la meilleure protection possible contre les messages non sollicités
>>>> http://mail.yahoo.fr Yahoo! Mail
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
>>>> is the only developer event you need to attend this year. Jumpstart your
>>>> developing skills, take BlackBerry mobile applications to market and stay
>>>> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
>>>> http://p.sf.net/sfu/devconference
>>>> _______________________________________________
>>>> Gramps-devel mailing list
>>>> Gramps-devel@...
>>>> https://lists.sourceforge.net/lists/listinfo/gramps-devel
>>>>
>>>
>>
>>
>> ------------------------------------------------------------------------------
>> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
>> is the only developer event you need to attend this year. Jumpstart your
>> developing skills, take BlackBerry mobile applications to market and stay
>> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
>> http://p.sf.net/sfu/devconference
>> _______________________________________________
>> Gramps-devel mailing list
>> Gramps-devel@...
>> https://lists.sourceforge.net/lists/listinfo/gramps-devel
>>
>
>
>
> --
> Gerald Britton
>

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Gramps-devel mailing list
Gramps-devel@...
https://lists.sourceforge.net/lists/listinfo/gramps-devel

Re: Re : WebCal in trunk

by Jerome :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> but think it is nevertheless best you commit this improvement.

+1

It seems I also used an unadapted word : loop !

True, there is loop on code, but I tried to describe my paticipation on
this line of code, in the vortex of this part of code...

> I am sure he is thrilled to learn iterators

Currently, I understand that using a line rather than two in the loop
iteration is less complicated (less possible errors as
handle_from_handles(handle), etc ...), that's all !
But also by reading the blog http://blog.gramps-project.org/ I am
starting to better and better understand the code.
Thank you !

I just suppose there is an exception on place object.
Maybe because there is no place.ref ?

> Jerome learned some programming python

I suppose some people who are translating Gramps have dived into python
with localized Date_handler and Relationships.

I know that abstraction, automation and knowledge of basic modules for
programming python fail sometimes to me. No need to study my way of
coding, it summarizes in a few steps not always compatible with python.
I try to use available tool/framework, even turn them to their first use
(ex: hammering a nail with a shovel ... well how long it takes, what
state is the shovel ?). Fortunately there are aids (programs, people) to
make the code cleaner and inform on the existence of specific "tools for..."

Note, Gramps is not the only one python program I use !
I have also provided patchs for other python programs :)

What is certain, that the code Gramps is often easier to understand than
the multitude of small projects coded for a version of python (2.4) or
one OS (even if it is a language multi-plateform !).


Jérôme

Benny Malengier a écrit :

> Gerald,
>
> Jerome learned some programming python because he was translating
> GRAMPS in French, not the other way around. I am sure he is thrilled
> to learn iterators (the for statement in the argument not being
> evaluated completely before any is called) as well as the fact you can
> compile and disect code in python, but think it is nevertheless best
> you commit this improvement.
>
> Benny
>
> 2009/10/30 Gerald Britton <gerald.britton@...>:
>> Hey Jerome,
>>
>> I took a look at this module because of this thread and found a neat
>> simplification here:
>>
>> def _has_webpage_extension(url):
>>    """
>>    determine if a filename has an extension or not...
>>
>>    url = filename to be checked
>>    """
>>
>>    for ext in _WEB_EXT:
>>        if url.endswith(ext):
>>            return True
>>    return False
>>
>> ===
>> The "for" loop (with the 'return False' that follows it) is the same as:
>>
>>    return any(url.endswith(ext) for ext in _WEB_EXT)
>>
>> The advantage is that using the "any" function, the names "url" and
>> "endswith" and "ext" are looked up only once.  With the for loop, it
>> happens with every iteration.  For example, you can disassemble the
>> two fragments:
>>
>>>>> t1='''
>> ... for ext in _WEB_EXT:
>> ...   if url.endswith(ext):
>> ...     print True
>> ... print False
>> ... '''
>>>>> dis(compile(t1,'','exec'))
>>  2           0 SETUP_LOOP              39 (to 42)
>>              3 LOAD_NAME                0 (_WEB_EXT)
>>              6 GET_ITER
>>        >>    7 FOR_ITER                31 (to 41)
>>             10 STORE_NAME               1 (ext)
>>
>>  3          13 LOAD_NAME                2 (url)
>>             16 LOAD_ATTR                3 (endswith)
>>             19 LOAD_NAME                1 (ext)
>>             22 CALL_FUNCTION            1
>>             25 JUMP_IF_FALSE            9 (to 37)
>>             28 POP_TOP
>>
>>  4          29 LOAD_NAME                4 (True)
>>             32 PRINT_ITEM
>>             33 PRINT_NEWLINE
>>             34 JUMP_ABSOLUTE            7
>>        >>   37 POP_TOP
>>             38 JUMP_ABSOLUTE            7
>>        >>   41 POP_BLOCK
>>
>>  5     >>   42 LOAD_NAME                5 (False)
>>             45 PRINT_ITEM
>>             46 PRINT_NEWLINE
>>             47 LOAD_CONST               0 (None)
>>             50 RETURN_VALUE
>>
>>
>>>>> t2 = '''any(url.endswith(ext) for ext in _WEB_EXT)'''
>>>>> dis(compile(t2,'','exec'))
>>  1           0 LOAD_NAME                0 (any)
>>              3 LOAD_CONST               0 (<code object <genexpr> at
>> 0xb77821d0, file "", line 1>)
>>              6 MAKE_FUNCTION            0
>>              9 LOAD_NAME                1 (_WEB_EXT)
>>             12 GET_ITER
>>             13 CALL_FUNCTION            1
>>             16 CALL_FUNCTION            1
>>             19 POP_TOP
>>             20 LOAD_CONST               1 (None)
>>             23 RETURN_VALUE
>>
>> On Fri, Oct 30, 2009 at 6:10 AM, Jérôme <romjerome@...> wrote:
>>>> This is not ok, the translator cannor translate variables! So this
>>>> should change to something like
>>>> txt_str = text +  ', <em>'  + (_('%s old') % str(age_str) if nyears
>>>> else _('birth')) + '</em>'
>>> I was also in the loop/operation ... (only a part !)
>>> http://gramps.svn.sourceforge.net/viewvc/gramps?view=rev&revision=13314
>>>
>>> I get the translation and no crash by using WebCal on trunk !
>>> + on branch (3.1)
>>> http://gramps.svn.sourceforge.net/viewvc/gramps?view=rev&revision=13313
>>>
>>> But I had not seen _(text  ... :-[
>>> I will do the change. Thank you !
>>>
>>> Benny Malengier a écrit :
>>>> 2009/10/29 jerome <romjerome@...>:
>>>>
>>>>> http://gramps.svn.sourceforge.net/viewvc/gramps/trunk/src/plugins/webreport/WebCal.py?r1=13349&r2=13352
>>>> This change should be ok
>>>>
>>>>> but WebCal.py", line 1817 is something else !
>>>>>
>>>>>  1815    txt_str = _(text + ', <em>'
>>>>>  1816    + (_('%s old') % str(age_str) if nyears else _('birth'))
>>>>>  1817    + '</em>')
>>>> This is not ok, the translator cannor translate variables! So this
>>>> should change to something like
>>>> txt_str = text +  ', <em>'  + (_('%s old') % str(age_str) if nyears
>>>> else _('birth')) + '</em>'
>>>>
>>>> So text is probably a Html object, and _ does not work on that, nor should it.
>>>>
>>>> Benny
>>>>
>>>>> I see few places using 'Html' string :
>>>>>
>>>>> * plugins/lib/libhtml.py but not modules called or translation with context _('contex|string').
>>>>>
>>>>> * plugins/docgen/HtmlDoc.py
>>>>>
>>>>> * plugins/lib/libhtmlbackend.py
>>>>>
>>>>> Possible conflit somewhere with the context value used on
>>>>> http://gramps.svn.sourceforge.net/viewvc/gramps/trunk/src/plugins/webreport/WebCal.py?r1=13349&r2=13352 ? Strange it was working on NarrativeWeb, WebCal and was a cosmetic modification !
>>>>>
>>>>> Does it crash on NarrativeWeb (libhtml) or "graphical" calendar ?
>>>>> http://www.gramps-project.org/wiki/index.php?title=Gramps_3.1_Wiki_Manual_-_Reports_-_part_4#Calendar
>>>>>
>>>>>
>>>>> Sincerely yours,
>>>>> Jérôme R.
>>>>>
>>>>> --- En date de : Jeu 29.10.09, Rob Healey <robhealey1@...> a écrit :
>>>>>
>>>>>> De: Rob Healey <robhealey1@...>
>>>>>> Objet: [Gramps-devel] WebCal in trunk
>>>>>> À: "Gramps Development List" <gramps-devel@...>
>>>>>> Date: Jeudi 29 Octobre 2009, 1h07
>>>>>> Greetings:
>>>>>>
>>>>>> I ran WebCal report in trunk, and I got a crash.  Here is
>>>>>> what I got.....
>>>>>>
>>>>>> 229461: ERROR: _ReportDialog.py: line 640: Failed to run
>>>>>> report.
>>>>>> Traceback (most recent call last):
>>>>>>   File
>>>>>> "/home/Frog/gramps32/src/ReportBase/_ReportDialog.py",
>>>>>> line 615, in report
>>>>>>
>>>>>>     MyReport.write_report()
>>>>>>   File
>>>>>> "/home/Frog/gramps32/src/plugins/webreport/WebCal.py",
>>>>>> line 1344, in write_report
>>>>>>     self.webcalendar(cal_year)
>>>>>>   File
>>>>>> "/home/Frog/gramps32/src/plugins/webreport/WebCal.py",
>>>>>> line 898, in webcalendar
>>>>>>
>>>>>>     monthly_calendar =
>>>>>> self.calendar_build("wc", year, month)
>>>>>>   File
>>>>>> "/home/Frog/gramps32/src/plugins/webreport/WebCal.py",
>>>>>> line 764, in calendar_build
>>>>>>     day_list = get_day_list(event_date, holiday_list,
>>>>>> bday_anniv_list)
>>>>>>
>>>>>>   File
>>>>>> "/home/Frog/gramps32/src/plugins/webreport/WebCal.py",
>>>>>> line 1817, in get_day_list
>>>>>>     + '</em>')
>>>>>>   File "/home/Frog/gramps32/src/TransUtils.py",
>>>>>> line 115, in sgettext
>>>>>>     sep_idx = msgid.rfind(sep)
>>>>>>
>>>>>> AttributeError: 'Html' object has no attribute
>>>>>> 'rfind'
>>>>>>
>>>>>> Sincerely yours,
>>>>>> Rob G. Healey
>>>>>>
>>>>>>
>>>>>>
>>>>>> -----La pièce jointe associée suit-----
>>>>>>
>>>>>> ------------------------------------------------------------------------------
>>>>>> Come build with us! The BlackBerry(R) Developer Conference
>>>>>> in SF, CA
>>>>>> is the only developer event you need to attend this year.
>>>>>> Jumpstart your
>>>>>> developing skills, take BlackBerry mobile applications to
>>>>>> market and stay
>>>>>> ahead of the curve. Join us from November 9 - 12, 2009.
>>>>>> Register now!
>>>>>> http://p.sf.net/sfu/devconference
>>>>>> -----La pièce jointe associée suit-----
>>>>>>
>>>>>> _______________________________________________
>>>>>> Gramps-devel mailing list
>>>>>> Gramps-devel@...
>>>>>> https://lists.sourceforge.net/lists/listinfo/gramps-devel
>>>>>>
>>>>> __________________________________________________
>>>>> Do You Yahoo!?
>>>>> En finir avec le spam? Yahoo! Mail vous offre la meilleure protection possible contre les messages non sollicités
>>>>> http://mail.yahoo.fr Yahoo! Mail
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
>>>>> is the only developer event you need to attend this year. Jumpstart your
>>>>> developing skills, take BlackBerry mobile applications to market and stay
>>>>> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
>>>>> http://p.sf.net/sfu/devconference
>>>>> _______________________________________________
>>>>> Gramps-devel mailing list
>>>>> Gramps-devel@...
>>>>> https://lists.sourceforge.net/lists/listinfo/gramps-devel
>>>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
>>> is the only developer event you need to attend this year. Jumpstart your
>>> developing skills, take BlackBerry mobile applications to market and stay
>>> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
>>> http://p.sf.net/sfu/devconference
>>> _______________________________________________
>>> Gramps-devel mailing list
>>> Gramps-devel@...
>>> https://lists.sourceforge.net/lists/listinfo/gramps-devel
>>>
>>
>>
>> --
>> Gerald Britton
>>
>


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Gramps-devel mailing list
Gramps-devel@...
https://lists.sourceforge.net/lists/listinfo/gramps-devel