-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Advanced options for kotti_blog #5
base: master
Are you sure you want to change the base?
Conversation
something was strange :P)
month and year, ordered descending. No filtering yet
some styling changes (I think it looks much nicer/cleaner this way, we can of course revert back to how it was)
cache but couldn't get it to work.
blog posts filtered by the provided tag (kinda hacky)
blog/categories/tag1/{page-number} or blog/view/{page-number} It's a bit hacky and I couldn't make it work with blog/{page-number} though ...
comments later, need sleep now o.O)
(note: ''.split('/') is not an empty list ... :P)
archives template
(enable/disable and nr. of categories/archives in sidebar), categories are now sorted on post numbers. Some minor cleaning and making sure we use "categories" everywhere instead of "tags"
Thanks for the contribution, looks promising. The product was created while developing a costumer site, so it only fit the needs for the site. But would be great to have a full functioning blog system for Kotti. I will have a closer look to the code after the holidays, but feel free to add more commits backed with some tests. For now: Merry Christmas :) |
Cool, it'd be nice to have a second opinion on some of the stuff I did - there are some parts where I have the feeling there should be a better way (the hackish "super" views for instance) and I could really use some help in parts like caching (which I couldn't get to work any way I tried :P) Anyway, we'll continue this when you go through the code, if I'll work on it more I'll be sure to commit/push and possibly update the PR. Merry Christmas to you too! |
on the speed (in my case it was very marginally faster this way - around 0.1s with 3000 entries when running in development mode while using sqlite) - when we succesfully use caching, this should be faster.
shown" option, it shows all (updated the description of settings too)
@@ -33,6 +34,38 @@ class Blog(Document): | |||
addable_to=[u'Document'], | |||
) | |||
|
|||
def get_children_with_permission(self, request): | |||
return self.children_with_permission(request) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why children_with_permission is reimplemented? Should be used directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought I'd need to use some extras here but it turned out I didn't - will fix this :)
<tal:block tal:repeat="tag item.tags"> | ||
<a href="${api.url(context)}categories/${tag}">${tag}</a><tal:block tal:condition="not: repeat.tag.end">,</tal:block> | ||
</tal:block></span> | ||
</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The categories should only be shown if there are tags for the blog entry.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, will add a check here
Thanks for this PR, great stuff. Some things that come up to my mind:
The only thing I'm really missing are the tests. Caching would be great, but can also be added later and also the misc features. |
On 01/07/2014 11:24 PM, Marco Scheidhuber wrote:
@nightmarebadger Try using "lru_cache" instead of "request_cache". It |
Thanks for the comments, I'll probably be able to play with it a bit till the end of the week and I'll try to get it ready (tests, changelog info etc.) so it could be merged and ready for other people to tinker around with it too. Will look at the "lru_cache" to see if I manage to get it to work, if I still can't I'll just get it ready for a merge and let @dnouri handle this part, since it isn't that important until someone actually has 100+ posts at least :P
I probably forgot some stuff so I'll probably write something more when I manage to look at this again :) |
On 01/08/2014 04:04 PM, Natan Žabkar wrote:
I think even kotti_disqus should be its own add-on. |
@nightmarebadger: I find some time to play. I created a branch with the same name in the kotti_blog repository(https://github.com/Kotti/kotti_blog/tree/advanced-blog), included your commits there and add some small changes and tests. If you want to work on this further, please update your fork and send pull requests to the branch advanced-blog. Sorry for any inconvenience that comes with this. Could you also add your changes into the changelog? |
And I included social media buttons to the blog entry view. I used the fork https://github.com/patrickheck/socialshareprivacy/ of http://www.heise.de/extras/socialshareprivacy/. The basic js and css files are included untouched into the package so it can easily be updated. Would be great to get your opinion on this. |
A while ago I tried playing around with kotti_blog a bit and figured out it just isn't (for the lack of a better word) advanced enough to be of any real use as a blogging platform.
Now that I actually have some minor experience with creating / writing a blog, I've decided to work on this a bit :).
I'll put a list of what I would like to see and what I've already implemented here below, but be sure to drop any ideas you have here.
Sidebar
Create a sidebar that will automatically show your tags/archives etc. (on which you can actually filter).
We get the needed data directly from the Blog object methods. If we manage to cache them correctly, this should be fast (look at the problems section).
Filtering
Create options for filtering on tags/archives etc.
Everything that has to do with getting the tags/archives is inside Blog object methods. I've tried to cache those calls server-side so they'd only be calculated once before changing, but I couldn't get it to work. I tried using Kotti's
request_cache
like in https://github.com/Kotti/Kotti/blob/master/kotti/security.py and while it worked for multiple calls inside the same view, the cache was reset each time I refreshed ... Anyway, if anyone can tell me how to use it correctly it'd be great :)I've also created a way to filter via URL's like
etc., with pagination now working via URL's like
or simply
This is done in a kind of hackish way - I've created a "super" view that parses the URL and calls the view needed (e.g. categories list or main view with proper parameters passed in.
Misc
Comments
Settings
I want to extend the settings view to also include:
Extras
Definitely not needed but would be fun extra goodies to have
There are probably more things that could be done, but those were the things that sprung to mind the most. Feel free to check out what I've already done or comment on what you'd like to see.
Problems