librelist archives

« back to archive

Freeze command

Freeze command

From:
Ben
Date:
2011-11-27 @ 21:28
Hi,

Some updates about the freeze command:

- Generated pages are now generated at the source of the blog under a
`build` directory, I overwritten app.root_path, there might be
side-effects, a simple check didn't show any.
- The command is now documented
- You have a new  option to not-generate index.html pages, but direct pages.

Rafael, I thought it was an option for you to integrate this work in
the official blohg release, Which requirements should I comply with to
indeed be integrated ?

Regards,
Ben

Here are my patches: https://bitbucket.org/benallard/blohg

Re: [blohg] Freeze command

From:
Rafael Martins
Date:
2011-11-27 @ 22:16
Hi Ben,

On Sun, Nov 27, 2011 at 7:28 PM, Ben <benoit.allard@gmx.de> wrote:
> Hi,
>
> Some updates about the freeze command:
>
> - Generated pages are now generated at the source of the blog under a
> `build` directory, I overwritten app.root_path, there might be
> side-effects, a simple check didn't show any.
> - The command is now documented
> - You have a new  option to not-generate index.html pages, but direct pages.
>
> Rafael, I thought it was an option for you to integrate this work in
> the official blohg release, Which requirements should I comply with to
> indeed be integrated ?
>
> Regards,
> Ben
>
> Here are my patches: https://bitbucket.org/benallard/blohg
>

I'm reviewing your patches,

thanks a lot.

-- 
Rafael Goncalves Martins
http://rafaelmartins.eng.br/

Re: [blohg] Freeze command

From:
Rafael Martins
Date:
2011-11-27 @ 22:40
On Sun, Nov 27, 2011 at 8:16 PM, Rafael Martins
<rafael@rafaelmartins.eng.br> wrote:
> Hi Ben,
>
> On Sun, Nov 27, 2011 at 7:28 PM, Ben <benoit.allard@gmx.de> wrote:
>> Hi,
>>
>> Some updates about the freeze command:
>>
>> - Generated pages are now generated at the source of the blog under a
>> `build` directory, I overwritten app.root_path, there might be
>> side-effects, a simple check didn't show any.
>> - The command is now documented
>> - You have a new  option to not-generate index.html pages, but direct pages.
>>
>> Rafael, I thought it was an option for you to integrate this work in
>> the official blohg release, Which requirements should I comply with to
>> indeed be integrated ?
>>
>> Regards,
>> Ben
>>
>> Here are my patches: https://bitbucket.org/benallard/blohg
>>
>
> I'm reviewing your patches,
>
> thanks a lot.
>

I merged your patches with quick fixes [1]. Thanks a lot for your work.

I just noted 2 broken things that we may try to fix:

1 - attachments aren't being freezed.
2 - template images, called from css aren't being freezed

The former is easy to fix, I think. The later isn't, we may just
document the issue properly.

Tell me if you can work on this and send me the patches, and I'll
prepare a new release for soon :)

Nice work.

Thanks,

[1] http://hg.rafaelmartins.eng.br/blohg/rev/40367cd87a62

-- 
Rafael Goncalves Martins
http://rafaelmartins.eng.br/

Re: [blohg] Freeze command

From:
Ben
Date:
2011-11-28 @ 19:59
Hi Rafael,

On Sun, Nov 27, 2011 at 23:40, Rafael Martins
<rafael@rafaelmartins.eng.br> wrote:
>
> I just noted 2 broken things that we may try to fix:
>
> 1 - attachments aren't being freezed.
> 2 - template images, called from css aren't being freezed
>

About that second one, I chose to freeze the whole 'static' directory
[1] . I think it anyway dserves to be properly frozen.

Let me know about those new patches !

Regards
Ben

[1] https://bitbucket.org/benallard/blohg/changeset/707e2e362ecc

Re: [blohg] Freeze command

From:
Rafael Martins
Date:
2011-11-28 @ 21:12
On Mon, Nov 28, 2011 at 5:59 PM, Ben <benoit.allard@gmx.de> wrote:
> Hi Rafael,
>
> On Sun, Nov 27, 2011 at 23:40, Rafael Martins
> <rafael@rafaelmartins.eng.br> wrote:
>>
>> I just noted 2 broken things that we may try to fix:
>>
>> 1 - attachments aren't being freezed.
>> 2 - template images, called from css aren't being freezed
>>
>
> About that second one, I chose to freeze the whole 'static' directory
> [1] . I think it anyway dserves to be properly frozen.

I thought about this this evening at work, but you was faster than me.
I was going to send the email tonight :P

> Let me know about those new patches !

They are good overall. Just take a look at the _external thing. I'll
merge them shortly anyway.

Thanks

-- 
Rafael Goncalves Martins
http://rafaelmartins.eng.br/

Re: [blohg] Freeze command

From:
Ben
Date:
2011-11-28 @ 12:50
On Sun, Nov 27, 2011 at 23:40, Rafael Martins
<rafael@rafaelmartins.eng.br> wrote:
> I merged your patches with quick fixes [1]. Thanks a lot for your work.
>

Thanks a lot !

> I just noted 2 broken things that we may try to fix:
>
> 1 - attachments aren't being freezed.
> 2 - template images, called from css aren't being freezed
>
> The former is easy to fix, I think. The later isn't, we may just
> document the issue properly.

Indeed, the first one can be properly solved by walking the
attachement directory. Do you know of any example blog that I could
use to test this ?

The second one could also be solved by parsing the css file(s) and
looking for "url(" patterns ... Another solution would be to put the
css near the templates, and use the "url_for()" function within the
css.

Which one would you prefer ?

>
> Tell me if you can work on this and send me the patches, and I'll
> prepare a new release for soon :)
>

Thanks again, I don't care really much about a new release, I can use
a development version, it was more about my changes being accepted
upstream for others to be able to use them.

Regards,
Ben

Re: [blohg] Freeze command

From:
Ry4an Brase
Date:
2011-11-28 @ 15:36
On Mon, Nov 28, 2011 at 01:50:47PM +0100, Ben wrote:
> Indeed, the first one can be properly solved by walking the
> attachement directory. Do you know of any example blog that I could
> use to test this ?

I have a small blog with some attachments if you want a test you can
clone down.  It works w/ blohg 0.8.

    http://ry4an.org/hg/unblog/

-- 
Ry4an Brase - http://ry4an.org/

Re: [blohg] Freeze command

From:
Ben
Date:
2011-11-28 @ 19:12
Hi Rafael,

On Sun, Nov 27, 2011 at 23:40, Rafael Martins
<rafael@rafaelmartins.eng.br> wrote:
> I just noted 2 broken things that we may try to fix:
>
> 1 - attachments aren't being freezed.

I'm sorry to disappoint you, but this one is just working fine thanks
to the calls to url_for made by rst the role/directives.

If you got a warning, that's just because your test did not contained
any attachments.

I had to make the url 'internal' though for them to work [1]. Any
specific reason why they were '_external' ???

> 2 - template images, called from css aren't being freezed

I'm working on that one.

Regards,
Ben

[1] https://bitbucket.org/benallard/blohg/changeset/557bbf09063c

Re: [blohg] Freeze command

From:
Rafael Martins
Date:
2011-11-28 @ 21:10
On Mon, Nov 28, 2011 at 5:12 PM, Ben <benoit.allard@gmx.de> wrote:
> Hi Rafael,
>
> On Sun, Nov 27, 2011 at 23:40, Rafael Martins
> <rafael@rafaelmartins.eng.br> wrote:
>> I just noted 2 broken things that we may try to fix:
>>
>> 1 - attachments aren't being freezed.
>
> I'm sorry to disappoint you, but this one is just working fine thanks
> to the calls to url_for made by rst the role/directives.
>
> If you got a warning, that's just because your test did not contained
> any attachments.
>
> I had to make the url 'internal' though for them to work [1]. Any
> specific reason why they were '_external' ???

Nice!

I can't remember why I made these links external. I guess some atom
readers don't play nicely with "internal" links. I'm not sure anyway.
No objections for this at all. On the last case we can make this
internal just for frozen-flask, like I did for the abort() calls.

>> 2 - template images, called from css aren't being freezed
>
> I'm working on that one.
>
> Regards,
> Ben
>
> [1] https://bitbucket.org/benallard/blohg/changeset/557bbf09063c
>

Thanks

-- 
Rafael Goncalves Martins
http://rafaelmartins.eng.br/

Re: [blohg] Freeze command

From:
Ry4an Brase
Date:
2011-11-28 @ 21:17
On Mon, Nov 28, 2011 at 07:10:50PM -0200, Rafael Martins wrote:
> Nice!
> 
> I can't remember why I made these links external. I guess some atom
> readers don't play nicely with "internal" links. I'm not sure anyway.
> No objections for this at all. On the last case we can make this
> internal just for frozen-flask, like I did for the abort() calls.

I think I made them external in a submitted patch because w/o them
images won't show up in google reader, which was a bummer for me.


-- 
Ry4an Brase - http://ry4an.org/

Re: [blohg] Freeze command

From:
Ben
Date:
2011-11-28 @ 21:22
On Nov 28, 2011, at 10:17 PM, Ry4an Brase wrote:

> On Mon, Nov 28, 2011 at 07:10:50PM -0200, Rafael Martins wrote:
>> Nice!
>> 
>> I can't remember why I made these links external. I guess some atom
>> readers don't play nicely with "internal" links. I'm not sure anyway.
>> No objections for this at all. On the last case we can make this
>> internal just for frozen-flask, like I did for the abort() calls.
> 
> I think I made them external in a submitted patch because w/o them
> images won't show up in google reader, which was a bummer for me.
> 

I see, it makes sense ... 

The exact trouble I'm having is that when I `freeze --serve`, the 
webserver is @ localhost:5000. Those links don't have a :5000 in the url, 
which make the picture unreachable ... It might be a flask bug though ...

Regards,
Ben

Re: [blohg] Freeze command

From:
Ry4an Brase
Date:
2011-11-28 @ 21:31
On Mon, Nov 28, 2011 at 10:22:06PM +0100, Ben wrote:
> > I think I made them external in a submitted patch because w/o them
> > images won't show up in google reader, which was a bummer for me.
> > 
> 
> I see, it makes sense ... 
> 
> The exact trouble I'm having is that when I `freeze --serve`, the
> webserver is @ localhost:5000. Those links don't have a :5000 in the
> url, which make the picture unreachable ... It might be a flask bug
> though ...

Ah, that makes sense.  Maybe make it possible to provide a urlBase as an
argument to freeze?  I don't run a static blog, but I'm guessing the
people that do are used to having to provide a URL where the content
will be hosted for places that require absolute links?   I'm thinking of
the case where people are using a CDN like cloudfront for their static
images/assets and need to provide it at build time.

-- 
Ry4an Brase - http://ry4an.org/

Re: [blohg] Freeze command

From:
Ben
Date:
2011-11-28 @ 22:11
On Nov 28, 2011, at 10:31 PM, Ry4an Brase wrote:

> On Mon, Nov 28, 2011 at 10:22:06PM +0100, Ben wrote:
>>> I think I made them external in a submitted patch because w/o them
>>> images won't show up in google reader, which was a bummer for me.
>>> 
>> 
>> I see, it makes sense ... 
>> 
>> The exact trouble I'm having is that when I `freeze --serve`, the
>> webserver is @ localhost:5000. Those links don't have a :5000 in the
>> url, which make the picture unreachable ... It might be a flask bug
>> though ...
> 
> Ah, that makes sense.  Maybe make it possible to provide a urlBase as an
> argument to freeze?  I don't run a static blog, but I'm guessing the
> people that do are used to having to provide a URL where the content
> will be hosted for places that require absolute links?   I'm thinking of
> the case where people are using a CDN like cloudfront for their static
> images/assets and need to provide it at build time.


We're not done yet ...

I thought we could simply use FREEZER_BASE_URL from Frozen-Flask 
configuration [1], unfortunately, our on-request-config-handling is way 
too late for him to catch the right value ...

Rafael, any way to load a first set of setting earlier ?

Regards,
Ben

[1] http://packages.python.org/Frozen-Flask/#configuration

Re: [blohg] Freeze command

From:
Rafael Martins
Date:
2011-11-28 @ 23:12
On Mon, Nov 28, 2011 at 8:11 PM, Ben <benoit.allard@gmx.de> wrote:
>
> On Nov 28, 2011, at 10:31 PM, Ry4an Brase wrote:
>
>> On Mon, Nov 28, 2011 at 10:22:06PM +0100, Ben wrote:
>>>> I think I made them external in a submitted patch because w/o them
>>>> images won't show up in google reader, which was a bummer for me.
>>>>
>>>
>>> I see, it makes sense ...
>>>
>>> The exact trouble I'm having is that when I `freeze --serve`, the
>>> webserver is @ localhost:5000. Those links don't have a :5000 in the
>>> url, which make the picture unreachable ... It might be a flask bug
>>> though ...
>>
>> Ah, that makes sense.  Maybe make it possible to provide a urlBase as an
>> argument to freeze?  I don't run a static blog, but I'm guessing the
>> people that do are used to having to provide a URL where the content
>> will be hosted for places that require absolute links?   I'm thinking of
>> the case where people are using a CDN like cloudfront for their static
>> images/assets and need to provide it at build time.
>
>
> We're not done yet ...
>
> I thought we could simply use FREEZER_BASE_URL from Frozen-Flask 
configuration [1], unfortunately, our on-request-config-handling is way 
too late for him to catch the right value ...
>
> Rafael, any way to load a first set of setting earlier ?
>

Warn people to define FREEZER_BASE_URL n config.yaml isn't enough?
config.yaml can change any app.config parameter.

Thanks

-- 
Rafael Goncalves Martins
http://rafaelmartins.eng.br/

Re: [blohg] Freeze command

From:
Ben
Date:
2011-11-28 @ 23:17
On Nov 29, 2011, at 12:12 AM, Rafael Martins wrote:

> On Mon, Nov 28, 2011 at 8:11 PM, Ben <benoit.allard@gmx.de> wrote:
>> 
>> On Nov 28, 2011, at 10:31 PM, Ry4an Brase wrote:
>> 
>>> On Mon, Nov 28, 2011 at 10:22:06PM +0100, Ben wrote:
>>>>> I think I made them external in a submitted patch because w/o them
>>>>> images won't show up in google reader, which was a bummer for me.
>>>>> 
>>>> 
>>>> I see, it makes sense ...
>>>> 
>>>> The exact trouble I'm having is that when I `freeze --serve`, the
>>>> webserver is @ localhost:5000. Those links don't have a :5000 in the
>>>> url, which make the picture unreachable ... It might be a flask bug
>>>> though ...
>>> 
>>> Ah, that makes sense.  Maybe make it possible to provide a urlBase as an
>>> argument to freeze?  I don't run a static blog, but I'm guessing the
>>> people that do are used to having to provide a URL where the content
>>> will be hosted for places that require absolute links?   I'm thinking of
>>> the case where people are using a CDN like cloudfront for their static
>>> images/assets and need to provide it at build time.
>> 
>> 
>> We're not done yet ...
>> 
>> I thought we could simply use FREEZER_BASE_URL from Frozen-Flask 
configuration [1], unfortunately, our on-request-config-handling is way 
too late for him to catch the right value ...
>> 
>> Rafael, any way to load a first set of setting earlier ?
>> 
> 
> Warn people to define FREEZER_BASE_URL n config.yaml isn't enough?
> config.yaml can change any app.config parameter.

Would have been nice ! But the first load_config happen in the first 
before_request(), at that time, the freezer already has his 
FREEZER_BASE_URL ... which is the default value, not the one from 
load_config. I tried inside a before_first_request() handler, no joy ... 
It looks like it is called just before the first before_request, but still
too late for the FREEZER_BASE_URL ...

Re: [blohg] Freeze command

