#4200 Evaluate scripts/trac_export.py

v1.0.0
closed
nobody
import (116)
Tracker
nobody
2015-08-20
2012-05-14
No

Originally owned by: barrywhart

Familiarize yourself with scripts/trac_export.py You don't necessarily need to be able to run it successfully, but try. See if it still works. Most importantly, determine what it would take to add support for private tickets (e.g. passing a real user session through urlopen cookies?). We will need to support that, but I am inclined towards a different trac import implementation that uses a database dump to get all the data.

Discussion

  • Anonymous - 2012-05-15

    Originally by: barrywhart

    The --start option assumes all tickets are visible in the downloaded CSV. With private tickets, this won't be true, so it'll need a more sophisticated way of finding the first ticket (e.g. sequential or binary search by visiting different result sets).

    This tells how to send cookies using urlopen.
    http://stackoverflow.com/questions/3334809/python-urllib2-how-to-send-cookie-with-urlopen-request

    I assume more info is needed, so the next steps in my research are:
    - Enable Trac authentication on my local Trac instance
    - Also enable private tickets
    - Figure out how to log in to Trac programmatically using urllib2.urlopen or similar method.

     
  • Dave Brondsema

    Dave Brondsema - 2012-05-15

    The Trac instances that we will be targeting will be "hosted apps" which are part of SourceForge. I can set you up with access to one for testing.

    Authentication is done through SourceForge logins, so it'll be different than standard Trac auth.

    Private tickets are implemented with the PrivateTickets plugin, which is under a "policy" label. Not sure what the "policy" term refers to in the context of trac plugins, but probably doesn't really matter.

    • status: open --> in-progress
     
  • Dave Brondsema

    Dave Brondsema - 2012-05-15
    • assigned_to: Barry Hart
     
  • Anonymous - 2012-05-15

    Originally by: barrywhart

    Thanks, Dave. "Policy" is a term often used regarding security. Most other plugins probably add visible features, while security takes things away. :-) Let me know when that Trac instance is available and I'll look into logging into it from Python.

     
  • Anonymous - 2012-05-15

    Originally by: barrywhart

    Dave, What application invokes trac_export.py? I don't see any code in Allura which invokes it. If Allura (or whatever the invoking application is) has access to a SourceForge session cookie, and if same session cookie is valid for accessing Trac, then it should be easy to pass that cookie to trac_export.py and along to Trac. The stackoverflow.com link above tells how to do this.

    I (or someone) can test this by logging into SourceForge, using Firebug or a similar tool to get the session cookie, then passing that cookie through urlopen() to the test Trac instance. This will probably take an hour or less.

     
  • Dave Brondsema

    Dave Brondsema - 2012-05-17

    I don't think re-using this script is going to be the most efficient, since there are several changes we need to make (auth for private tickets, getting settings, getting wiki pages) plus it has the overhead of APIs for both reading & writing. It'll be better to read from a database and write directly through the Allura models.

    For completeness, I have a new trac instance available, but private tickets isn't enabled. And trac_export.py would be run from the commandline. I expect as paster production.ini script ../scripts/trac_export.py

     
  • Dave Brondsema

    Dave Brondsema - 2012-05-17
    • status: in-progress --> closed
    • milestone: forge-backlog --> forge-may-18
     

Log in to post a comment.