<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Dynamic names as first-level URL path objects in Django</title>
	<atom:link href="http://www.elfsternberg.com/2009/06/26/dynamic-names-as-first-level-url-path-objects-in-django/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.elfsternberg.com/2009/06/26/dynamic-names-as-first-level-url-path-objects-in-django/</link>
	<description>Done, and gets things smart.</description>
	<lastBuildDate>Fri, 03 Feb 2012 14:39:41 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Philip Gatt</title>
		<link>http://www.elfsternberg.com/2009/06/26/dynamic-names-as-first-level-url-path-objects-in-django/comment-page-1/#comment-5661</link>
		<dc:creator>Philip Gatt</dc:creator>
		<pubDate>Wed, 27 Apr 2011 05:14:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.elfsternberg.com/?p=274#comment-5661</guid>
		<description>Instead of checking for an error, check that the desired url is the catchall. In my app I have this and it&#039;s working:

    def clean_username(self):
        username = self.cleaned_data[&#039;username&#039;].lower()
        try:
            r = urlresolvers.resolve(&#039;/{0}/&#039;.format(username))
        except urlresolvers.Resolver404:
            raise RuntimeError(&quot;Username should match a url-check routes file&quot;)
        else:
            if r.url_name != &#039;room&#039;:
                raise forms.ValidationError(&#039;Username is unavailable&#039;)
        return username</description>
		<content:encoded><![CDATA[<p>Instead of checking for an error, check that the desired url is the catchall. In my app I have this and it&#8217;s working:</p>
<p>    def clean_username(self):<br />
        username = self.cleaned_data['username'].lower()<br />
        try:<br />
            r = urlresolvers.resolve(&#8216;/{0}/&#8217;.format(username))<br />
        except urlresolvers.Resolver404:<br />
            raise RuntimeError(&#8220;Username should match a url-check routes file&#8221;)<br />
        else:<br />
            if r.url_name != &#8216;room&#8217;:<br />
                raise forms.ValidationError(&#8216;Username is unavailable&#8217;)<br />
        return username</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Buckley</title>
		<link>http://www.elfsternberg.com/2009/06/26/dynamic-names-as-first-level-url-path-objects-in-django/comment-page-1/#comment-2065</link>
		<dc:creator>Buckley</dc:creator>
		<pubDate>Tue, 08 Dec 2009 15:36:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.elfsternberg.com/?p=274#comment-2065</guid>
		<description>What I&#039;m trying to say is the exception will never be raised.  Even if the user chooses a valid username, it will still match the &#039;user&#039; pattern regardless of whether or not the username has been picked by someone else.</description>
		<content:encoded><![CDATA[<p>What I&#8217;m trying to say is the exception will never be raised.  Even if the user chooses a valid username, it will still match the &#8216;user&#8217; pattern regardless of whether or not the username has been picked by someone else.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Elf Sternberg</title>
		<link>http://www.elfsternberg.com/2009/06/26/dynamic-names-as-first-level-url-path-objects-in-django/comment-page-1/#comment-2062</link>
		<dc:creator>Elf Sternberg</dc:creator>
		<pubDate>Tue, 08 Dec 2009 15:00:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.elfsternberg.com/?p=274#comment-2062</guid>
		<description>Yes, and that&#039;s the point!  If the resolve block doesn&#039;t throw an exception, the resolution works, meaning you&#039;ve chosen a name that conflicts with (a) a reserved URL for the application or (b) a username already in use by someone else.  The user must pick something else.

Does that help?</description>
		<content:encoded><![CDATA[<p>Yes, and that&#8217;s the point!  If the resolve block doesn&#8217;t throw an exception, the resolution works, meaning you&#8217;ve chosen a name that conflicts with (a) a reserved URL for the application or (b) a username already in use by someone else.  The user must pick something else.</p>
<p>Does that help?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Buckley</title>
		<link>http://www.elfsternberg.com/2009/06/26/dynamic-names-as-first-level-url-path-objects-in-django/comment-page-1/#comment-2061</link>
		<dc:creator>Buckley</dc:creator>
		<pubDate>Tue, 08 Dec 2009 14:27:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.elfsternberg.com/?p=274#comment-2061</guid>
		<description>I don&#039;t understand how this would work.  Won&#039;t the resolve call in the try block return the user url pattern in the case where the registration is valid?</description>
		<content:encoded><![CDATA[<p>I don&#8217;t understand how this would work.  Won&#8217;t the resolve call in the try block return the user url pattern in the case where the registration is valid?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

