Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

old stumpy urls #14

Closed
mutaku opened this issue Apr 4, 2011 · 1 comment
Closed

old stumpy urls #14

mutaku opened this issue Apr 4, 2011 · 1 comment

Comments

@mutaku
Copy link
Owner

mutaku commented Apr 4, 2011

should we dump in the old urls?

all we would have to do us drop the table (when ready), then take the old database and for each row grab the full url and use urllib to do a "/url/FULLURL" kind of thing for each and since the shortened url is made off the auto_incrementing id column for each insert, they should match up.
Once they are verified to match, we can backup old database and take it down.

@mutaku
Copy link
Owner Author

mutaku commented Apr 5, 2011

some caveats: #18

Also, the old database started with id=18 so if we import we are off by 18 in id and thus creating the shorturl (via base62 of id). So one way would be to input 17 urls, then instead of dropping table, just delete from shortener_stumps where 1=1; then mass import with:
sql = 'select id,longurl,shorturl from urls' cursor.execute(sql) for row in cursor: url = 'http://192.168.11.4/url/'+urllib.quote_plus(row[0]) f = urllib.urlopen(url) f.read()

ALSO
some of the early urls had self domain in them which we now reject. So we might want to skip ahead (e.g. starting at 25 on our new db and skipping first 7 on the old if the first 7 were test ones). Have to temporarily disable the netloc check in the submit view.

ALSO
we can even include the old visits count since:
hits = models.PositiveIntegerField("Number of visits",default=1,editable=False)
we can just figure out a way to send in the hits on teh command line somehow via url liek maybe appending &stumpyhits=HITS to each url then in the submit view use urlparse to strip off $stumpyhits=HITS and get value of HITS and use that to feed into the hits column. nifty i know

@mutaku mutaku closed this as completed Apr 28, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant