[sugar] [PATCH] Fix appearance of activity bundles (in Journal)

Eben Eliason eben.eliason
Wed Apr 23 15:45:19 EDT 2008


Hmm, you mean:

if jobject.metadata.get('title', ''):
    title_text = jobject.metadata.get('title', '')
else
    title_text = _('Untitled')

title.props.text = title_text
...

Do I not need to declare title_text outside the scope of the condition
first?  For that matter, is the null string always treated as False in
conditions, even though it's distinct from None type?  (Sorry...didn't
play in Python much before.)

I supposed there's also:

title_text = _('Untitled')
if jobject.metadata.get('title', ''):
    title_text = jobject.metadata.get('title', '')

title.props.text = title_text

- Eben


On Wed, Apr 23, 2008 at 3:32 PM, Tomeu Vizoso <tomeu at tomeuvizoso.net> wrote:
> On Wed, Apr 23, 2008 at 9:26 PM, Bert Freudenberg <bert at freudenbergs.de> wrote:
>  >
>  >  On 23.04.2008, at 21:23, Eben Eliason wrote:
>  >
>  >  > if jobject.metadata.has_key['title'] and
>  >  > jobject.metadata.has_key['title']:
>  >
>  >
>  >  Seems a bit redundant.
>
>  ;)
>
>  I would go for
>
>  if jobject.metadata.get('title', ''):
>   _title = title
>  else:
>   _title = _('Untitled')
>
>  (more or less)
>
>  Tomeu
>
>
> _______________________________________________
>  Sugar mailing list
>  Sugar at lists.laptop.org
>  http://lists.laptop.org/listinfo/sugar
>



More information about the Sugar-devel mailing list