More concrete

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

More concrete

Igor Sosa Mayor
Sorry,

I want to be more concrete:

why am I getting an error in line 97 of the attached file AND NOT in line 85?

The error is:

File "/home/igorxus/.gramps/plugins/sumario3.py", line 97, in build_report
    nombre = persona.get_primary_name()
AttributeError: 'NoneType' object has no attribute 'get_primary_name'

BUT:
As far as I see, what I do in line 85 is THE SAME. Why error in one case and
not in the other?

Thanks in advance

Igor

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel

sumario3.py (5K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: More concrete

OldAl
Igor,

On Sun, 26 Oct 2008 06:08:14 Igor Sosa Mayor wrote:
> Sorry,

I think my email would be better off the list, but here goes.  I am sure that
your plug-in should not be run "raw", that is not as a stand alone program.  
But there is no harm in doing it as a first step.

I use IDLE and have done so for some years.  When "sumario3.py" is opened in
an IDLE window, it can be run by pressing F5, which I did, expecting
a "complaint" from IDLE.  I got it, but it was different to what I expected -
it showed a syntax error, which IDLE poppup window describes as:

"Inconsistent indentation detected!

1. Your indentation is outright incorrect (easy to fix),  OR

2. Your indentation mixes tabs and spaces.

To fix case 2 change all tabs to spaces by using

etc...
"

I have seen this error message before and for reasons that were NOT the spaces
mixed with tabs.  But it is worth trying to do what it says as a first step.

Igor, if you care to write to me off-list (or on list, if you prefer), I can
try to help you with straight programming problems, as this one seems to be.  
My knowledge of Gramps is extremely limited.  In return for helping you with
programming, I would appreciate some information about Gramps, viz. how to
implement a plug-in -- and you know that already.

As someone who was engaged in research for many years, I understand your need
of your own bit of program to get the statistical data that YOU want.  It is
very seldom possible to predict in advance of the research what data in what
format you will want when your research progresses, so that your own pluggin
is not only highly desirable, but it is necessary and there is no substitute
for it by a ready made program.


Best of luck,

OldAl.

>
> I want to be more concrete:
>
> why am I getting an error in line 97 of the attached file AND NOT in line
> 85?
>
> The error is:
>
> File "/home/igorxus/.gramps/plugins/sumario3.py", line 97, in build_report
>     nombre = persona.get_primary_name()
> AttributeError: 'NoneType' object has no attribute 'get_primary_name'
>
> BUT:
> As far as I see, what I do in line 85 is THE SAME. Why error in one case
> and not in the other?
>
> Thanks in advance
>
> Igor



--
Dr Algis Kabaila (PhD Eng)
http://akabaila.pcug.org.au/StructuralAnalysis/
------------------------------------------------


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Reply | Threaded
Open this post in threaded view
|

Re: More concrete

Brian Matherly
In reply to this post by Igor Sosa Mayor
Igor,

> I want to be more concrete:
>
> why am I getting an error in line 97 of the attached file
> AND NOT in line 85?
>
> The error is:
>
> File "/home/igorxus/.gramps/plugins/sumario3.py",
> line 97, in build_report
>     nombre = persona.get_primary_name()
> AttributeError: 'NoneType' object has no attribute
> 'get_primary_name'
>
> BUT:
> As far as I see, what I do in line 85 is THE SAME. Why
> error in one case and
> not in the other?

In Python, "NoneType" is kind of like a NULL pointer in "C". The function database.get_person_from_handle(child_handle) on line 96 is supposed to return a Person instance. It returns "None" if there is no person in the database with the corresponding handle.

Perhaps there is an inconsistency in your database where a child is referenced in a family, but that child doesn't actually exist in the database. This would explain why the error does not occur on line 85 because that code is only looping through handles that are known to be in the database.

Try running the "Check and repair" database tool and see if the problem persists. It should fix any data inconsistencies.

~Brian

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Reply | Threaded
Open this post in threaded view
|

Re: More concrete

OldAl
In reply to this post by Igor Sosa Mayor
Igor,

On Sun, 26 Oct 2008 06:08:14 Igor Sosa Mayor wrote:
> Sorry,
>
> I want to be more concrete:

I "untabified" the program (replaced all tabs by spaces, I hope...).  Now when
run as a main (which is a "silly mistake" at best), Python IDLE does not
complain about the syntax.  Of course, it fails, but now gives a message:

Traceback (most recent call last):
  File "/media/sda3/share/Documents/python/gramps/sumario3.py", line 55, in
<module>
    import gen.lib
ImportError: No module named gen.lib

Of course, how can it do anything, being run from my ~/Documents/python/gramps
directory :)

I attach your program "untabified".

Give it a try and let me know if it worked and thanks for your cooperation.  
Keep going with your own module - it is useful fun!

OldAl.

>
> why am I getting an error in line 97 of the attached file AND NOT in line
> 85?
>
> The error is:
>
> File "/home/igorxus/.gramps/plugins/sumario3.py", line 97, in build_report
>     nombre = persona.get_primary_name()
> AttributeError: 'NoneType' object has no attribute 'get_primary_name'
>
> BUT:
> As far as I see, what I do in line 85 is THE SAME. Why error in one case
> and not in the other?
>
> Thanks in advance
>
> Igor


--
Dr Algis Kabaila (PhD Eng)
http://akabaila.pcug.org.au/StructuralAnalysis/
------------------------------------------------


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel

sumario3.py (5K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: More concrete

Eero Tamminen-3
Hi,

On Sunday 26 October 2008, Algis Kabaila wrote:
> On Sun, 26 Oct 2008 06:08:14 Igor Sosa Mayor wrote:
> > I want to be more concrete:
>
> I "untabified" the program (replaced all tabs by spaces, I hope...).

At least Linux has a GNU tool to do that, see "man expand".


> Now
> when run as a main (which is a "silly mistake" at best), Python IDLE does
> not complain about the syntax.

This can be checked also from command line with the "tabnanny" module,
in my distro:  /usr/lib/python2.5/tabnanny.py.  It warns about ambiguous
indentation.


But any self-respecting editor should know how the Python code should be
indented (using spaces, not tabs), so I guess this problem originates from
using some "toy" code editor.  :-)


        - Eero

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Reply | Threaded
Open this post in threaded view
|

Re: More concrete

Stéphane Charette-2
> But any self-respecting editor should know how the Python code should be
> indented (using spaces, not tabs), so I guess this problem originates from
> using some "toy" code editor.  :-)

Don't know if you were somewhat kidding, but...  Note this is not
quite correct.  At my last job, which was a big python shop, the
standard there was tab, not spaces.  As long as it is used
consistently, it works.  Mix-and-match is what causes trouble.

Stéphane

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Reply | Threaded
Open this post in threaded view
|

Re: More concrete

Eero Tamminen-3
Hi,

On Sunday 26 October 2008, Stéphane Charette wrote:
> > But any self-respecting editor should know how the Python code should
> > be indented (using spaces, not tabs), so I guess this problem
> > originates from using some "toy" code editor.  :-)
>
> Don't know if you were somewhat kidding, but...  Note this is not
> quite correct.  At my last job, which was a big python shop, the
> standard there was tab, not spaces.  As long as it is used
> consistently, it works.  Mix-and-match is what causes trouble.

Right, but when you have multiple people with their own conventions editing
the same code[1], you will eventually get mix-and-match.  That's why Python
PEP 8 (Style Guide) recommends using 4 spaces for intendenting:
        http://www.python.org/dev/peps/pep-0008/

If one uses a proper code editor, you don't even notice whether it's tabs or
spaces, everything is done correctly automatically.

[1] At least command line based editors (Emacs, Jed...) seem by default
     to respect / work according to Python Style.


Maybe the gramps script should start gramps.py with "-t" Python option
(warn when detecting mix-and-match, see "python -h")?


        - Eero

PS. This was hotly debated in the Python news groups already in 90's when
I still followed the Python development. :-)  For a more recent discussion,
see e.g. this:
http://mail.python.org/pipermail/python-list/2003-October/231724.html

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Reply | Threaded
Open this post in threaded view
|

Re: More concrete

OldAl
On Sun, 26 Oct 2008 19:38:11 Eero Tamminen wrote:
> Eero Tamminen <[hidden email]>

Very erudite and informative.  What I would appreciate is

1. How to run the proposed plugin (after copying "sumario3.py  to
~/gramps/src/plugins/ directory)? CLI string?

2. Where is (if in the wiki, what URL?) information about making and running
plugins? I looked at several, but none seems to give a simple, straight
answer.

It would save a lot of frustration for an old man I know well - me :)