From:
Rafael Martins
Date:
2011-11-28 @ 23:18
On Mon, Nov 28, 2011 at 9:17 PM, Ben <benoit.allard@gmx.de> wrote:
>
> On Nov 29, 2011, at 12:12 AM, Rafael Martins wrote:
>
>> On Mon, Nov 28, 2011 at 8:11 PM, Ben <benoit.allard@gmx.de> wrote:
>>>
>>> On Nov 28, 2011, at 10:31 PM, Ry4an Brase wrote:
>>>
>>>> On Mon, Nov 28, 2011 at 10:22:06PM +0100, Ben wrote:
>>>>>> I think I made them external in a submitted patch because w/o them
>>>>>> images won't show up in google reader, which was a bummer for me.
>>>>>>
>>>>>
>>>>> I see, it makes sense ...
>>>>>
>>>>> The exact trouble I'm having is that when I `freeze --serve`, the
>>>>> webserver is @ localhost:5000. Those links don't have a :5000 in the
>>>>> url, which make the picture unreachable ... It might be a flask bug
>>>>> though ...
>>>>
>>>> Ah, that makes sense.  Maybe make it possible to provide a urlBase as an
>>>> argument to freeze?  I don't run a static blog, but I'm guessing the
>>>> people that do are used to having to provide a URL where the content
>>>> will be hosted for places that require absolute links?   I'm thinking of
>>>> the case where people are using a CDN like cloudfront for their static
>>>> images/assets and need to provide it at build time.
>>>
>>>
>>> We're not done yet ...
>>>
>>> I thought we could simply use FREEZER_BASE_URL from Frozen-Flask 
configuration [1], unfortunately, our on-request-config-handling is way 
too late for him to catch the right value ...
>>>
>>> Rafael, any way to load a first set of setting earlier ?
>>>
>>
>> Warn people to define FREEZER_BASE_URL n config.yaml isn't enough?
>> config.yaml can change any app.config parameter.
>
> Would have been nice ! But the first load_config happen in the first 
before_request(), at that time, the freezer already has his 
FREEZER_BASE_URL ... which is the default value, not the one from 
load_config. I tried inside a before_first_request() handler, no joy ... 
It looks like it is called just before the first before_request, but still
too late for the FREEZER_BASE_URL ...
>

Hmm, really. The yaml config isn't load at the very begin. I'll take a look.

Thanks

-- 
Rafael Goncalves Martins
http://rafaelmartins.eng.br/

Re: [blohg] Freeze command

From:
Rafael Martins
Date:
2011-11-28 @ 23:31
On Mon, Nov 28, 2011 at 9:18 PM, Rafael Martins
<rafael@rafaelmartins.eng.br> wrote:
> On Mon, Nov 28, 2011 at 9:17 PM, Ben <benoit.allard@gmx.de> wrote:
>>
>> On Nov 29, 2011, at 12:12 AM, Rafael Martins wrote:
>>
>>> On Mon, Nov 28, 2011 at 8:11 PM, Ben <benoit.allard@gmx.de> wrote:
>>>>
>>>> On Nov 28, 2011, at 10:31 PM, Ry4an Brase wrote:
>>>>
>>>>> On Mon, Nov 28, 2011 at 10:22:06PM +0100, Ben wrote:
>>>>>>> I think I made them external in a submitted patch because w/o them
>>>>>>> images won't show up in google reader, which was a bummer for me.
>>>>>>>
>>>>>>
>>>>>> I see, it makes sense ...
>>>>>>
>>>>>> The exact trouble I'm having is that when I `freeze --serve`, the
>>>>>> webserver is @ localhost:5000. Those links don't have a :5000 in the
>>>>>> url, which make the picture unreachable ... It might be a flask bug
>>>>>> though ...
>>>>>
>>>>> Ah, that makes sense.  Maybe make it possible to provide a urlBase as an
>>>>> argument to freeze?  I don't run a static blog, but I'm guessing the
>>>>> people that do are used to having to provide a URL where the content
>>>>> will be hosted for places that require absolute links?   I'm thinking of
>>>>> the case where people are using a CDN like cloudfront for their static
>>>>> images/assets and need to provide it at build time.
>>>>
>>>>
>>>> We're not done yet ...
>>>>
>>>> I thought we could simply use FREEZER_BASE_URL from Frozen-Flask 
configuration [1], unfortunately, our on-request-config-handling is way 
too late for him to catch the right value ...
>>>>
>>>> Rafael, any way to load a first set of setting earlier ?
>>>>
>>>
>>> Warn people to define FREEZER_BASE_URL n config.yaml isn't enough?
>>> config.yaml can change any app.config parameter.
>>
>> Would have been nice ! But the first load_config happen in the first 
before_request(), at that time, the freezer already has his 
FREEZER_BASE_URL ... which is the default value, not the one from 
load_config. I tried inside a before_first_request() handler, no joy ... 
It looks like it is called just before the first before_request, but still
too late for the FREEZER_BASE_URL ...
>>
>
> Hmm, really. The yaml config isn't load at the very begin. I'll take a look.
>

This patch should fix the issue, getting the base url from command line:

http://paste.pocoo.org/raw/514219/

Please test.

Thanks

-- 
Rafael Goncalves Martins
http://rafaelmartins.eng.br/