2 # -*- conding: utf-8 -*-
4 __date__ ="$2009-09-08 14:31:26$"
6 from django.core.management.base import NoArgsCommand
8 # from optparse import make_option
10 class Command(NoArgsCommand):
12 def handle(self, *args, **options):
14 if not options['username'] or not options['password']:
15 raise CommandError("You must provide login data")
17 client.login(username=options['username'], \
18 password=options['password'])
20 print options['username'], options['password']
24 url = reverse("document_view", args=[docid])
25 print "Quering %s" % url
26 resp = client.get(url)
28 result = json.loads(resp.content)
31 print "Current revision for '%s': %s" % (docid, result['user_revision'])
32 url = reverse("docmerge_view", args=[docid])
33 print "Sending POST to %s" % url
34 resp = client.post(url, {
36 'target_revision': result['user_revision'],
37 'message': 'Sharing.. :)'
40 print resp.status_code, resp.content