Permalink
Browse files

removing hard-coded url prefixes

  • Loading branch information...
1 parent 0ffa3f3 commit 36b6f6f9bfe32e1f8d22e5b6ae6712c2d42e69ab @trey0 trey0 committed Apr 5, 2012
@@ -23,7 +23,7 @@
var new_message_count = {{ user.profile.getUnreadMessageCount }};
var updateFunction = function() {
- var url = '{% url talk_message_list_all_json %}';
+ var url = '{% url geocamTalk_message_list_all_json %}';
url += '?since=' + running_timestamp;
$.getJSON(url, function(data) {
@@ -36,7 +36,7 @@
var authorUsername = msg['authorUsername'];
var authorFullname = msg['authorFullname'];
{% if recipient %}
- authorFullname = '<a href="{% url talk_message_list_to recipient.username %}/' +authorUsername+ '">' +authorFullname+ '</a>' ;
+ authorFullname = '<a href="{% url geocamTalk_message_list_to recipient.username %}/' +authorUsername+ '">' +authorFullname+ '</a>' ;
{% endif %}
var msgDate = new Date (msg['contentTimestamp']);
@@ -66,7 +66,7 @@
&& $('div[data-role="page"]').find('#clear_link').length == 0) {
var link = $('<a href="#" id="clear_link" data-role="button" data-inline="true" data-theme="c" class="ui-btn ui-btn-inline ui-btn-corner-all ui-shadow ui-btn-up-c"><span class="ui-btn-inner ui-btn-corner-all"><span class="ui-btn-text">Clear Received Messages</span></span></a>');
link.click(function() {
- $.get('{% url talk_clear_messages %}', function(data) {
+ $.get('{% url geocamTalk_clear_messages %}', function(data) {
$('div[data-role="page"]').each(function() {
$(this).find('#clear_link').remove();
$(this).find('#new_message_count').html(0);
@@ -93,19 +93,19 @@
<header>
<div data-role="header">
<h1>{% block pagetitle %}GeoCam Talk{% endblock %}</h1>
- <a href="/talk/messages" data-icon="home" data-iconpos="notext" data-direction="reverse" class="ui-btn-right jqm-home">Home</a>
+ <a href="{% url geocamTalk_message_list_all %}" data-icon="home" data-iconpos="notext" data-direction="reverse" class="ui-btn-right jqm-home">Home</a>
<div data-role="navbar">
<ul id="bigsigh">
- <li><a id="my_messages_link" href="{% url talk_message_list_to user.username %}">My Messages (<span id="new_message_count">{{user.profile.getUnreadMessageCount}}</span>)</a></li>
- <li><a href="{% url talk_message_list_all %}">All Messages</a></li>
- <li><a href="{% url talk_message_map %}">Talk Map</a></li>
+ <li><a id="my_messages_link" href="{% url geocamTalk_message_list_to user.username %}">My Messages (<span id="new_message_count">{{user.profile.getUnreadMessageCount}}</span>)</a></li>
+ <li><a href="{% url geocamTalk_message_list_all %}">All Messages</a></li>
+ <li><a href="{% url geocamTalk_message_map %}">Talk Map</a></li>
</ul>
</div>
</div>
</header>
<content>
<div data-role="content">
- <a id="new_message_link" href="{% url talk_create_message %}" data-role="button" data-inline="true">New Message</a>
+ <a id="new_message_link" href="{% url geocamTalk_create_message %}" data-role="button" data-inline="true">New Message</a>
{% block content %}
{% endblock %}
</div>
@@ -33,7 +33,7 @@
$(messages).each(function(i, msg) {
google.maps.event.addListener(msg.marker,"click", function() {
infoWindow.close();
- $.getJSON("talk/messages/details/" + msg.pk + ".json", function(data) {
+ $.getJSON("{% url geocamTalk_message_list_all %}/details/" + msg.pk + ".json", function(data) {
var messageHtml = "<strong>" + data['authorFullname'] + "</strong><br />"
+ "<span>" + data['contentTimestamp'] + "</span>"
+ "<p>" + data['content'] + "</p>"
@@ -52,4 +52,4 @@
{% block content %}
<section id="map_canvas" style="width: 320px; height: 400px">
</section>
-{% endblock %}
+{% endblock %}
@@ -74,7 +74,7 @@
<p><div id='status'></div></p>
<p>Current time: <div id='time'></div></p>
-<form action="/talk/messages/create/" method="post">
+<form action="{% url geocamTalk_create_message %}" method="post">
{% csrf_token %}
<table>
<tr>
@@ -91,4 +91,4 @@
<input type="submit" value="Send Message" />
</form>
-{% endblock %}
+{% endblock %}
@@ -36,18 +36,18 @@ def testEnsureMyMessageListAuthorLinksPresent(self):
#assert
for _ in recipient_messages:
- link_to_recipient_msgs_from_author = 'href="/talk/messages/%s/%s"' % (recipient.username, author.username)
+ link_to_recipient_msgs_from_author = 'href="FIXME/messages/%s/%s"' % (recipient.username, author.username)
#print 'didnt find %s in %s' % (link_to_recipient_msgs_from_author, response)
self.assertContains(response, link_to_recipient_msgs_from_author)
def get_recipient_messages_response_filtered_by_author(self, recipient, author):
self.client.login(username=recipient.username, password='geocam')
- response = self.client.get('/talk/messages/%s/%s' % (recipient.username, author.username))
+ response = self.client.get('FIXME/messages/%s/%s' % (recipient.username, author.username))
return response
def get_recipient_messages_response(self, recipient):
self.client.login(username=recipient.username, password='geocam')
- response = self.client.get('/talk/messages/' + recipient.username)
+ response = self.client.get('FIXME/messages/' + recipient.username)
return response
def testMessageListAudioPresent(self):
@@ -18,7 +18,7 @@ class GeocamTestUrls(TestCase):
def testMessageListUrl(self):
#arrange
- path = "/talk/messages/"
+ path = "FIXME/messages/"
template = "geocamTalk/message_list.html"
#act
@@ -27,15 +27,15 @@ def testMessageListUrl(self):
def testMyMessageListUrl(self):
me = User.objects.all()[0]
#arrange
- path = "/talk/messages/%s" % me.username
+ path = "FIXME/messages/%s" % me.username
template = "geocamTalk/message_list.html"
#act
self.assertPathRequiresLoginAndUsesTemplate(path, template)
def testMessageCreateJSONFeed(self):
#arrange
- path = "/talk/messages/create.json"
+ path = "FIXME/messages/create.json"
#act
guestResponse = self.client.post(path, {})
@@ -46,7 +46,7 @@ def testMessageCreateJSONFeed(self):
def testMessageJsonUrl(self):
#arrange
pk = str(TalkMessage.objects.all()[0].pk)
- path = "/talk/messages/details/" + pk + ".json"
+ path = "FIXME/messages/details/" + pk + ".json"
self.login()
#act
@@ -58,7 +58,7 @@ def testMessageJsonUrl(self):
def testClearMyMessageCount(self):
#arrange
_me = User.objects.all()[0]
- path = "/talk/messages/clear"
+ path = "FIXME/messages/clear"
self.login()
#act
@@ -69,15 +69,15 @@ def testClearMyMessageCount(self):
def testMessageCreateUrl(self):
#arrange
- path = "/talk/messages/create"
+ path = "FIXME/messages/create"
template = "geocamTalk/message_form.html"
#act
self.assertPathRequiresLoginAndUsesTemplate(path, template)
def testMessageJSONFeedUrl(self):
#arrange
- path = "/talk/messages.json"
+ path = "FIXME/messages.json"
#act
guestResponse = self.getResponse(path)
@@ -91,7 +91,7 @@ def testMessageJSONFeedUrl(self):
def testMyMessageJSONFeedUrl(self):
#arrange
me = User.objects.all()[0]
- path = "/talk/messages/%s.json" % me.username
+ path = "FIXME/messages/%s.json" % me.username
#act
guestResponse = self.getResponse(path)
@@ -118,8 +118,8 @@ def testMessageListFilteredByUserUrl(self):
recipient = User.objects.all()[2]
#arrange
- # url design is /talk/messages/<recipient username>/<author username>
- path = "/talk/messages/%s/%s" % (recipient.username, author.username)
+ # url design is FIXME/messages/<recipient username>/<author username>
+ path = "FIXME/messages/%s/%s" % (recipient.username, author.username)
template = "geocamTalk/message_list.html"
#act
@@ -71,7 +71,7 @@ def test_submitFormToCreateMessage(self):
author = User.objects.get(username="rhornsby")
self.client.login(username=author.username, password='geocam')
- response = self.client.post(reverse("talk_create_message"),
+ response = self.client.post(reverse("geocamTalk_create_message"),
data={"content": content,
"latitude": GeocamTalkMessageSaveTest.cmusv_lat,
"longitude": GeocamTalkMessageSaveTest.cmusv_lon,
@@ -92,7 +92,7 @@ def test_submitFormToCreateMessageWithRecipients(self):
recipienta = User.objects.all()[1]
recipientb = User.objects.all()[2]
- response = self.client.post(reverse("talk_create_message"),
+ response = self.client.post(reverse("geocamTalk_create_message"),
data={"content": content,
"latitude": GeocamTalkMessageSaveTest.cmusv_lat,
"longitude": GeocamTalkMessageSaveTest.cmusv_lon,
@@ -112,7 +112,7 @@ def test_submitFormToCreateMessageJSON(self):
timestamp = self.now
author = User.objects.get(username="rhornsby")
self.client.login(username=author.username, password='geocam')
- response = self.client.post(reverse("talk_create_message_json"),
+ response = self.client.post(reverse("geocamTalk_create_message_json"),
data={"message": json.dumps({
"content": content,
"contentTimestamp": time.mktime(timestamp.timetuple()),
@@ -137,7 +137,7 @@ def testAudioMsgCreate(self):
testAudioFile = 'media/geocamTalk/test/%s/%s/%s/test.mp4' % (year, month, day)
self._createFile(filename=testAudioFile, filesize=100 * 1024)
f = open(testAudioFile, "rb")
- response = self.client.post(reverse("talk_create_message_json"),
+ response = self.client.post(reverse("geocamTalk_create_message_json"),
data={'audio': f,
"message": json.dumps({
"content": content,
@@ -198,7 +198,7 @@ def test_submitFormWithoutContentTalkMessage(self):
author = User.objects.get(username="rhornsby")
self.client.login(username=author.username, password='geocam')
- response = self.client.post(reverse("talk_create_message"),
+ response = self.client.post(reverse("geocamTalk_create_message"),
data={"latitude": GeocamTalkMessageSaveTest.cmusv_lat,
"longitude": GeocamTalkMessageSaveTest.cmusv_lon,
"author": author.pk})
@@ -215,7 +215,7 @@ def test_MessageJsonFeed(self):
self.client.login(username=msg.author.username, password='geocam')
# act
- response = self.client.get(reverse("talk_message_details_json", args=[msg.pk]))
+ response = self.client.get(reverse("geocamTalk_message_details_json", args=[msg.pk]))
# assert
self.assertContains(response, stringified_msg)
@@ -285,7 +285,7 @@ def test_NewMessageCountJsonFeed(self):
msg.recipients.add(recipient)
msg.recipients.add(User.objects.all()[2])
msg.save()
- response = self.client.get(reverse("talk_message_list_author_json", args=[author.username])
+ response = self.client.get(reverse("geocamTalk_message_list_author_json", args=[author.username])
+ '?since=%s' % before_new_message)
self.assertContains(response, '"msgCnt": 1')
# I dont want to delete this because I wasted a bunch of time on it:
@@ -297,7 +297,7 @@ def test_MessageJsonFeed2(self):
self.client.login(username=author.username, password='geocam')
ordered_messages = TalkMessage.objects.all().order_by('-pk')
messageid = ordered_messages[0].pk - 1
- response = self.client.get(reverse("talk_message_list_all_json") + '?since=%s' % messageid)
+ response = self.client.get(reverse("geocamTalk_message_list_all_json") + '?since=%s' % messageid)
self.assertContains(response, '"messageId": %s' % ordered_messages[0].pk)
self.assertContains(response, '"authorUsername": "%s"' % ordered_messages[0].author.username)
self.assertContains(response, '"authorFullname": "%s"' % ordered_messages[0].get_author_string())
@@ -322,7 +322,8 @@ def test_MyMessageJsonFeed(self):
ordered_messages = TalkMessage.getMessages(recipient=author).order_by("-pk")
messageid = ordered_messages[0].pk - 1
- response = self.client.get(reverse("talk_message_list_author_json", args=[author.username])
+ response = self.client.get(reverse("geocamTalk_message_list_author_json",
+ args=[author.username])
+ '?since=%s' % messageid)
self.assertContains(response, '"messageId": %s' % ordered_messages[0].pk)
for msg in ordered_messages[1:]:
View
@@ -10,39 +10,54 @@
urlpatterns = patterns('geocamTalk.views',
url(r'^$', django.views.generic.simple.redirect_to,
{'url': 'messages', 'permanent': False},
- name='talk_home'),
+ name='geocamTalk_home'),
url(r'^register$', 'register',
- name='talk_register_c2dm'),
+ name='geocamTalk_register_c2dm'),
+
url(r'^unregister$', 'unregister',
- name='talk_unregister_c2dm'),
+ name='geocamTalk_unregister_c2dm'),
+
url(r'^messages/create.json$', 'create_message_json',
- name='talk_create_message_json'),
+ name='geocamTalk_create_message_json'),
+
url(r'^messages/create$', 'create_message',
- name='talk_create_message'),
+ name='geocamTalk_create_message'),
+
url(r'^messages/clear$', 'clear_messages',
- name='talk_clear_messages'),
+ name='geocamTalk_clear_messages'),
+
url(r'^messages/details/(?P<message_id>\d+).json$', 'message_details_json',
- name="talk_message_details_json"),
+ name="geocamTalk_message_details_json"),
+
url(r'^messages/details/(?P<message_id>\d+)$', 'message_details',
- name="talk_message_details"),
+ name="geocamTalk_message_details"),
+
url(r'^messages/(?P<recipient_username>[^ ]+)/(?P<author_username>[^ ]+).json$', 'feed_messages',
- name="talk_message_list_to_from_json"),
+ name="geocamTalk_message_list_to_from_json"),
+
url(r'^messages/(?P<recipient_username>[^ ]+).json$', 'feed_messages',
- name="talk_message_list_author_json"),
+ name="geocamTalk_message_list_author_json"),
+
url(r'^messages.json$', 'feed_messages',
- name="talk_message_list_all_json"),
+ name="geocamTalk_message_list_all_json"),
+
url(r'^messages/(?P<recipient_username>[^ ]+)/(?P<author_username>[^ ]+)$', 'message_list',
- name="talk_message_list_to_from"),
+ name="geocamTalk_message_list_to_from"),
+
url(r'^messages/(?P<recipient_username>[^ ]+)$', 'message_list',
- name="talk_message_list_to"),
+ name="geocamTalk_message_list_to"),
+
url(r'^messages/(?P<recipient_username>[^ ]+)$', 'message_list',
- name="talk_message_list_author"),
+ name="geocamTalk_message_list_author"),
+
url(r'^messages$', 'message_list',
- name="talk_message_list_all"),
+ name="geocamTalk_message_list_all"),
+
url(r'^map$', 'message_map',
- name="talk_message_map"),
+ name="geocamTalk_message_map"),
+
url(r'^messages\.kml$', 'feed_messages_kml',
{'readOnly': True},
- name='talk_message_list_all_kml'),
+ name='geocamTalk_message_list_all_kml'),
)
View
@@ -139,11 +139,11 @@ def create_message(request):
msg.save()
form.save_m2m()
msg.push_to_phone(True)
- return HttpResponseRedirect(reverse("talk_message_list_all"))
+ return HttpResponseRedirect(reverse("geocamTalk_message_list_all"))
else:
return render_to_response('geocamTalk/message_form.html',
- dict(form=form),
- context_instance=RequestContext(request))
+ dict(form=form),
+ context_instance=RequestContext(request))
else:
form = GeocamTalkForm()
return render_to_response('geocamTalk/message_form.html',

0 comments on commit 36b6f6f

Please sign in to comment.