OldAl.

"Freiheit ist immer auch die Freiheit des Andersdenkenden".  
What a shame that the author of the above line did not abide by this
principle...

--
Dr Algis Kabaila (PhD Eng)
http://akabaila.pcug.org.au/StructuralAnalysis/
------------------------------------------------


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Reply | Threaded
Open this post in threaded view
|

Re: More concrete

jerome
> 1. How to run the proposed plugin (after copying "sumario3.py  to ~/gramps/src/plugins/ directory)? CLI string?

register_report(
     name = 'sumario3',
     category = CATEGORY_VIEW,

"CATEGORY_VIEW" does not exist on trunk
(moved to textual version or tools)
On gramps-3.0.3, you find them on Reports->View
http://www.gramps-project.org/wiki/index.php?title=Gramps_3.0_Wiki_Manual_-_Reports#View

> 2. Where is (if in the wiki, what URL?) information about making and running plugins? I looked at several, but none seems to give a simple, straight answer.

Maybe:
http://www.gramps-project.org/wiki/index.php?title=Report-writing_tutorial

additionnal URLs :
http://www.gramps-project.org/wiki/index.php?title=Report_API
http://www.gramps-project.org/wiki/index.php?title=Third-party_Plugins
http://www.gramps-project.org/wiki/index.php?title=Using_database_API


Jérôme


Algis Kabaila a écrit :

> On Sun, 26 Oct 2008 19:38:11 Eero Tamminen wrote:
>> Eero Tamminen <[hidden email]>
>
> Very erudite and informative.  What I would appreciate is
>
> 1. How to run the proposed plugin (after copying "sumario3.py  to
> ~/gramps/src/plugins/ directory)? CLI string?
>
> 2. Where is (if in the wiki, what URL?) information about making and running
> plugins? I looked at several, but none seems to give a simple, straight
> answer.
>
> It would save a lot of frustration for an old man I know well - me :)
>
> OldAl.
>
> "Freiheit ist immer auch die Freiheit des Andersdenkenden".  
> What a shame that the author of the above line did not abide by this
> principle...
>



-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Reply | Threaded
Open this post in threaded view
|

Re: More concrete

Benny Malengier
In reply to this post by Igor Sosa Mayor


2008/10/25 Igor Sosa Mayor <[hidden email]>
Sorry,

I want to be more concrete:

why am I getting an error in line 97 of the attached file AND NOT in line 85?

The error is:

File "/home/igorxus/.gramps/plugins/sumario3.py", line 97, in build_report
   nombre = persona.get_primary_name()
AttributeError: 'NoneType' object has no attribute 'get_primary_name'

BUT:
As far as I see, what I do in line 85 is THE SAME. Why error in one case and
not in the other?

Thanks in advance

Mail with other subject.
So the first error was the wrong intendation.
The next error is that you obtain list of child references, but threat them as handles. A childref however contains a handle and some extra info like the relation to the parent (birth, ... ).

So the code there should be:
         for child_ref in descendencia:
                 persona = database.get_person_from_handle(child_ref.ref)
                 nombre = persona.get_primary_name()
 
In this, child_ref.ref is the handle to the child this child_ref points to

Some other notes:

1/ the copyright here is you, so put at the top:

# Copyright (C) 2008 Igor Sosa Mayor

The fact that you use the API other people have written does not mean you have to take the copyright over

2/ at the bottom, change everything, and don't keep same names of classes as in other places, so eg

register_report(
    name = 'sumario3',
    category = CATEGORY_VIEW,
    report_class = SumarioReport,
    options_class = None,
    modes = MODE_GUI,
    translated_name = _("MySummary"),
    status = _("Unstable"),
    description= ("Provides a summary of the current database"),
    author_name="Igor Sosa",
    author_email="[hidden email]",
    require_active=False
    )

Note that the class is now SumarioReport, and you should put YOUR email there, and the translated name is the english. The function _(...) will do the translation to spanish. If you add new strings, and want immediately things in Spanish, you can change the po/es.po file, see translation section of the wiki.

About your intentions, I think it a great idea to use GRAMPS in resource. Any changes you do can be contributed to the project and don't get lost.

Benny


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Reply | Threaded
Open this post in threaded view
|

Re: More concrete

OldAl
In reply to this post by jerome
Jérôme ,

On Sun, 26 Oct 2008 22:22:59 Jérôme wrote:

Sincere thank you for the trouble you have taken to reply to my questions.  I
confess that "./configure" and "make" are black boxes for me.  Bearing this
in mind, would you tell me if it Is  correct to assume that the procedure to
insert into gramps a plugin 'sumario3' is to:

1. Copy the plugin program into the ~/gramps30/src/plugins/
2. Make ~/gramps30 the current directory
3.  ./configure
4.  make
5. python src/gramps.py

and that if this is  successful, the 'sumario3' will become accessible from
the gui?

I will print out your email and paste it into my notes on Python and gramps.  
There is a lot of reading there!

I am sending a copy of this to Benny - he is very helpful to people on this
list and his reply to Igor if of interest to me. I would like to replicate
your error message, Benny.  I might just take a punt and try the above
procedure, though I hate the "blind" trial with black boxes... How
does ./configure and make know about the 'sumario3.py' file?

Thank you again, Jérôme; thank you Benny (BTW, I have 'detabified' sumario3.py
for Igor and this should change the behaviour of his code, if he bothers to
use it.)

OldAl.

> > 1. How to run the proposed plugin (after copying "sumario3.py  to
> > ~/gramps/src/plugins/ directory)? CLI string?
>
> register_report(
>      name = 'sumario3',
>      category = CATEGORY_VIEW,
>
> "CATEGORY_VIEW" does not exist on trunk
> (moved to textual version or tools)
> On gramps-3.0.3, you find them on Reports->View
> http://www.gramps-project.org/wiki/index.php?title=Gramps_3.0_Wiki_Manual_-
>_Reports#View
>
> > 2. Where is (if in the wiki, what URL?) information about making and
> > running plugins? I looked at several, but none seems to give a simple,
> > straight answer.
>
> Maybe:
> http://www.gramps-project.org/wiki/index.php?title=Report-writing_tutorial
>
> additionnal URLs :
> http://www.gramps-project.org/wiki/index.php?title=Report_API
> http://www.gramps-project.org/wiki/index.php?title=Third-party_Plugins
> http://www.gramps-project.org/wiki/index.php?title=Using_database_API
>
>
> Jérôme
>

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Reply | Threaded
Open this post in threaded view
|

Re: More concrete

jerome
Algis,

> 3.  ./configure
> 4.  make

This makes sense if you don't have an installed version.
'./configure' is because you get files from SVN.
'make' will activated const.py.in (generates const.py)

Maybe just rename const.py.in to const.py will avoid to do :
./configure
make
(for testing new plugin)

> How does ./configure and make know about the 'sumario3.py' file?

Note: this commands are not related to 'sumario3.py', they just
(activated|make active) Gramps for working.


Jérôme


Algis Kabaila a écrit :

> Jérôme ,
>
> On Sun, 26 Oct 2008 22:22:59 Jérôme wrote:
>
> Sincere thank you for the trouble you have taken to reply to my questions.  I
> confess that "./configure" and "make" are black boxes for me.  Bearing this
> in mind, would you tell me if it Is  correct to assume that the procedure to
> insert into gramps a plugin 'sumario3' is to:
>
> 1. Copy the plugin program into the ~/gramps30/src/plugins/
> 2. Make ~/gramps30 the current directory
> 3.  ./configure
> 4.  make
> 5. python src/gramps.py
>
> and that if this is  successful, the 'sumario3' will become accessible from
> the gui?
>
> I will print out your email and paste it into my notes on Python and gramps.  
> There is a lot of reading there!
>
> I am sending a copy of this to Benny - he is very helpful to people on this
> list and his reply to Igor if of interest to me. I would like to replicate
> your error message, Benny.  I might just take a punt and try the above
> procedure, though I hate the "blind" trial with black boxes... How
> does ./configure and make know about the 'sumario3.py' file?
>
> Thank you again, Jérôme; thank you Benny (BTW, I have 'detabified' sumario3.py
> for Igor and this should change the behaviour of his code, if he bothers to
> use it.)
>
> OldAl.
>
>>> 1. How to run the proposed plugin (after copying "sumario3.py  to
>>> ~/gramps/src/plugins/ directory)? CLI string?
>> register_report(
>>      name = 'sumario3',
>>      category = CATEGORY_VIEW,
>>
>> "CATEGORY_VIEW" does not exist on trunk
>> (moved to textual version or tools)
>> On gramps-3.0.3, you find them on Reports->View
>> http://www.gramps-project.org/wiki/index.php?title=Gramps_3.0_Wiki_Manual_-
>> _Reports#View
>>
>>> 2. Where is (if in the wiki, what URL?) information about making and
>>> running plugins? I looked at several, but none seems to give a simple,
>>> straight answer.
>> Maybe:
>> http://www.gramps-project.org/wiki/index.php?title=Report-writing_tutorial
>>
>> additionnal URLs :
>> http://www.gramps-project.org/wiki/index.php?title=Report_API
>> http://www.gramps-project.org/wiki/index.php?title=Third-party_Plugins
>> http://www.gramps-project.org/wiki/index.php?title=Using_database_API
>>
>>
>> Jérôme
>>
>



-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Reply | Threaded
Open this post in threaded view
|

Re: More concrete

jerome
> './configure' is because you get files from SVN.

sorry, I confused with autogen.sh ...
./configure is for configuring :-[


Jérôme a écrit :

> Algis,
>
>> 3.  ./configure
>> 4.  make
>
> This makes sense if you don't have an installed version.
> './configure' is because you get files from SVN.
> 'make' will activated const.py.in (generates const.py)
>
> Maybe just rename const.py.in to const.py will avoid to do :
> ./configure
> make
> (for testing new plugin)
>
>> How does ./configure and make know about the 'sumario3.py' file?
>
> Note: this commands are not related to 'sumario3.py', they just
> (activated|make active) Gramps for working.
>
>
> Jérôme
>
>
> Algis Kabaila a écrit :
>> Jérôme ,
>>
>> On Sun, 26 Oct 2008 22:22:59 Jérôme wrote:
>>
>> Sincere thank you for the trouble you have taken to reply to my questions.  I
>> confess that "./configure" and "make" are black boxes for me.  Bearing this
>> in mind, would you tell me if it Is  correct to assume that the procedure to
>> insert into gramps a plugin 'sumario3' is to:
>>
>> 1. Copy the plugin program into the ~/gramps30/src/plugins/
>> 2. Make ~/gramps30 the current directory
>> 3.  ./configure
>> 4.  make
>> 5. python src/gramps.py
>>
>> and that if this is  successful, the 'sumario3' will become accessible from
>> the gui?
>>
>> I will print out your email and paste it into my notes on Python and gramps.  
>> There is a lot of reading there!
>>
>> I am sending a copy of this to Benny - he is very helpful to people on this
>> list and his reply to Igor if of interest to me. I would like to replicate
>> your error message, Benny.  I might just take a punt and try the above
>> procedure, though I hate the "blind" trial with black boxes... How
>> does ./configure and make know about the 'sumario3.py' file?
>>
>> Thank you again, Jérôme; thank you Benny (BTW, I have 'detabified' sumario3.py
>> for Igor and this should change the behaviour of his code, if he bothers to
>> use it.)
>>
>> OldAl.
>>
>>>> 1. How to run the proposed plugin (after copying "sumario3.py  to
>>>> ~/gramps/src/plugins/ directory)? CLI string?
>>> register_report(
>>>      name = 'sumario3',
>>>      category = CATEGORY_VIEW,
>>>
>>> "CATEGORY_VIEW" does not exist on trunk
>>> (moved to textual version or tools)
>>> On gramps-3.0.3, you find them on Reports->View
>>> http://www.gramps-project.org/wiki/index.php?title=Gramps_3.0_Wiki_Manual_-
>>> _Reports#View
>>>
>>>> 2. Where is (if in the wiki, what URL?) information about making and
>>>> running plugins? I looked at several, but none seems to give a simple,
>>>> straight answer.
>>> Maybe:
>>> http://www.gramps-project.org/wiki/index.php?title=Report-writing_tutorial
>>>
>>> additionnal URLs :
>>> http://www.gramps-project.org/wiki/index.php?title=Report_API
>>> http://www.gramps-project.org/wiki/index.php?title=Third-party_Plugins
>>> http://www.gramps-project.org/wiki/index.php?title=Using_database_API
>>>
>>>
>>> Jérôme
>>>
>
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Gramps-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gramps-devel



-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Reply | Threaded
Open this post in threaded view
|

Re: More concrete

OldAl
In reply to this post by Benny Malengier
Benny,

On Mon, 27 Oct 2008 07:34:34 Benny Malengier wrote:

After summoning my courage, downloaded into ~/gramps30 directory r11199 of
gramps and copied the "detabified" version of sumario3.py to
~/gramps30/src/plugins directory.

Then executed:
cd ~/gramps30
./autogen.sh
./make
python src/gramps.py

to run the newly compiled script.

To my amazement, gramps runs OK. Help > About shows that is is

Gramps 3.0.4-0.SVN11199

On Report > View menu item, it shows, to my utter amazement, an
item "probando3", which is put there by sumario3.py.  So the plugin is truly,
really inserted into gramps, including its GUI.  I am indeed impressed!

Of course, the plugin does not work and activates the error report wizard with
the following result:

23834: ERROR: gramps.py: line 160: Unhandled exception
Traceback (most recent call last):
  File "/home/ak/gramps30/src/ViewManager.py", line 1480, in <lambda>
    lst[0], lst[1], lst[2], lst[3], lst[4], lst[5])
  File "/home/ak/gramps30/src/ReportBase/_ReportDialog.py", line 293, in
report
    report_class(dbstate,uistate)
  File "/home/ak/gramps30/src/plugins/sumario3.py", line 128, in __init__
    text = build_report(database)
  File "/home/ak/gramps30/src/plugins/sumario3.py", line 95, in build_report
    nombre = persona.get_primary_name()
AttributeError: 'NoneType' object has no attribute 'get_primary_name'

It is the same (except for some line number changes, that are the result of
some blank line deletion by me) as your result that you have nicely explained
in your earlier email.  So your diagnosis is independently confirmed.

I wonder if it were not advantageous to newbees to this project if there was a
summry of  the steps to activate a plugin?  I would be happy to insert it
somewhere in an appropriate place.  Would you comment, please.

It came as a plesant surprise to me that the gramps gui did pick up the new
experimental plugin and so did autogen.sh. And make.  I am impressed!

I would like some clarification on the authorship of an extension of a
program, where the original version was authored by another person and
licensed under GPL.  

The sumario3.py is an attempt to modify the summary.py that is marked as
authored by Donald N. Allingham.  You suggest that that should be marked as
authored by Igor.  Hm, that does not sound really reasonable to me,
particularly when the alterations are mainly of a tutorial nature.  If it was
developed into something major,  my gut instinct would be to continue  to use
the original author as the holder of the copyright with a note that
alterations have been made which should not be attributed to the original
author, particularly if the correctness of the alterations are in doubt.

I feel that it would not be ethical to simply replace the name of the original
author by the name of a person that made the alterations.

If the alteration is such that the perinent part of program is more or less
new, then IMHO the original author should still be stated as -- the original
author.  It would then be reasonable to claim the co-authorship, I guess.

How do you or  others experts of Open Source Software development  would treat
the question of authorship?  Is it a "hot potato"?

Thank you for your input and I hope that Igor is not unduly depressed about
Python and gramps.  Python is great and so is gramps!

Al.

> 2008/10/25 Igor Sosa Mayor <[hidden email]>
>
> > Sorry,
> >
> > I want to be more concrete:
> >
> > why am I getting an error in line 97 of the attached file AND NOT in line
> > 85?
> >
> > The error is:
> >
> > File "/home/igorxus/.gramps/plugins/sumario3.py", line 97, in
> > build_report nombre = persona.get_primary_name()
> > AttributeError: 'NoneType' object has no attribute 'get_primary_name'
> >
> > BUT:
> > As far as I see, what I do in line 85 is THE SAME. Why error in one case
> > and
> > not in the other?
> >
> > Thanks in advance
>
> Mail with other subject.
> So the first error was the wrong intendation.
> The next error is that you obtain list of child references, but threat them
> as handles. A childref however contains a handle and some extra info like
> the relation to the parent (birth, ... ).
>
> So the code there should be:
>          for child_ref in descendencia:
>                  persona = database.get_person_from_handle(child_ref.ref)
>                  nombre = persona.get_primary_name()
>
> In this, child_ref.ref is the handle to the child this child_ref points to
>
> Some other notes:
>
> 1/ the copyright here is you, so put at the top:
>
> # Copyright (C) 2008 Igor Sosa Mayor
>
> The fact that you use the API other people have written does not mean you
> have to take the copyright over
>
> 2/ at the bottom, change everything, and don't keep same names of classes
> as in other places, so eg
>
> register_report(
>     name = 'sumario3',
>     category = CATEGORY_VIEW,
>     report_class = SumarioReport,
>     options_class = None,
>     modes = MODE_GUI,
>     translated_name = _("MySummary"),
>     status = _("Unstable"),
>     description= ("Provides a summary of the current database"),
>     author_name="Igor Sosa",
>     author_email="[hidden email]",
>     require_active=False
>     )
>
> Note that the class is now SumarioReport, and you should put YOUR email
> there, and the translated name is the english. The function _(...) will do
> the translation to spanish. If you add new strings, and want immediately
> things in Spanish, you can change the po/es.po file, see translation
> section of the wiki.
>
> About your intentions, I think it a great idea to use GRAMPS in resource.
> Any changes you do can be contributed to the project and don't get lost.
>
> Benny

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Reply | Threaded
Open this post in threaded view
|

Re: More concrete

OldAl
In reply to this post by jerome
On Mon, 27 Oct 2008 17:22:03 Jérôme wrote:
>
> sorry, I confused with autogen.sh ...
> ./configure is for configuring :-[
>
My fault - I did mixum the ./configure and ./autogen.sh.

Thank you for your reply.  As far as I am concerned, I am happy with the
outcome, thanks to people like you!

Al.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Reply | Threaded
Open this post in threaded view
|

Re: More concrete

Benny Malengier
In reply to this post by OldAl


2008/10/27 Algis Kabaila <[hidden email]>
<snip>
On Report > View menu item, it shows, to my utter amazement, an
item "probando3", which is put there by sumario3.py.  So the plugin is truly,
really inserted into gramps, including its GUI.  I am indeed impressed!

Gramps goes over all .py files in the plugin directory, and tries to load them as plugin. The presence of register_report at the bottom of plugin files takes care of this.

 

Of course, the plugin does not work and activates the error report wizard with
the following result:

23834: ERROR: gramps.py: line 160: Unhandled exception
Traceback (most recent call last):
 File "/home/ak/gramps30/src/ViewManager.py", line 1480, in <lambda>
   lst[0], lst[1], lst[2], lst[3], lst[4], lst[5])
 File "/home/ak/gramps30/src/ReportBase/_ReportDialog.py", line 293, in
report
   report_class(dbstate,uistate)
 File "/home/ak/gramps30/src/plugins/sumario3.py", line 128, in __init__
   text = build_report(database)
 File "/home/ak/gramps30/src/plugins/sumario3.py", line 95, in build_report
   nombre = persona.get_primary_name()
AttributeError: 'NoneType' object has no attribute 'get_primary_name'

Yes, the solution was in my other mail, it must be child_ref.ref to obtain person
 
I would like some clarification on the authorship of an extension of a
program, where the original version was authored by another person and
licensed under GPL.

License is difficult. First, it is GPL v2, and if that copyright of Don is there or not, it remains GPL v2. You only need to know who is the copyright holder if you want to change the licence or relicence.
If you want to do that, you need to contact all copyright holders. The Copyright statement helps in that, but is in no way proof of the fact.
About sumario.py, it is indeed almost a copy of Summery.py, copyright Don, but in essence it just uses the database API and plugin API, and creates output in a unique way. Everyone is allowed to use the database API and plugin API, there is no need to repeat the copyright of that as the plugin only has value when linked to those (and hence must be same license as those as it links to them). For the unique thing of Summery.py, summario does something different (build_report function is the only thing that is not the default calling sequence of plugins), so yeah, in my eyes it suffices to put copyright of only Igor person at the top.
 
I feel that it would not be ethical to simply replace the name of the original
author by the name of a person that made the alterations.

As said, it is a new report, the corresponding calling sequence of reports and database is everywhere the same
 
If the alteration is such that the perinent part of program is more or less
new, then IMHO the original author should still be stated as -- the original
author.  It would then be reasonable to claim the co-authorship, I guess.

Authorship goes with SVN commit statements. If copyright is wrong at the top of the file, it does not mean that it has legal standing nevertheless. It is just a starting place to find the original authors.
 
How do you or  others experts of Open Source Software development  would treat
the question of authorship?  Is it a "hot potato"?

You put copyright to yourself and to who you think deserves it when you derive work. However, obvious things don't count in my view, and API calls are covered by the copyright stated  in the files you import.

Benny

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel