Re: [mezzanine-users] Mezzanine 3.0.7 released

2014-02-01 Thread Josh Cartmell
Thanks Steve


On Sat, Feb 1, 2014 at 6:02 PM, Stephen McDonald  wrote:

> Hi all,
>
> I've just pushed Mezzanine 3.0.7 to PyPi
>
> This release contains a handful of minor bugfixes:
>
> - Duplicate blogs posts displayed with Django 1.6.1 when listing by tag
> - Error when clicking "lost password" link on admin login
> - Improved support for custom user models
> - Hide "in menus" page field when PAGE_MENU_TEMPLATES is empty
> - Handle multiple IP addresses returned by HTTP_X_FORWARDED_FOR header
> - Fix for unicode slugs in page processors
> - Hide comments link in blog post list for posts with comments disabled
> - Fixes for static_proxy
>
> Thanks to everyone for their ongoing contributions and support.
>
>
> --
> Stephen McDonald
> http://jupo.org
>
> --
> You received this message because you are subscribed to the Google Groups
> "Mezzanine Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to mezzanine-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[mezzanine-users] Mezzanine 3.0.7 released

2014-02-01 Thread Stephen McDonald
Hi all,

I've just pushed Mezzanine 3.0.7 to PyPi

This release contains a handful of minor bugfixes:

- Duplicate blogs posts displayed with Django 1.6.1 when listing by tag
- Error when clicking "lost password" link on admin login
- Improved support for custom user models
- Hide "in menus" page field when PAGE_MENU_TEMPLATES is empty
- Handle multiple IP addresses returned by HTTP_X_FORWARDED_FOR header
- Fix for unicode slugs in page processors
- Hide comments link in blog post list for posts with comments disabled
- Fixes for static_proxy

Thanks to everyone for their ongoing contributions and support.


-- 
Stephen McDonald
http://jupo.org

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[mezzanine-users] Change to Error Logging in Django 1.6.1/Mezzanine 3.0.6?

2014-02-01 Thread Danny

Hi all,

I recently upgraded my site to Mezzanine 3.0.6 and Django 1.6.1

Previously I was getting error reports sent to Errorstack using
https://bitbucket.org/carljm/django-errorstack with a modification of my 
own to make use of Django's logging feature. See below for the code.


Mostly the errors I saw every now and then were malware robots trying to 
get to certain common PHP pages using the site's IP address, and Django 
rejecting these due to my ALLOWED_HOSTS settings only including the 
domain name (and not the IP address). All good.


Since the upgrade I'm getting error reports directly emailed from Django
and with the error message in the subject line and
"No stack trace available

 Request repr() unavailable."
in the message body.

From what I can tell of the Django documentation, the Logging mechanism 
hasn't changed in 1.6.1 (compared to 1.5.x) but for some reason it 
doesn't seem like it's using my logger any more, and just using the 
default Django one.


Any suggestions? It's hard to replicate this locally as it's difficult 
to replicate the generation of errors (unless anyone has some 
suggestions on that too!)


Thanks,

Seeya. Danny.

My code:
===
# in local_settings.py

if not DEBUG:
LOGGING = {
'version' : 1,
'disable_existing_loggers': False,
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse',
},
},
'handlers' : {
'myerrorstack' : {
'level' : 'ERROR',
'filters' : ['require_debug_false'],
'class' : 'handlers.MyErrorStackHandler',
},
},
'loggers' : {
'django.request': {
'handlers' : ['myerrorstack'],
'level': 'ERROR',
'propagate': False,
},
},
}

==
# in handlers.py

import logging
import logging.handlers
import traceback
from errorstack import settings as errorstack_settings
from django.conf import settings
from django.views.debug import get_exception_reporter_filter


if errorstack_settings.STACK_KEY is None:
raise ImproperlyConfigured('ErrorStackHandler requires the '
   'ERRORSTACK_STACK_KEY setting.')

# This code modified from django-errorstack
# and borrowing stuff from django.utils.log.AdminEmailHandler
class MyErrorStackHandler(logging.handlers.HTTPHandler):
def __init__(self):
logging.handlers.HTTPHandler.__init__(self,
"www.errorstack.com",
"/submit?_s=%s&_r=json" % errorstack_settings.STACK_KEY,
"POST")

def mapLogRecord(self, record):
""" Define the values submitted to ErrorStack.com. """
keys = ['name', 'msg', 'levelname', 'module', 'pathname', 
'funcName',
'lineno', 'args', 'exc_text', 'threadName', 'thread', 
'process',

'asctime']
info = {}
for key in keys:
info[key] = record.__dict__.get(key, '')
return info

def emit(self, record):
try:
request = record.request
subject = '%s (%s IP): %s' % (
record.levelname,
(request.META.get('REMOTE_ADDR') in settings.INTERNAL_IPS
 and 'internal' or 'EXTERNAL'),
record.getMessage()
)
filter = get_exception_reporter_filter(request)
request_repr = filter.get_request_repr(request)
except Exception:
subject = '%s: %s' % (
record.levelname,
record.getMessage()
)
request = None
request_repr = "Request repr() unavailable."
#
# subject = self.format_subject(subject)

if record.exc_info:
exc_info = record.exc_info
stack_trace = 
'\n'.join(traceback.format_exception(*record.exc_info))

else:
exc_info = (None, record.getMessage(), None)
stack_trace = 'No stack trace available'

message = "%s\n\n%s" % (stack_trace, request_repr)
#reporter = ExceptionReporter(request, is_email=True, *exc_info)
#html_message = self.include_html and 
reporter.get_traceback_html() or None
#mail.mail_admins(subject, message, fail_silently=True, 
html_message=html_message)

message = subject + "\n\n" + message
# Create a new record, overriding the message with our verbose 
traceback

newrecord = record.__dict__
newrecord['msg'] = message
newrecord = logging.makeLogRecord(newrecord)
# Call the baseclass emit to send the HTTP post to errorstack
logging.handlers.HTTPHandler.emit(self, newrecord)

===

--
Email: molo...@gmail.com

--
You received this message because you are subscribed to the Google Groups "Mezzanine 
Users" group.

[mezzanine-users] Re: Problem moving or adding pages from the admin

2014-02-01 Thread Jake Schmitz
So I tried deleting my static admin directory and collecting new static 
files under admin (for most up to date js) and I am still getting the same 
javascript errors. I really have no idea what to do

On Tuesday, January 28, 2014 6:39:12 PM UTC-8, Jake Schmitz wrote:
>
> Yes. Here is the log I get when I load up the admin page to add pages.
>
>
>1. Uncaught TypeError: Property '$' of object [object Object] is not a 
>function 
> Changelist.js:1
>   1. (anonymous 
> function)Changelist.js:1
>   
>
>1. Uncaught TypeError: Property '$' of object [object Object] is not a 
>function 
> page_tree.js:31
>   1. (anonymous 
> function)page_tree.js:31
>   
>
>1. Uncaught TypeError: Property '$' of object [object Object] is not a 
>function 
> navigation.js:1
>   1. (anonymous 
> function)navigation.js:1
>   
>
>1. Uncaught TypeError: Cannot call method 'ajaxSetup' of undefined 
>
> ajax_csrf.js:1
>   1. (anonymous 
> function)ajax_csrf.js:1
>   
>
>1. Uncaught TypeError: Property '$' of object [object Object] is not a 
>function 
>
>
> On Friday, January 24, 2014 11:04:35 PM UTC-8, Ryan Sadwick wrote:
>>
>> Any javascript errors showing up in your browser's console?
>>
>> On Friday, January 24, 2014 11:22:59 PM UTC-5, Jake Schmitz wrote:
>>>
>>>
>>> For some reason I can only create pages from the quick add on the main 
>>> admin page. When I try to add a page from within the actual list of all my 
>>> pages, nothing happens. I cannot move the order of my pages around nor can 
>>> I add a nested page. Any help would be appreciated.
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [mezzanine-users] Re: editable homepage, theme and mobile

2014-02-01 Thread Josh Cartmell
That seems like an approach that could work.  I think the mobile device
handling was made before making the homepage editable was enabled so it's
definitely possible that their are some conflicts.

I think when the homepage is editable it will specifically look for a
template called pages/index.html so that may be why the mobile device
handling isn't working, I could be totally off on that.

Let us know how it goes.


On Sat, Feb 1, 2014 at 7:14 AM, Andrew Smith
wrote:

> Ok,
>
> I am thinking i'll need to some middleware to my theme to do the homepage
> redirection.
>
> It would be great if I could do this at the template level, something like:
>
> {% if request.mobile%}
>
> {% include "mobile/index.html" %}
>
> {% else %}
>
> ...
>
> any other ideas out there?
>
>
>
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Mezzanine Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to mezzanine-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [mezzanine-users] Re: to add blog category and month as filters to keywords_for tag

2014-02-01 Thread Andrey M
I made it working in this way

 (my copy of kewords_tags.py):
..
if len(args) > 1:
   filters = {args[1]: args[2]}
else:
   filters = {}

content_type = ContentType.objects.get(app_label=app_label, model=model)
contents = ContentType.get_all_objects_for_this_type(content_type, 
**filters)
assigned = AssignedKeyword.objects.filter(object_pk__in=contents)
keywords = Keyword.objects.filter(assignments__in=assigned)
keywords = keywords.annotate(item_count=Count("assignments"))
..

and the following usage is applied in this case:
{% keywords_for blog.blogpost categories category as tags %}

It is working now but I have the following questions:

1) from performance perspective it seems for me to be not optimal because 
it cases execution of sub-query which selects all blog posts
2) this code with len(args)>1 check and get_all_objects_for_this_type is 
not perfect

Can any improvements be done for this code?

суббота, 1 февраля 2014 г., 2:33:01 UTC+4 пользователь Josh Cartmell 
написал:
>
> I think you would need to write your own keywords_for template tag that 
> takes the current category into account and only finds keywords in blog 
> posts in the current category.
>
> Here is the current keywords_for:
>
> https://bitbucket.org/stephenmcd/mezzanine/src/f1ec23fedac2eaeae18a963c2fea382e23f7ccea/mezzanine/generic/templatetags/keyword_tags.py?at=default
>
>
> On Fri, Jan 31, 2014 at 2:22 PM, Andrey M 
> > wrote:
>
>> Any ideas?
>>
>> среда, 29 января 2014 г., 0:33:35 UTC+4 пользователь Andrey M написал:
>>
>>> Hi All
>>>
>>> I develop the blog where blog categories are shown on different pages.
>>> So I'd like to  show Tags and Archive (months) items only for current 
>>> category.
>>>
>>> As I can see, currently, it is not supported.  "keywords_for" doesn't 
>>> have category/archive filters.
>>> Could you please advise what the best way to implement it?
>>>
>>> May it be added to the next Mezzanine release? 
>>>
>>> Thanks
>>>
>>  -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Mezzanine Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to mezzanine-use...@googlegroups.com .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[mezzanine-users] Re: editable homepage, theme and mobile

2014-02-01 Thread Andrew Smith
Ok, 

I am thinking i'll need to some middleware to my theme to do the homepage 
redirection. 

It would be great if I could do this at the template level, something like:

{% if request.mobile%}

{% include "mobile/index.html" %}

{% else %}

...

any other ideas out there? 





-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [mezzanine-users] make the main page(index.html) changed into the shopping page (category.html)

2014-02-01 Thread lu zou
get it done already! didnot change the category.html into index.html , just 
change it ,it works!

On Saturday, 1 February 2014 11:55:25 UTC+10, Josh Cartmell wrote:
>
> Your slug isn't a slug it's the name of a template.  Look in the default 
> urls.py provided in a mezzanine project and there is an example of how to 
> make the home page an editable page.
>
>
> On Fri, Jan 31, 2014 at 5:21 PM, lu zou  >wrote:
>
>>   using this code to point the main page tot he category page , still 
>> donot work , the error turn out to be : page not found.
>>
>>  url("^$", "mezzanine.pages.views.page", {"slug": "pages/category.html"}, 
>> name="home"),
>>
>>
>> On Friday, 31 January 2014 10:19:09 UTC+10, Stephen McDonald wrote:
>>
>>> I would look at making the homepage a page object in the page tree - 
>>> this page could be a shop category, which is a type of page itself.
>>>
>>> http://mezzanine.jupo.org/docs/frequently-asked-
>>> questions.html#why-isn-t-the-homepage-a-page-object-i-can-
>>> edit-via-the-admin
>>>
>>>
>>> On Fri, Jan 31, 2014 at 10:15 AM, lu zou  wrote:
>>>
   
 using mezzanine and cartridge: want to make the main page (index,html) 
 into the shopping main page(category.html ) ,using shopping main page as 
 the main page

this code below doesnot work ,have any suggestion ,seems a easy 
 question ,but I have tried for long , using a lot of alternative, they 
 donot word:(


   url("^$", page, {"slug": "/", "template": "../../mezzanine_themes/
 oztrend/templates/pages/category.html" }, name="home"),


 PS :

 ../../mezzanine_themes/oztrend/templates/pages/category.html 
  ---is where category.html located
  

 -- 
 You received this message because you are subscribed to the Google 
 Groups "Mezzanine Users" group.
 To unsubscribe from this group and stop receiving emails from it, send 
 an email to mezzanine-use...@googlegroups.com.

 For more options, visit https://groups.google.com/groups/opt_out.

>>>
>>>
>>>
>>> -- 
>>> Stephen McDonald
>>> http://jupo.org 
>>>
>>  -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Mezzanine Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to mezzanine-use...@googlegroups.com .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[mezzanine-users] [FIXED] Cartridge - product thumbnail generation failure

2014-02-01 Thread gmflanagan
Fixed, or at least worked around.

I had

MEDIA_URL = http://localhost/media/

in settings, which triggered this clause in the thumbnail template tag:

if "://" in settings.MEDIA_URL:
with open(thumb_path, "r") as f:
default_storage.save(thumb_url, File(f))

Not sure exactly why this fails, but there is an open file object (also 
called f) at this point, and the given code is trying to save to the same 
path represented by that object. (This is Ubuntu 12.04).

Anyway, changing to

MEDIA_URL = '/media/'

fixes the issue.


On Friday, January 31, 2014 6:06:13 PM UTC, Josh Cartmell wrote:
>
> Even though easy_thumbnail is working, I would still guess this has 
> something to do with PIL.  Try to pip install pillow on the live 
> environment and make sure that when it is finishing installing it says that 
> it has jpeg support.
>
> Hopefully you can get this worked out.
>
>
> On Fri, Jan 31, 2014 at 6:20 AM, gmflanagan 
> > wrote:
>
>> Hi
>>
>> Can't figure this out. It doesn't appear when working with the devserver 
>> and has only appeared when doing a local test deploy of a cartridge shop - 
>> so a nginx/gunicorn/django setup on the same box that I'm developing on.
>>
>> The issue is - no thumbnail is generated in the admin when a product 
>> image is uploaded.
>>
>> And this is a problem because, in the admin interface, a large image will 
>> swamp the product and product list tables (given a small laptop screen) and 
>> require horizontal-scroll to navigate.
>>
>> It looks like the "thumbnail" template tag 
>> (mezzanine.core.templatetags.mezzanine_tags) is failing somehow, but 
>> catching the Exception and falling back to just returning the original 
>> image.
>>
>> A file is actually created in the thumbnails directory, but it has zero 
>> bytes and has an indexed suffix, so
>>
>>   /product/IMG-123.JPG
>>
>> becomes
>>
>>   /product/.thumbnails/IMG-123-48x48_1.JPG
>>
>> Then it seems, each page view triggers another attempt to generate the 
>> thumbnail and you get:
>>
>>   /product/.thumbnails/IMG-123-48x48_2.JPG
>>   /product/.thumbnails/IMG-123-48x48_3.JPG
>>
>> etc.
>>
>> All zero byte files.
>>
>> All the files created have the correct file ownership and permissions.
>>
>> Also, in other parts of the site, I am using "easy_thumbnails" to 
>> generate thumbnails and there is no problem with that. So I'm not sure what 
>> is happening, since as far as I can see, both libraries are using PIL to do 
>> the image generation.
>>
>> It's probably something with my setup, since it works with local 
>> development, but it's still baffling me.
>>
>> I'm on the point of replacing the Mezzanine admin ImageWidget with the 
>> equivalent using easy_thumbnail, unless anyone has any ideas?
>>
>> jerd
>>
>>  -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Mezzanine Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to mezzanine-use...@googlegroups.com .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[mezzanine-users] Re: Cartridge - product thumbnail generation failure

2014-02-01 Thread gmflanagan


On Friday, January 31, 2014 2:20:11 PM UTC, gmflanagan wrote:
>
> Hi
>
> Can't figure this out. It doesn't appear when working with the devserver 
> and has only appeared when doing a local test deploy of a cartridge shop - 
> so a nginx/gunicorn/django setup on the same box that I'm developing on.
>
> The issue is - no thumbnail is generated in the admin when a product image 
> is uploaded.
>
> And this is a problem because, in the admin interface, a large image will 
> swamp the product and product list tables (given a small laptop screen) and 
> require horizontal-scroll to navigate.
>
> It looks like the "thumbnail" template tag 
> (mezzanine.core.templatetags.mezzanine_tags) is failing somehow, but 
> catching the Exception and falling back to just returning the original 
> image.
>
> A file is actually created in the thumbnails directory, but it has zero 
> bytes and has an indexed suffix, so
>
>   /product/IMG-123.JPG
>
> becomes
>
>   /product/.thumbnails/IMG-123-48x48_1.JPG
>
> Then it seems, each page view triggers another attempt to generate the 
> thumbnail and you get:
>
>   /product/.thumbnails/IMG-123-48x48_2.JPG
>   /product/.thumbnails/IMG-123-48x48_3.JPG
>
> etc.
>
> All zero byte files.
>
> All the files created have the correct file ownership and permissions.
>
> Also, in other parts of the site, I am using "easy_thumbnails" to generate 
> thumbnails and there is no problem with that. So I'm not sure what is 
> happening, since as far as I can see, both libraries are using PIL to do 
> the image generation.
>
> It's probably something with my setup, since it works with local 
> development, but it's still baffling me.
>
> I'm on the point of replacing the Mezzanine admin ImageWidget with the 
> equivalent using easy_thumbnail, unless anyone has any ideas?
>
> jerd
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[mezzanine-users] Re: Add main menu items for blog categories

2014-02-01 Thread Andrey M
Hi Alex

You can create 'Link' page, put it to any menu and set up the link in the 
page properties to the blog category manually like
/blog/category/YOUR_CATEGORY_NAME



суббота, 1 февраля 2014 г., 11:55:31 UTC+4 пользователь Alex Warren написал:
>
> Hello :)
>
> I am new to django/mezzanine and I noticed that the default blog page is 
> special and that it appends blogs entries to whatever you have as the main 
> content. I wanted to be able to make it so that it only contained blog 
> entries of a certain category and also would it be possible to have 
> multiple such pages in the main menu?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.