blogofile serve on Windows

19 views
Skip to first unread message

OJ Reeves

unread,
Jan 31, 2011, 6:22:05 PM1/31/11
to blogofil...@googlegroups.com
Hi guys,

I noticed a small issue yesterday when mucking around with blogofile on my Windows machine. If I run "blogofile serve" from the root folder and browse to http://localhost:8080/ nothing shows up. For some reason I have to add "/_site" to the end of the URI to get to the index page. From then on the links don't work either (because none of them have "/_site" in the URI).

This doesn't happen at all on my Linux machines.

I was wondering if there is a known issue or if there's something I'm doing wrong to make this happen? It's not a big issue as most of the time I am in Linux anyway, I just thought I'd mention it :)

Cheers!
OJ

--

OJ Reeves
http://buffered.io/

Ryan McGuire

unread,
Jan 31, 2011, 9:03:45 PM1/31/11
to blogofile-discuss
I've done windows testing of blogofile in the past, but I admit I
haven't done it recently. I've created an issue to track it:
https://github.com/EnigmaCurry/blogofile/issues/issue/63

Thanks

On Jan 31, 6:22 pm, OJ Reeves <o...@buffered.io> wrote:
> Hi guys,
>
> I noticed a small issue yesterday when mucking around with blogofile on my
> Windows machine. If I run "blogofile serve" from the root folder and browse
> tohttp://localhost:8080/nothing shows up. For some reason I have to add

Seth de l'Isle

unread,
Feb 21, 2011, 8:23:13 PM2/21/11
to blogofile-discuss
I was able to get the server working as expected on Windows by
replacing a call to re.sub with a call to str.replace. The re.sub was
interpreting a whack as a regular expression escape character rather
than as a part of the path to be substituted. The result was that the
replace operation didn't happen and the original path without _site
inserted was used.

--- a/blogofile/server.py
+++ b/blogofile/server.py
@@ -76,7 +76,7 @@ for the root page? : <a href="{0}">{1}</a>
util.path_join(site_path.strip("/")))
else:
build_path = os.getcwd()
- build_path = re.sub(build_path,
os.path.join(os.getcwd(),"_site"), p)
+ build_path = p.replace(build_path,
os.path.join(os.getcwd(),"_site"))
return build_path

def log_message(self, format, *args):



On Jan 31, 5:03 pm, Ryan McGuire <tellar...@gmail.com> wrote:
> I've done windows testing of blogofile in the past, but I admit I
> haven't done it recently. I've created an issue to track it:https://github.com/EnigmaCurry/blogofile/issues/issue/63
>
> Thanks
>
> On Jan 31, 6:22 pm, OJ Reeves <o...@buffered.io> wrote:
>
>
>
>
>
>
>
> > Hi guys,
>
> > I noticed a small issue yesterday when mucking around with blogofile on my
> > Windows machine. If I run "blogofile serve" from the root folder and browse
> > tohttp://localhost:8080/nothingshows up. For some reason I have to add

Seth de l'Isle

unread,
Feb 21, 2011, 8:58:19 PM2/21/11
to blogofil...@googlegroups.com
Hi OJ,

2011/2/21 OJ Reeves <o...@buffered.io>:
> Would it not be better to just escape the path?
> build_path = re.sub(re.escape(build_path), ....

My first crack at this used re.escape, but there was something I
wasn't getting. As I explored my misunderstanding it occurred to me
that using the string replace function would make sense; Blogofile
isn't actually using the awesome awesomeness of regular expressions
here anyway.

I'm sure it wouldn't take much to get re.sub to work and I posted the
diff more to illustrate my research than to encourage my
implementation of the fix.

OJ Reeves

unread,
Feb 21, 2011, 9:05:52 PM2/21/11
to blogofil...@googlegroups.com
Nice work mate. Thanks for the response.

I'll be implementing your patch in my local repo anyway :)

Cheers!
OJ


--
You received this message because you are subscribed to the Google Groups "blogofile-discuss" group.
To post to this group, send email to blogofil...@googlegroups.com.
To unsubscribe from this group, send email to blogofile-disc...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/blogofile-discuss?hl=en.

OJ Reeves

unread,
Feb 21, 2011, 8:38:17 PM2/21/11
to blogofil...@googlegroups.com
Would it not be better to just escape the path?

build_path = re.sub(re.escape(build_path), ....

OJ

Disclaimer: This is a whimsical comment that hasn't been tested :) Please tear it apart if needs be!


--
You received this message because you are subscribed to the Google Groups "blogofile-discuss" group.
To post to this group, send email to blogofil...@googlegroups.com.
To unsubscribe from this group, send email to blogofile-disc...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/blogofile-discuss?hl=en.

Ryan McGuire

unread,
Feb 21, 2011, 9:33:01 PM2/21/11
to blogofil...@googlegroups.com, OJ Reeves
Thank Seth for recognizing that we didn't need a regex there! I
committed your fix (and I also see your fix for guids, just haven't
gotten around to reviewing it yet.)

OJ, sorry for letting this bug slide for almost a month, embarrassing
when it was such an obvious fix. :x

-Ryan

Seth de l'Isle

unread,
Feb 22, 2011, 9:14:12 PM2/22/11
to blogofile-discuss
Hello,

On Feb 21, 4:38 pm, OJ Reeves <o...@buffered.io> wrote:
> Would it not be better to just escape the path?
>
> build_path = re.sub(re.escape(build_path), ....

I had so much investigating this to the end of my sanity, that I made
a blog post out of it.

http://blog.monkeypatch.org/2011/02/windows-path-to-regex-wackiness.html

Disclaimer: This is a whimsical blog post, Please tear it apart if
needs be!

Thanks!

Ryan McGuire

unread,
Feb 22, 2011, 9:26:28 PM2/22/11
to blogofil...@googlegroups.com
Yep, wacky. I actually noticed the same exact thing as you do in your
post when I attempted a fix. I got to the same point as you and threw
up my hands in disgust.

Reply all
Reply to author
Forward
0 new messages