Python back-end for Mantis

General discussion of Mantis.

Moderators: Developer, Contributor

Post Reply
lauploix
Posts: 4
Joined: 15 Mar 2006, 22:22

Python back-end for Mantis

Post by lauploix »

I created a python back-end for my Mantis database (currently 0.19).
It is still in alpha but it works to read values from database.

It gives you the ability to query and navigate the database quite easily.

me = User.byUsername ("ploix")
me.monitored --> gives you the list of bugs you monitor
me.handled --> gives you the list of bugs you handle

[b for b in me.submitted if b.priorityText == "Urgent"] --> gives you the list of bug you submitted and have the right priority

and so on... it enables the writting of very precise and concise filters

Is anyone interested ?

(no troll please, but it also open the possibility of a TurboGears front-end for Mantis...)
vboctor
Site Admin
Posts: 1293
Joined: 13 Feb 2005, 22:11
Location: Redmond, Washington
Contact:

Post by vboctor »

I've no idea about Python, but what you are mentioning sounds interesting. It seems to be a powerful tool.

See MantisConnect to see my stable at the problem. MantisConnect allows for remote connection to a Mantis installation and from any language that supports webservices.

Regards,
Victor
Mantis to Go?
http://www.futureware.biz/mantisconnect
lauploix
Posts: 4
Joined: 15 Mar 2006, 22:22

Post by lauploix »

Ok.

When we have upgraded to Mantis 1.0, I update the Python back-end and post it with samples.

BTW, I used SQLObject to map the Mantis mySQL database, and I had some difficulties, due to limitations of the SQLObject framework. For sure, it is possible to have the work done anyway, but you sometimes need to used plain SQL where you would like to use a simple DB mapping.

I have (talking about the 0.19 version of the database schema that I have)

- No Pb with "value" tables (user, bug, project, ...)
- No pb with relations tables (bug_monitor, ...)
- But.... pb with tables that are relations AND contain value (project_user_list, custom_field_project)

The pb is : SQLOBject needs to have and ID column (or equivalent) in any table that has a "value" (and not only external keys).

If it where possible to add an 'ID' column to tables that are mainly relations, but also have values, that would be :
- Useless for Mantis itself
- ...but sooooo useful for object-relational mappings

Laurent
vboctor
Site Admin
Posts: 1293
Joined: 13 Feb 2005, 22:11
Location: Redmond, Washington
Contact:

Post by vboctor »

Please add a feature request in the bugtracker (http://bugs.mantisbt.org).

Regards,
Victor
lauploix
Posts: 4
Joined: 15 Mar 2006, 22:22

Post by lauploix »

Your MantisConnect tool is clearly superior to the tool I wrote, because it provides the security, for instance. My tool does not. And it provides a write access that my tool does not provide (yet).

We are in pre-alpha on Mantis 1.0.2. Post will be done when it has been fully tested.
lauploix
Posts: 4
Joined: 15 Mar 2006, 22:22

Post by lauploix »

Ok, here is what I have :

Examples on how to use my python back-end :

>>> usr = User.byUsername ('test')
>>> usr.username
'test'
>>> me = User.byUsername ('ploix')
>>> #list of reported bugs
>>> len (list (me.reported))
905
>>>#50th reported bug : what is the project name ?
>>> me.reported [50].project.name
'XXXXXX' (anonymized)
>>> #list of number of notes for all the bugs I'm in charge of :
>>> [len (list (b.bugNotes)) for b in me.handled]
[0, 7, 16, 7, 4, 3, 4, 3, 2, 2, 1, 0, 1, 0, 10, 11, 38, 0, 0, 1, 0, 0, 2, 8, 3, 0, 0, 6, 5, 1, 0, 0, 9, 6, 4, 3, 1, 3, 0
, 4, 6, 14, 0, 0, 0, 1, 6, 1, 6, 1, 7, 9, 4, 20, 1, 0, 6, 4, 8, 9, 9, 4, 6, 11, 26, 7, 6, 1, 1, 2, 1, 2, 11, 1, 1, 1, 1,
1, 0, 1, 9, 3, 2, 6, 6, 6, 1, 9, 25, 12, 1, 2, 4, 3, 3, 5, 2, 3, 19, 8, 3, 0, 18, 13, 6, 6, 4, 2, 11, 3, 2, 5, 16, 12,
2, 1, 23, 12, 3, 12, 29, 2, 5, 10, 1, 2, 21, 2, 5, 6, 19, 6, 1, 2, 1, 0, 0, 3, 3, 6, 1, 4, 2, 5, 15, 3, 3, 4, 6, 10, 6,
1, 1, 1, 0, 2, 1, 1, 0, 1, 0, 2, 2, 2, 0, 2, 1, 2, 0, 1, 1, 1, 2, 4, 1, 4, 1, 1, 1, 1, 3, 3, 4, 7, 10, 3, 1, 1, 3, 1, 2,
1, 1, 1, 1, 5, 5, 7, 230, 7, 15, 3, 6, 0, 0, 1, 0, 0, 5, 0, 1, 3, 2, 7, 1, 0, 0, 1, 2, 0, 1, 2, 4, 0, 13, 9, 3, 0, 0, 1
, 1, 2, 0, 4, 1, 3, 0, 0, 0, 2, 0, 2, 1, 1, 1, 8, 1, 12, 12, 6, 15, 2, 5, 14, 1, 7, 8, 4, 5, 0, 5, 3, 4, 6, 21, 2, 2, 5,
11, 1, 3, 7, 6, 1, 4, 10, 2, 8, 5, 2, 6, 7, 3, 1, 1, 5, 4, 3, 2, 2, 5, 2, 8, 2, 3, 1, 0, 5, 10, 3, 10, 5, 14, 6, 2, 3,
8, 5, 13, 3, 4, 4, 3, 11, 2, 1, 1, 1, 8, 11, 0, 5, 4, 6, 19, 5, 1, 12, 7, 6, 2, 2, 7, 3, 0, 6, 10, 1, 11, 0, 0, 0, 0, 0,
1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 2, 4, 4, 2, 0, 1, 0, 1, 0, 1, 3, 1, 1, 1, 5, 4,
13, 0, 7, 1, 0, 16, 1, 1, 3, 3, 13, 2, 5, 15, 7, 3, 20, 2, 9, 1, 0, 0, 1, 4, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0,
0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 5, 17, 0, 2, 9, 0, 3, 0, 0, 0, 0, 0, 0, 0, 18, 0, 7, 5, 2, 0, 0, 0, 0, 0, 1, 3, 1, 2, 4, 9, 0, 2, 1, 18, 2, 0, 0,
0, 4, 2, 6, 0, 3, 7, 7, 0, 0]
>>>#there is one manager for the project of the 50th bug I reported :
>>> len (list (me.reported [50].project.managers))
1
>>>#first bug note of the bug :
>>> me.reported [50].bugNotes [1].text
'Ca marche.'

...and so on.

any interest ?
webwesen
Posts: 27
Joined: 09 Aug 2005, 20:44

Post by webwesen »

interest is here...
where is your code? :)
Post Reply