Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
true unicode slugs (blogofile 0.8dev, python3)
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  14 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Wasil Sergejczyk  
View profile   Translate to Translated (View Original)
 More options May 28 2012, 9:38 am
From: Wasil Sergejczyk <szelga....@gmail.com>
Date: Mon, 28 May 2012 06:38:11 -0700 (PDT)
Local: Mon, May 28 2012 9:38 am
Subject: true unicode slugs (blogofile 0.8dev, python3)
_config.py:

from markupsafe import Markup
import re
_punct_re = re.compile(r'[\t !"#$%&\'()*\-/<=>?@\[\\\]^_`{|},.]+')
#from unidecode import unidecode # if you are OK with non-ASCII
symbols, comment this out, else install unidecode library
unidecode_func = lambda s: s # if you set this to unidecode, non-ASCII
symbols will be slugified into ASCII
# e.g. unidecode("北亰") == "Bei Jing "
str_func = unicode if sys.version_info < (3,) else str
def custom_create_slug(title, delim='-'):
    # Get rid of any html entities
    slug = Markup(title).unescape()

    result = []
    for word in _punct_re.split(slug):
        result.extend(unidecode_func(word).split())
    slug = str_func(delim.join(result)).lower()
    return slug
blog.post.slugify = custom_create_slug

also, i had to modify _controllers/blog/post.py/create_permalink() so
it now uses config.slugify, if exists (it must be a bug).
works with both posts and categories.
btw, i didn't find any bugtracker on github, am i missing something?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Wasil Sergejczyk  
View profile   Translate to Translated (View Original)
 More options May 28 2012, 9:42 am
From: Wasil Sergejczyk <szelga....@gmail.com>
Date: Mon, 28 May 2012 06:42:48 -0700 (PDT)
Local: Mon, May 28 2012 9:42 am
Subject: Re: true unicode slugs (blogofile 0.8dev, python3)
ps i used this snippet: http://flask.pocoo.org/snippets/5/

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mike Pirnat  
View profile  
 More options May 28 2012, 10:08 am
From: Mike Pirnat <mpir...@gmail.com>
Date: Mon, 28 May 2012 10:08:20 -0400
Local: Mon, May 28 2012 10:08 am
Subject: Re: true unicode slugs (blogofile 0.8dev, python3)

On Mon, May 28, 2012 at 9:38 AM, Wasil Sergejczyk <szelga....@gmail.com> wrote:
> btw, i didn't find any bugtracker on github, am i missing something?

Yes, github has a bug tracker:

https://github.com/blog/831-issues-2-0-the-next-generation

And if you have patches you'd like to submit, pull requests make it really easy:

http://help.github.com/send-pull-requests/

On top of that, sending a pull request automatically opens an issue in
the tracker. :-)

--
Mike Pirnat
mpir...@gmail.com
http://mike.pirnat.com/


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Doug Latornell  
View profile   Translate to Translated (View Original)
 More options May 28 2012, 2:47 pm
From: Doug Latornell <d...@douglatornell.ca>
Date: Mon, 28 May 2012 11:47:16 -0700
Local: Mon, May 28 2012 2:47 pm
Subject: Re: true unicode slugs (blogofile 0.8dev, python3)

You're right that Unicode handling in slug creation is not what it
should be. I think this snippet could be worked into the create_slug()
function in blogofile_blog/site_src/_controllers/blog/post.py

I'd welcome a pull request for that.

> also, i had to modify _controllers/blog/post.py/create_permalink() so
> it now uses config.slugify, if exists (it must be a bug).
> works with both posts and categories.

I'm pretty sure that if you make the change in create_slug() it will
flow through to permalink pages and categories too.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Wasil Sergejczyk  
View profile   Translate to Translated (View Original)
 More options May 29 2012, 1:36 am
From: Wasil Sergejczyk <szelga....@gmail.com>
Date: Mon, 28 May 2012 22:36:16 -0700 (PDT)
Local: Tues, May 29 2012 1:36 am
Subject: Re: true unicode slugs (blogofile 0.8dev, python3)
> You're right that Unicode handling in slug creation is not what it
> should be. I think this snippet could be worked into the create_slug()
> function in blogofile_blog/site_src/_controllers/blog/post.py

> I'd welcome a pull request for that.

as soon as i learn git a little bit, which will be slowed down by RL-
stuff.

> > also, i had to modify _controllers/blog/post.py/create_permalink() so
> > it now uses config.slugify, if exists (it must be a bug).
> > works with both posts and categories.

> I'm pretty sure that if you make the change in create_slug() it will
> flow through to permalink pages and categories too.

of course, but blog.post.slugify setting doesn't work as intended (at
least, it doesn't affect path).

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Wasil Sergejczyk  
View profile   Translate to Translated (View Original)
 More options May 29 2012, 3:08 am
From: Wasil Sergejczyk <szelga....@gmail.com>
Date: Tue, 29 May 2012 00:08:08 -0700 (PDT)
Local: Tues, May 29 2012 3:08 am
Subject: Re: true unicode slugs (blogofile 0.8dev, python3)
> > I'd welcome a pull request for that.

> as soon as i learn git a little bit, which will be slowed down by RL-
> stuff.

also, i'd like to add slugging for categories and avoiding doubling of
categories' names and posts' paths first.
in order to implement the latter feature i should keep track of Post
and Category instances. i'm planning to do it like this:
http://stackoverflow.com/questions/328851/python-printing-all-instanc...
(see "Use a mixin and weakrefs" section). is that OK?

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Wasil Sergejczyk  
View profile   Translate to Translated (View Original)
 More options May 31 2012, 3:36 am
From: Wasil Sergejczyk <szelga....@gmail.com>
Date: Thu, 31 May 2012 00:36:12 -0700 (PDT)
Local: Thurs, May 31 2012 3:36 am
Subject: Re: true unicode slugs (blogofile 0.8dev, python3)

ok, nevermind my pull request. i think, slugging would be better moved into
blogofile core, because other plugins (there isn't any, but i can think of
a couple and definitely will be making them after this) might want to use
that too. so, will i redo this?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Doug Latornell  
View profile  
 More options May 31 2012, 1:19 pm
From: Doug Latornell <d...@douglatornell.ca>
Date: Thu, 31 May 2012 10:19:19 -0700
Local: Thurs, May 31 2012 1:19 pm
Subject: Re: true unicode slugs (blogofile 0.8dev, python3)

On Thu, May 31, 2012 at 12:36 AM, Wasil Sergejczyk <szelga....@gmail.com> wrote:
> ok, nevermind my pull request. i think, slugging would be better moved into
> blogofile core, because other plugins (there isn't any, but i can think of a
> couple and definitely will be making them after this) might want to use that
> too. so, will i redo this?

Don't be too hasty to abandon that pull request!

I'm not sure where you are thinking about putting the slugify code in
blogofile core, but don't plan on it going anywhere under site_init/.
If the work I'm doing now on refactoring the `blogofile init` command
goes as I hope site_init/ should disappear from blogofile core.
Anything that we want to keep from there should go into one or more
plugins.

Have a look at https://groups.google.com/d/topic/blogofile-discuss/GO6_q29zZpk/discu...
both the Google doc in Ryan's post that heads the thread, and the
discussion. That will give you some idea of the design that the
plugins branch is aiming for.

I can understand that if you see multiple uses for the slugify code
among plugins, you don't want to repeat it. I just don't know right
now what the right mechanism is to facilitate that.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Wasil Sergejczyk  
View profile  
 More options May 31 2012, 1:32 pm
From: Wasil Sergejczyk <szelga....@gmail.com>
Date: Thu, 31 May 2012 23:32:39 +0600
Local: Thurs, May 31 2012 1:32 pm
Subject: Re: true unicode slugs (blogofile 0.8dev, python3)

i thought something like that: in plugin you can write, say,
from blogofile.tools import create_slug
but the exact place is yours to decide.

2012/5/31 Doug Latornell <d...@douglatornell.ca>

--
Best regards.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mike Pirnat  
View profile  
 More options May 31 2012, 1:40 pm
From: Mike Pirnat <mpir...@gmail.com>
Date: Thu, 31 May 2012 13:40:15 -0400
Local: Thurs, May 31 2012 1:40 pm
Subject: Re: true unicode slugs (blogofile 0.8dev, python3)

Was just about to advocate the same sort of thing, though we should take care that this "junk drawer" doesn't get too cluttered over time.

--
Mike Pirnat / mpir...@gmail.com
"I am a leaf on the wind; watch how I soar."

On May 31, 2012, at 1:32 PM, Wasil Sergejczyk <szelga....@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Doug Latornell  
View profile  
 More options Jun 1 2012, 1:23 am
From: Doug Latornell <d...@douglatornell.ca>
Date: Thu, 31 May 2012 22:23:49 -0700
Local: Fri, Jun 1 2012 1:23 am
Subject: Re: true unicode slugs (blogofile 0.8dev, python3)

On Thu, May 31, 2012 at 10:32 AM, Wasil Sergejczyk <szelga....@gmail.com> wrote:
> i thought something like that: in plugin you can write, say,
> from blogofile.tools import create_slug
> but the exact place is yours to decide.

Yeah, okay, that works for me.

We already have a "junk drawer" (as Mike calls it) - blogofile.util.
So, I guess that's where create_slug() should go.

I'd prefer to call it blogfile.tools, but I don't think we need util
and tools. And I don't have a good sense yet for what kind of
backwards compatibility mess would result from moving the non-junk
from util into tools.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Wasil Sergejczyk  
View profile   Translate to Translated (View Original)
 More options Jun 2 2012, 2:03 am
From: Wasil Sergejczyk <szelga....@gmail.com>
Date: Fri, 1 Jun 2012 23:03:05 -0700 (PDT)
Local: Sat, Jun 2 2012 2:03 am
Subject: Re: true unicode slugs (blogofile 0.8dev, python3)

ok, i'm on it. will make a branch in a few days.

пятница, 1 июня 2012 г., 11:23:49 UTC+6 пользователь Doug Latornell написал:

пятница, 1 июня 2012 г., 11:23:49 UTC+6 пользователь Doug Latornell написал:

пятница, 1 июня 2012 г., 11:23:49 UTC+6 пользователь Doug Latornell написал:

пятница, 1 июня 2012 г., 11:23:49 UTC+6 пользователь Doug Latornell написал:

...

read more »


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Wasil Sergejczyk  
View profile  
 More options Jun 17 2012, 2:14 am
From: Wasil Sergejczyk <szelga....@gmail.com>
Date: Sat, 16 Jun 2012 23:14:54 -0700 (PDT)
Local: Sun, Jun 17 2012 2:14 am
Subject: Re: true unicode slugs (blogofile 0.8dev, python3)

i'm very sorry, but better late, than never. anyway, here are two pull
requests from me on github.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Doug Latornell  
View profile  
 More options Jun 18 2012, 4:04 pm
From: Doug Latornell <d...@douglatornell.ca>
Date: Mon, 18 Jun 2012 13:04:18 -0700
Local: Mon, Jun 18 2012 4:04 pm
Subject: Re: true unicode slugs (blogofile 0.8dev, python3)
No need to apologize, Wasil. There are lots of things in life that can
and should take precedence over writing code for blogofile!

Thanks for the pull requests. I'll take a look at them sometime this week.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »