librelist archives

« back to archive

Html and text

Html and text

From:
Alessio Civitillo
Date:
2013-07-18 @ 16:41
Hi,

so, I was wondering: what are your best practices for almost-static text?

For example, the text that is showed in the home page, about us page and so
on.

I understand this type of text is not changed a lot. However, if I put it
in, say, the database, I could then control it more easily. I can build a
page with a form to edit it when needed.

The whole thing also becomes extremely helpful once you start using
multiple languages.

What are your thoughts? Performance nightmare? Ok but with caching?

Thanks!
Alessio

Re: [flask] Html and text

From:
Gabriel Jordão
Date:
2013-07-18 @ 16:49
Hi Alessio,

I think you are looking for something like
Flask-Babel<http://pythonhosted.org/Flask-Babel/>.
Take a look at it


On Thu, Jul 18, 2013 at 1:41 PM, Alessio Civitillo <
alessiocivitillo@gmail.com> wrote:

> Hi,
>
> so, I was wondering: what are your best practices for almost-static text?
>
> For example, the text that is showed in the home page, about us page and
> so on.
>
> I understand this type of text is not changed a lot. However, if I put it
> in, say, the database, I could then control it more easily. I can build a
> page with a form to edit it when needed.
>
> The whole thing also becomes extremely helpful once you start using
> multiple languages.
>
> What are your thoughts? Performance nightmare? Ok but with caching?
>
> Thanks!
> Alessio
>



-- 
*
*
*Gabriel Jordão*

T (71) 3494-3514
C (71) 8780-0519
gabrielpjordao@jusbrasil.com.br
www.jusbrasil.com.br

Re: [flask] Html and text

From:
Mauricio de Abreu Antunes
Date:
2013-07-18 @ 17:53
With flask-babel you are able to generate files with a specific and
easy-to-learn syntax.
These files are used like a database where you can store your translation
or any another static text that should be replaced in a X poit of your
rules.


2013/7/18 Gabriel Jordão <gabrielpjordao@jusbrasil.com.br>

> Hi Alessio,
>
> I think you are looking for something like 
Flask-Babel<http://pythonhosted.org/Flask-Babel/>.
> Take a look at it
>
>
> On Thu, Jul 18, 2013 at 1:41 PM, Alessio Civitillo <
> alessiocivitillo@gmail.com> wrote:
>
>> Hi,
>>
>> so, I was wondering: what are your best practices for almost-static text?
>>
>> For example, the text that is showed in the home page, about us page and
>> so on.
>>
>> I understand this type of text is not changed a lot. However, if I put it
>> in, say, the database, I could then control it more easily. I can build a
>> page with a form to edit it when needed.
>>
>> The whole thing also becomes extremely helpful once you start using
>> multiple languages.
>>
>> What are your thoughts? Performance nightmare? Ok but with caching?
>>
>> Thanks!
>> Alessio
>>
>
>
>
> --
> *
> *
> *Gabriel Jordão*
>
> T (71) 3494-3514
> C (71) 8780-0519
> gabrielpjordao@jusbrasil.com.br
> www.jusbrasil.com.br
>



-- 
*Mauricio de Abreu Antunes*
Mobile: (51)930-74-525
Skype: mauricio.abreua

Re: [flask] Html and text

From:
Alessio Civitillo
Date:
2013-07-18 @ 19:38
Yes, I used flask-babel before. The thing is: what if I want to allow non
tech users to change the site text? What if I want to be able to just login
with an admin account and do changes?



On Thu, Jul 18, 2013 at 7:53 PM, Mauricio de Abreu Antunes <
mauricio.abreua@gmail.com> wrote:

> With flask-babel you are able to generate files with a specific and
> easy-to-learn syntax.
> These files are used like a database where you can store your translation
> or any another static text that should be replaced in a X poit of your
> rules.
>
>
> 2013/7/18 Gabriel Jordão <gabrielpjordao@jusbrasil.com.br>
>
>> Hi Alessio,
>>
>> I think you are looking for something like 
Flask-Babel<http://pythonhosted.org/Flask-Babel/>.
>> Take a look at it
>>
>>
>> On Thu, Jul 18, 2013 at 1:41 PM, Alessio Civitillo <
>> alessiocivitillo@gmail.com> wrote:
>>
>>> Hi,
>>>
>>> so, I was wondering: what are your best practices for almost-static text?
>>>
>>> For example, the text that is showed in the home page, about us page and
>>> so on.
>>>
>>> I understand this type of text is not changed a lot. However, if I put
>>> it in, say, the database, I could then control it more easily. I can build
>>> a page with a form to edit it when needed.
>>>
>>> The whole thing also becomes extremely helpful once you start using
>>> multiple languages.
>>>
>>> What are your thoughts? Performance nightmare? Ok but with caching?
>>>
>>> Thanks!
>>> Alessio
>>>
>>
>>
>>
>> --
>> *
>> *
>> *Gabriel Jordão*
>>
>> T (71) 3494-3514
>> C (71) 8780-0519
>> gabrielpjordao@jusbrasil.com.br
>> www.jusbrasil.com.br
>>
>
>
>
> --
> *Mauricio de Abreu Antunes*
> Mobile: (51)930-74-525
> Skype: mauricio.abreua
>



