FarMcKon / gitmarks_2

Gitmarks 2.0. is a peer to peer bookmarking tool.
http://farmckon.github.com/gitmarks_2
271 stars 31 forks source link

Delicious import / add not UTF-8 safe #27

Open j4n opened 13 years ago

j4n commented 13 years ago

When importing from delicious, the gitmark_add.py script chokes on an UTF-8 character (µ) in a tag:

    adding mark None to repo False
    {
        "extended": "", 
        "hash": "....", 
        "description": "micro-OSC | CNMAT", 
        "rights": null, 
        "creator": "delicious:user", 
        "uri": "http://cnmat.berkeley.edu/research/uosc", 
        "private": false, 
        "meta": "....", 
        "time": "2009-02-23T00:07:07Z", 
        "tags": [
            "osc", 
            "\u00b5c", 
            "tm", 
            "pic"
        ]
    }
    osc
    [u'osc']
    µc
    [u'osc', u'\xb5c']
    tm
    [u'osc', u'\xb5c', u'tm']
    pic
    [u'osc', u'\xb5c', u'tm', u'pic']
    tags filename/Users/ja/Documents/gitmarks/public/tags/osc
    tags filename/Users/ja/Documents/gitmarks/public/tags/tm
    tags filename/Users/ja/Documents/gitmarks/public/tags/pic
    Traceback (most recent call last):
      File "./delicious_import.py", line 158, in <module>
        import_delicious_to_local_git(username, password)
      File "./delicious_import.py", line 108, in import_delicious_to_local_git
        err = addToRepo(mark,doPush=False)
      File ".../gitmarks_2/gitmark_add.py", line 107, in addToRepo
        return addToPublicRepo(gitmarksObj, doPush)
      File ".../gitmarks_2/gitmark_add.py", line 159, in addToPublicRepo
        print 'tags filename' + str(filename)
hugoroy commented 12 years ago

Don't know what the issue is exactly but maybe it's related. Running the delcious import got me all kinds of new gitmarks!! we have 1000 new marks adding mark None to repo True Traceback (most recent call last): File "delicious_import.py", line 158, in import_delicious_to_local_git(username, password) File "delicious_import.py", line 108, in import_delicious_to_local_git err = addToRepo(mark,doPush=False) File "/home/hrd/.git/gitmarks_2/gitmark_add.py", line 108, in addToRepo print "adding mark %d to private repo" %str(gitmarkObj) NameError: global name 'gitmarkObj' is not defined

FarMcKon commented 12 years ago

Yes, I have seen that before, I spent about an hour on different solutions, but none of them worked. :(

Recently I read this post, whcih might be the right solution:

http://lucumr.pocoo.org/2012/8/11/codec-confusion/

Work is a bit crazy now, so for the moment I don't have time to test that fix myself :(

On 8/13/12 10:46 AM, Hugo Roy wrote:

Don't know what the issue is exactly but maybe it's related. Running the delcious import got me all kinds of new gitmarks!! we have 1000 new marks adding mark None to repo True Traceback (most recent call last): File "delicious_import.py", line 158, in import_delicious_to_local_git(username, password) File "delicious_import.py", line 108, in import_delicious_to_local_git err = addToRepo(mark,doPush=False) File "/home/hrd/.git/gitmarks_2/gitmark_add.py", line 108, in addToRepo print "adding mark %d to private repo" %str(gitmarkObj) NameError: global name 'gitmarkObj' is not defined

— Reply to this email directly or view it on GitHub https://github.com/FarMcKon/gitmarks_2/issues/27#issuecomment-7693815.

hugoroy commented 12 years ago

That's alright. Take your time

FarMcKon commented 12 years ago

just dropped some code update to the delicious plugin, fyi.