-- 
Regards,
------------------------------------
Alessio Civitillo
alessiocivitillo@gmail.com
Mobile: (0045) 52645608
Linkedin: http://it.linkedin.com/in/alessiocivitillo

Re: [flask] Html and text

From:
Mauricio de Abreu Antunes
Date:
2013-07-18 @ 19:42
It sounds like a CMS (like Plone) where the users can perform some updates
in the static text.
I don't know any library to do this, sorry.


2013/7/18 Alessio Civitillo <alessiocivitillo@gmail.com>

> Yes, I used flask-babel before. The thing is: what if I want to allow non
> tech users to change the site text? What if I want to be able to just login
> with an admin account and do changes?
>
>
>
> On Thu, Jul 18, 2013 at 7:53 PM, Mauricio de Abreu Antunes <
> mauricio.abreua@gmail.com> wrote:
>
>> With flask-babel you are able to generate files with a specific and
>> easy-to-learn syntax.
>> These files are used like a database where you can store your translation
>> or any another static text that should be replaced in a X poit of your
>> rules.
>>
>>
>> 2013/7/18 Gabriel Jordão <gabrielpjordao@jusbrasil.com.br>
>>
>>> Hi Alessio,
>>>
>>> I think you are looking for something like 
Flask-Babel<http://pythonhosted.org/Flask-Babel/>.
>>> Take a look at it
>>>
>>>
>>> On Thu, Jul 18, 2013 at 1:41 PM, Alessio Civitillo <
>>> alessiocivitillo@gmail.com> wrote:
>>>
>>>> Hi,
>>>>
>>>> so, I was wondering: what are your best practices for almost-static
>>>> text?
>>>>
>>>> For example, the text that is showed in the home page, about us page
>>>> and so on.
>>>>
>>>> I understand this type of text is not changed a lot. However, if I put
>>>> it in, say, the database, I could then control it more easily. I can build
>>>> a page with a form to edit it when needed.
>>>>
>>>> The whole thing also becomes extremely helpful once you start using
>>>> multiple languages.
>>>>
>>>> What are your thoughts? Performance nightmare? Ok but with caching?
>>>>
>>>> Thanks!
>>>> Alessio
>>>>
>>>
>>>
>>>
>>> --
>>> *
>>> *
>>> *Gabriel Jordão*
>>>
>>> T (71) 3494-3514
>>> C (71) 8780-0519
>>> gabrielpjordao@jusbrasil.com.br
>>> www.jusbrasil.com.br
>>>
>>
>>
>>
>> --
>> *Mauricio de Abreu Antunes*
>> Mobile: (51)930-74-525
>> Skype: mauricio.abreua
>>
>
>
>
> --
> Regards,
> ------------------------------------
> Alessio Civitillo
> alessiocivitillo@gmail.com
> Mobile: (0045) 52645608
> Linkedin: http://it.linkedin.com/in/alessiocivitillo
>



-- 
*Mauricio de Abreu Antunes*
Mobile: (51)930-74-525
Skype: mauricio.abreua

Re: [flask] Html and text

From:
Alessio Civitillo
Date:
2013-07-18 @ 21:33
Yes Mauricio! That is exactly the idea. I believe it's called "pages". I am
just thinking there should be a flask-y way of doing this.

Here is what I am thinking (I did not test this code!):
http://flask.pocoo.org/snippets/114/

Do you guys think this makes sense? With proper caching (like 3 hours or
more), this should not be too heavy on querying the database, right?



On Thu, Jul 18, 2013 at 9:42 PM, Mauricio de Abreu Antunes <
mauricio.abreua@gmail.com> wrote:

> It sounds like a CMS (like Plone) where the users can perform some updates
> in the static text.
> I don't know any library to do this, sorry.
>
>
> 2013/7/18 Alessio Civitillo <alessiocivitillo@gmail.com>
>
>> Yes, I used flask-babel before. The thing is: what if I want to allow non
>> tech users to change the site text? What if I want to be able to just login
>> with an admin account and do changes?
>>
>>
>>
>> On Thu, Jul 18, 2013 at 7:53 PM, Mauricio de Abreu Antunes <
>> mauricio.abreua@gmail.com> wrote:
>>
>>> With flask-babel you are able to generate files with a specific and
>>> easy-to-learn syntax.
>>> These files are used like a database where you can store your
>>> translation or any another static text that should be replaced in a X poit
>>> of your rules.
>>>
>>>
>>> 2013/7/18 Gabriel Jordão <gabrielpjordao@jusbrasil.com.br>
>>>
>>>> Hi Alessio,
>>>>
>>>> I think you are looking for something like 
Flask-Babel<http://pythonhosted.org/Flask-Babel/>.
>>>> Take a look at it
>>>>
>>>>
>>>> On Thu, Jul 18, 2013 at 1:41 PM, Alessio Civitillo <
>>>> alessiocivitillo@gmail.com> wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> so, I was wondering: what are your best practices for almost-static
>>>>> text?
>>>>>
>>>>> For example, the text that is showed in the home page, about us page
>>>>> and so on.
>>>>>
>>>>> I understand this type of text is not changed a lot. However, if I put
>>>>> it in, say, the database, I could then control it more easily. I can build
>>>>> a page with a form to edit it when needed.
>>>>>
>>>>> The whole thing also becomes extremely helpful once you start using
>>>>> multiple languages.
>>>>>
>>>>> What are your thoughts? Performance nightmare? Ok but with caching?
>>>>>
>>>>> Thanks!
>>>>> Alessio
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> *
>>>> *
>>>> *Gabriel Jordão*
>>>>
>>>> T (71) 3494-3514
>>>> C (71) 8780-0519
>>>> gabrielpjordao@jusbrasil.com.br
>>>> www.jusbrasil.com.br
>>>>
>>>
>>>
>>>
>>> --
>>> *Mauricio de Abreu Antunes*
>>> Mobile: (51)930-74-525
>>> Skype: mauricio.abreua
>>>
>>
>>
>>
>> --
>> Regards,
>> ------------------------------------
>> Alessio Civitillo
>> alessiocivitillo@gmail.com
>> Mobile: (0045) 52645608
>> Linkedin: http://it.linkedin.com/in/alessiocivitillo
>>
>
>
>
> --
> *Mauricio de Abreu Antunes*
> Mobile: (51)930-74-525
> Skype: mauricio.abreua
>



-- 
Regards,
------------------------------------
Alessio Civitillo
alessiocivitillo@gmail.com
Mobile: (0045) 52645608
Linkedin: http://it.linkedin.com/in/alessiocivitillo

Re: [flask] Html and text

From:
Steven Kryskalla
Date:
2013-07-18 @ 21:48
On Thu, Jul 18, 2013 at 2:33 PM, Alessio Civitillo <
alessiocivitillo@gmail.com> wrote:

> Yes Mauricio! That is exactly the idea. I believe it's called "pages". I
> am just thinking there should be a flask-y way of doing this.
>
> Here is what I am thinking (I did not test this code!):
> http://flask.pocoo.org/snippets/114/
>
> Do you guys think this makes sense? With proper caching (like 3 hours or
> more), this should not be too heavy on querying the database, right?
>
>
I used a similar approach on a django site using these two projects:

https://github.com/clintecker/django-chunks
https://github.com/deschler/django-modeltranslation

Chunks were used to store bits of content, and modeltranslation
automatically added columns to the Chunk model for different languages. I
wrote a custom template tag that looked up translation for a given chunk
based on the user's locale. Admin users were able to edit translations
through the django admin (with a few extra tools to help
import/export/compare translations). It worked out pretty nicely, I would
try the same approach with flask if I was working on a multilingual site.

Re: [flask] Html and text

From:
Mauricio de Abreu Antunes
Date:
2013-07-18 @ 22:26
Well, I would extend flask-babel or use it to create a real-time
static content handler. I don't know if it helps you, does it?

2013/7/18 Steven Kryskalla <skryskalla@gmail.com>:
> On Thu, Jul 18, 2013 at 2:33 PM, Alessio Civitillo
> <alessiocivitillo@gmail.com> wrote:
>>
>> Yes Mauricio! That is exactly the idea. I believe it's called "pages". I
>> am just thinking there should be a flask-y way of doing this.
>>
>> Here is what I am thinking (I did not test this code!):
>> http://flask.pocoo.org/snippets/114/
>>
>> Do you guys think this makes sense? With proper caching (like 3 hours or
>> more), this should not be too heavy on querying the database, right?
>>
>
> I used a similar approach on a django site using these two projects:
>
> https://github.com/clintecker/django-chunks
> https://github.com/deschler/django-modeltranslation
>
> Chunks were used to store bits of content, and modeltranslation
> automatically added columns to the Chunk model for different languages. I
> wrote a custom template tag that looked up translation for a given chunk
> based on the user's locale. Admin users were able to edit translations
> through the django admin (with a few extra tools to help
> import/export/compare translations). It worked out pretty nicely, I would
> try the same approach with flask if I was working on a multilingual site.



-- 
Mauricio de Abreu Antunes
Mobile: (51)930-74-525
Skype: mauricio.abreua