[mezzanine-users] mezzanine on elastic beanstalk

2014-03-04 Thread Craig Miwa
I was wondering if anyone has tried to deploy mezzanine on an AWS elastic 
beanstalk instance?

I tried just for fun and got some errors with regard to wsgi.py

[Wed Mar 05 02:48:12 2014] [error] [client 127.0.0.1] mod_wsgi (pid=28016): 
Exception occurred processing WSGI script '/opt/python/current/app/wsgi.py'.
[Wed Mar 05 02:48:12 2014] [error] [client 127.0.0.1] Traceback (most recent 
call last):
[Wed Mar 05 02:48:12 2014] [error] [client 127.0.0.1]   File 
"/opt/python/run/venv/lib/python2.7/site-packages/django/core/handlers/wsgi.py",
 line 187, in __call__
[Wed Mar 05 02:48:12 2014] [error] [client 127.0.0.1] self.load_middleware()
[Wed Mar 05 02:48:12 2014] [error] [client 127.0.0.1]   File 
"/opt/python/run/venv/lib/python2.7/site-packages/django/core/handlers/base.py",
 line 49, in load_middleware
[Wed Mar 05 02:48:12 2014] [error] [client 127.0.0.1] mw_instance = 
mw_class()
[Wed Mar 05 02:48:12 2014] [error] [client 127.0.0.1]   File 
"/opt/python/run/venv/lib/python2.7/site-packages/django/middleware/locale.py", 
line 24, in __init__
[Wed Mar 05 02:48:12 2014] [error] [client 127.0.0.1] for url_pattern in 
get_resolver(None).url_patterns:
[Wed Mar 05 02:48:12 2014] [error] [client 127.0.0.1]   File 
"/opt/python/run/venv/lib/python2.7/site-packages/django/core/urlresolvers.py", 
line 346, in url_patterns
[Wed Mar 05 02:48:12 2014] [error] [client 127.0.0.1] patterns = 
getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
[Wed Mar 05 02:48:12 2014] [error] [client 127.0.0.1]   File 
"/opt/python/run/venv/lib/python2.7/site-packages/django/core/urlresolvers.py", 
line 341, in urlconf_module
[Wed Mar 05 02:48:12 2014] [error] [client 127.0.0.1] self._urlconf_module 
= import_module(self.urlconf_name)
[Wed Mar 05 02:48:12 2014] [error] [client 127.0.0.1]   File 
"/opt/python/run/venv/lib/python2.7/site-packages/django/utils/importlib.py", 
line 40, in import_module
[Wed Mar 05 02:48:12 2014] [error] [client 127.0.0.1] __import__(name)
[Wed Mar 05 02:48:12 2014] [error] [client 127.0.0.1] ImportError: No module 
named app.urls


Not sure what I have configured incorrectly.


Thx

-- 
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] Mezzanine Forms spam

2014-03-04 Thread Danny
You can use the SPAM_FILTERS setting to set a list of handlers that
check form and comment submission for spam.
The default uses Akismet (if you have it set up in your site
settings), but you could easily add your own.

For example, I have added the following to my site. I've genericised
this code a bit:

=
# settings.py
SPAM_FILTERS = ("mytheme.views.is_spam",)

# mytheme/views.py
def is_spam(request, form, url):
"""
Validates form data as being 'spam' or not based on a validation question.
Essentially this should be a field in the form always added that has the
following properties:

Label: *must* contain the string "validation code".
Type: Single Line Text
Required: True
Visible: True
Default: None
Help Text: something useful as to why this question is being asked

The answer for this example is "foobarqux" but you should change
it as appropriate

NOTE: The form submisison goes through regardless, the entry is
just not saved/emailed if
the answer is incorrect.
"""
for name, field in form.fields.items():
if field.label and "validation code" in field.label.lower():
cleaned_data = form.cleaned_data.get(name)
if "foobarqux" in cleaned_data.lower():
# The form field was filled correctly! It's likely not spam!
return False
else:
# It's spam, not good
return True
# else there's no "validation code" field in the form, so we
accept all submissions
return False

=

So for the forms that require the validation question, just add a
field to your form following the comments above, and forms which
answer incorrectly will be treated as spam.

Unfortunately, this mechanism does not reject the form and tell the
user they got the question wrong, it just prevents the form submission
from being emailed.
If anyone has an easier solution so that form validation can be done
/prior/ to the submission being accepted, I'd love to see it too.

Seeya. Danny.


On 5 March 2014 10:12, Josh Cartmell  wrote:
> Lately I've had a lot of clients (and a site of my own) getting a lot of
> spam submitted to Mezzanine forms.
>
> I'm wondering if anyone else has encountered this and/or has ideas/solutions
> to cut down on spam submissions.
>
> 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-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.



-- 
molo...@gmail.com

-- 
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 Forms spam

2014-03-04 Thread Josh Cartmell
Lately I've had a lot of clients (and a site of my own) getting a lot of
spam submitted to Mezzanine forms.

I'm wondering if anyone else has encountered this and/or has
ideas/solutions to cut down on spam submissions.

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-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [mezzanine-users] CSRF fails on login during automated testing. Issue with caching on non-anonymous?

2014-03-04 Thread Stephen McDonald
There are a few moving parts here, my guess is something failing in the
last of these:

By default in Mezzanine, forms use the "fields_for" template tag, which is
just a helper for rendering forms:
https://github.com/stephenmcd/mezzanine/blob/master/mezzanine/core/templates/includes/form_fields.html

You'll see at the top of its template, it uses the "nevercache" tag which
is fairly self explanatory - it's wrapped around the csrf token so that
it's never cached.

Then finally you'll see in both phases of the caching middleware, special
handling of the csrf token is required:

https://github.com/stephenmcd/mezzanine/blob/master/mezzanine/core/middleware.py#L169-L181
https://github.com/stephenmcd/mezzanine/blob/master/mezzanine/core/middleware.py#L210-L213

It's likely that last part is somehow incompatible with LiveServerTestCase
- I personally haven't used that before, but with regular Django test cases
I've experienced a lot of differences in how sessions, request objects and
everything related, actually work, compared to an actual running site.

My advice would be to first verify these forms actually work for you in
production, so that you can isolate this issue down to testing only, and
then unless you're feeling particularly adventurous, disable caching for
those particular tests that are failing - I understand there's a decorator
in Django for modifying settings per test, but the name escapes me.

Good luck!



On Wed, Mar 5, 2014 at 9:48 AM,  wrote:

> Hi,
>
> I'm using LiveServerTestCase, as described 
> here,
> to automate remote staging testing my site which uses mezzanine 3.0.9.  The
> automated tests involve logging and out different users, sometimes quite
> rapidly.  When caching is turned on as per the settings in
> live_settings.py, I get CSRF errors on login. If I turn off caching to
> memcache, I don't get the errors.
>
> I see that the UpdateCache middleware will go to cache if the user is
> anonymous.  At the time the user fills out the login form, they are
> anonymous so therefore the login page must be cached, which is causing
> my CSRF failures (?).  Unless I'm missing something, this is also true for
> the signup page.  It seems like this could be a problem if people submit,
> say, a login or signup form with errors, that then happens to get cached
> and shown to the next user.
>
> Shouldn't there be a strategy to not cache these forms?
>
> Jennifer
>
> --
> 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.
>



-- 
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] CSRF fails on login during automated testing. Issue with caching on non-anonymous?

2014-03-04 Thread jenniferlianne
Hi,

I'm using LiveServerTestCase, as described 
here,
 
to automate remote staging testing my site which uses mezzanine 3.0.9.  The 
automated tests involve logging and out different users, sometimes quite 
rapidly.  When caching is turned on as per the settings in 
live_settings.py, I get CSRF errors on login. If I turn off caching to 
memcache, I don't get the errors.

I see that the UpdateCache middleware will go to cache if the user is 
anonymous.  At the time the user fills out the login form, they are 
anonymous so therefore the login page must be cached, which is causing 
my CSRF failures (?).  Unless I'm missing something, this is also true for 
the signup page.  It seems like this could be a problem if people submit, 
say, a login or signup form with errors, that then happens to get cached 
and shown to the next user.

Shouldn't there be a strategy to not cache these forms?

Jennifer

-- 
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: Manually add items to an order (Custom host-to-order)

2014-03-04 Thread Hagan Franks
Solved my own problem.. Turns out i had an error during the post callback, 
causing that section of code to never evaluate.

-- 
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: Admin navigation

2014-03-04 Thread Josh Cartmell
While I'm thinking of it, I think the reason for the omni present scroll
bar is that .dropdown-menu ul has 200px margin on the bottom.  That means
that even if the menu content wouldn't spill off the screen the extra 200px
could make it.  Removing that should probably fix that issue.


On Tue, Mar 4, 2014 at 12:27 PM, Stephen McDonald  wrote:

> Ed, yes to everything - let's use that theme, and please help out with
> those regressions you've found.
>
> Thanks a lot!
>
>
> On Wed, Mar 5, 2014 at 1:40 AM, Eduardo Rivas wrote:
>
>> Wow guys, excellent work you've done here! It's amazing how different the
>> admin looks with this tweaks. Now, I have a few questions:
>>
>>1. Would you be interested in using an alternate theme for TinyMCE?
>>I've been using this for several projects:
>>http://thebigreason.com/blog/2008/09/29/thebigreason-tinymce-skin. It
>>only involves dropping a folder into the TinyMCE files and changing a
>>string in tinymce_setup.js.
>>2. Should we open a ticket to iron out the issues? The discussion is
>>alive and well here, but Github might be better for tracking progress and
>>referencing commits, etc.
>>3. I'm running the latest master branch from github in Firefox on my
>>Linux box and a couple of issues are evident:
>>   1. The font being used throughout the admin is now the system's
>>   default "sans-serif" font. It looks weird and huge, Arial looked better
>>   IMO. Perhaps what we are looking for is a better font stack, like 
>> Helvetica
>>   > Arial > sans-serif. That way we can get users in Mac, Linux and 
>> Windows
>>   to get the same look.
>>   2. The scrollbar is always visible in the navigation pane.
>>
>> I attach some screenshots to demonstrate the issues. I can contribute on
>> all the issues above if you like :)
>>
>>
>> 
>>
>> --
>> 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.
>>
>
>
>
> --
> 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.


Re: [mezzanine-users] Re: Admin navigation

2014-03-04 Thread Stephen McDonald
Ed, yes to everything - let's use that theme, and please help out with
those regressions you've found.

Thanks a lot!


On Wed, Mar 5, 2014 at 1:40 AM, Eduardo Rivas wrote:

> Wow guys, excellent work you've done here! It's amazing how different the
> admin looks with this tweaks. Now, I have a few questions:
>
>1. Would you be interested in using an alternate theme for TinyMCE?
>I've been using this for several projects:
>http://thebigreason.com/blog/2008/09/29/thebigreason-tinymce-skin. It
>only involves dropping a folder into the TinyMCE files and changing a
>string in tinymce_setup.js.
>2. Should we open a ticket to iron out the issues? The discussion is
>alive and well here, but Github might be better for tracking progress and
>referencing commits, etc.
>3. I'm running the latest master branch from github in Firefox on my
>Linux box and a couple of issues are evident:
>   1. The font being used throughout the admin is now the system's
>   default "sans-serif" font. It looks weird and huge, Arial looked better
>   IMO. Perhaps what we are looking for is a better font stack, like 
> Helvetica
>   > Arial > sans-serif. That way we can get users in Mac, Linux and 
> Windows
>   to get the same look.
>   2. The scrollbar is always visible in the navigation pane.
>
> I attach some screenshots to demonstrate the issues. I can contribute on
> all the issues above if you like :)
>
>
> 
>
> --
> 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.
>



-- 
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] Manually add items to an order (Custom host-to-order)

2014-03-04 Thread Hagan Franks
So first off, I needed to create a custom host-to-order processor for 
mezzanine cartridge.  I'm using an older version of 
mezzanine(1.4.5)/cartridge(0.8.2) and due to the way this project was 
initial started, i'm sort of stuck with this (forked/custom) set of code. 
I'll update when i've got time, but for now, I'm almost done with the 
host-to-order.  The one last key issue I have is with adding items to the 
order object. I'm using cybersource secure acceptance and I have a working 
order/checkout that creates Order objects after a purchase.  

How do I create the order's items without using the shopping cart. I'm 
passing an encrypted session key to the callback which cybersource passes 
back to me so I could dig up the cart but i'd rather not use its contents 
as you could change that before the bank authorizes payment :)..  I'm 
passing all the item data through the bank's authorizer as well 
(instance.item_set) and so...

for item in instance.item_set.all():
# item is a dict has everything defined similarly to the 
SelectedProject object.
# so we have sku, description, quantity, unit_price, total_price (data 
from cybersource)
#copy the dict
order_item = dict([(f, getattr(item, f)) for f in product_fields])
#guessing this creates the item for the order (but doesn't seem to work)
order.items.create(**order_item)

## Update stocks of the product
try:
variation = ProductVariation.objects.get(sku=item.sku)
except ProductVariation.DoesNotExist:
logger.info("ProductVariation didn't exist")
pass
else:
variation.update_stock(item.quantity * -1)
variation.product.actions.purchased()

My question, how do i manually create the items in the order.  I found this 
code in the class Order, (setup & complete functions) within the 
cartridge/shop/models.py file so i've adapted that to fit my needs but it 
doesn't seem to work. Obviously I'm missing something.

thanks,

-hagan

-- 
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] fab all runs, but cannot access mezzanine admin page

2014-03-04 Thread Jesse Carrigan
Thanks for taking a look. I appreciate your validating the current Vagrant 
setup is more or less correct. I'll read through the docs and probably pipe 
the Fabric output to a file so I can see if there's an error or something 
that I'm missing as it runs through its paces.

-- 
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] Form validation in Page Processors

2014-03-04 Thread Josh Cartmell
So I'm not actually sure about adding extra validation to the Form content
type.  I would start by looking at the default form page processor,
https://bitbucket.org/stephenmcd/mezzanine/src/ea1095020def16365c418dd3a7541635d38a2916/mezzanine/forms/page_processors.py?at=default#cl-26
.

One problem you may run into is that I think that processor will always
run, afaik there isn't a way to unregister a particular processor.


On Tue, Mar 4, 2014 at 10:33 AM, Danny flack  wrote:

> Hey Josh,
>
> Thanks for that.
>
> I believe I have a grasp on validating a custom form and returning it in
> the page's context, but what would be the strategy when you've created a
> page that has the "Form" content model, where you dynamically define all
> the form fields in Mezzanine's admin?  Is it possible to add validation to
> those fields?
>
> I've attached a screenshot where the form fields were added.
>
> I may be going about this all wrong, but I just want to verify.
>
> Thanks
>
> On Tuesday, March 4, 2014 9:45:52 AM UTC-8, Josh Cartmell wrote:
>
>> Hey Danny,
>>
>> Check out the example at https://mezzanine.jupo.org/
>> docs/content-architecture.html#page-processors, I think it will get you
>> started down the right path and shows how to handle validation in a
>> processor.
>>
>>
>> On Tue, Mar 4, 2014 at 9:37 AM, Danny flack  wrote:
>>
>>> Is it possible to validate a form in a page processor?
>>>
>>> I know you're able to override the associated form by something like:
>>>
>>> *@processor_for('rsvp')*
>>> *def rsvp_form(request, page):  *
>>>
>>> *form = RsvpForm()  #  a custom form i created to override the
>>> page's form *
>>> *return {"form": form}*
>>>
>>> But how would you go about intercepting and adding custom validation to
>>> the default page's form?
>>>
>>> For instance, I am trying to do something like:
>>>
>>> *@processor_for('rsvp')*
>>> *def rsvp_form(request, page):  *
>>>
>>> *form = page.getAssociatedForm()  #  fabricated method to get the
>>> Page's form instance *
>>> *form.addError('Some Error')  #  add custom validation*
>>> *return {"form": form}*
>>>
>>>
>>> Am I going down the wrong path?  Is there another way to go about this?
>>>
>>>  --
>>> 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.
>

-- 
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] Form validation in Page Processors

2014-03-04 Thread Josh Cartmell
Hey Danny,

Check out the example at
https://mezzanine.jupo.org/docs/content-architecture.html#page-processors,
I think it will get you started down the right path and shows how to handle
validation in a processor.


On Tue, Mar 4, 2014 at 9:37 AM, Danny flack  wrote:

> Is it possible to validate a form in a page processor?
>
> I know you're able to override the associated form by something like:
>
> *@processor_for('rsvp')*
> *def rsvp_form(request, page):  *
>
> *form = RsvpForm()  #  a custom form i created to override the page's
> form *
> *return {"form": form}*
>
> But how would you go about intercepting and adding custom validation to
> the default page's form?
>
> For instance, I am trying to do something like:
>
> *@processor_for('rsvp')*
> *def rsvp_form(request, page):  *
>
> *form = page.getAssociatedForm()  #  fabricated method to get the
> Page's form instance *
> *form.addError('Some Error')  #  add custom validation*
> *return {"form": form}*
>
>
> Am I going down the wrong path?  Is there another way to go about this?
>
>  --
> 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] Form validation in Page Processors

2014-03-04 Thread Danny flack
Is it possible to validate a form in a page processor?

I know you're able to override the associated form by something like:

*@processor_for('rsvp')*
*def rsvp_form(request, page):  *

*form = RsvpForm()  #  a custom form i created to override the page's 
form*
*return {"form": form}*

But how would you go about intercepting and adding custom validation to the 
default page's form? 

For instance, I am trying to do something like:

*@processor_for('rsvp')*
*def rsvp_form(request, page):  *

*form = page.getAssociatedForm()  #  fabricated method to get the 
Page's form instance*
*form.addError('Some Error')  #  add custom validation*
*return {"form": form}*


Am I going down the wrong path?  Is there another way to go about this?

-- 
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: step by step mezzanine deployment

2014-03-04 Thread Ross Laird
I don't actually use Fabric, so I have been a bit hesitant to make 
suggestions here. But my guess is that you have one problem and one problem 
only, and it just keeps changing how it looks depending on what you do. To 
step through a solution to this, I would take Fabric out of the equation 
and get the database connection running properly from the command line only 
(using pg_dump, pg_restore, and syncdb). If those commands work from the 
command line, then the problem is in the Fabric configuration. If those 
commands do not work from the command line, then you have a connection 
problem that sounds like it is related to permissions. In that case, try 
using psql from the command line to see who owns the database you are 
trying to connect to. Take as many things out of this equation as you can. 
Get right down to the core of it: who owns the database, what it's called, 
what its permissions are, and so on. Your problem lies in one of these 
areas, I think. Everything else that you try to do (using Fabric, Django, 
etc.) will fail -- and will give you different error messages -- until this 
one thing is resolved.

Here's a working example. On my live system, if I type "psql" then "\l" 
(that's a backslash, then the lowercase letter L), I see this kind of thing:

rosslaird=# \l
  List of databases
   Name|   Owner   | Encoding |   Collate   |Ctype|   Access 
privileges   
---+---+--+-+-+---
 db_name   | joe   | UTF8 | en_US.UTF-8 | en_US.UTF-8 | 
 other_db  | mary  | UTF8 | en_US.UTF-8 | en_US.UTF-8 | 
 third_db  | ed| UTF8 | en_US.UTF-8 | en_US.UTF-8 | 
 postgres  | postgres  | UTF8 | en_US.UTF-8 | en_US.UTF-8 | 

... 

(8 rows)

I can see, very easily, who owns what. Then I can look at the permissions 
of the user who owns the database in question, by typing "\du" (backslash, 
the lowercase letters D and U). 
Start there and see what you find.



On Tuesday, 4 March 2014 00:05:31 UTC-8, Federico Bruni wrote:
>
> 2014-03-03 23:33 GMT+01:00 Ross Laird >:
>
>> Postgresql authentication can be tricky.
>> You may need to make changes to your pg_hba.conf file. Like so:
>>
>> # Database administrative login by Unix domain socket
>> local   all postgrespeer
>> # TYPE  DATABASEUSERADDRESS METHOD
>> # "local" is for Unix domain socket connections only
>> local   all all peer
>> # IPv4 local connections:
>> hostall all 127.0.0.1/32md5
>> # IPv6 local connections:
>> hostall all ::1/128 md5
>> # Allow replication connections from localhost, by a user with the
>> # replication privilege.
>> #local   replication postgrespeer
>> #hostreplication postgres127.0.0.1/32md5
>>
>>
> Ross, thanks for the tips!
> My pg_hba.conf is exactly the same.
>  
>
>> Also, this tutorial might help:
>>
>> http://rosslaird.com/blog/building-a-project-with-mezzanine/
>>
>
> I realized that I was not using the correct owner of the database on the 
> server
> I've tried changing listen_addresses to accept any using * (as in your 
> tutorial) and now I get a different error, which I translate as:
>
>  no entry in pg_hba.conf for host "x.x.x.x", user "project", database 
> "project", SSL disabled
>
> The host is my public IP. It's listening to any address but it needs a 
> specific entry for my IP, so I've added:
>
> hostall all x.x.x.x/32md5
>
> I've repeated the commands above to sync the databases and I got no 
> messages in the terminal.
>  However, the problem persists. I've also tried to repeat the deploy with 
> 'fab remove & fab create & fab deploy', but it's not using my database.
>
> My last option is manually dumping the database. So I tried:
>
> 1. fab create
> 2. pg_dump -Fc dbname > db.dump (on localhost and copied db.dump on the 
> server)
> 3. pg_restore -d project db.dump (on the server)
> 4. fab deploy
>
> But I get some errors when I run pg_restore and when I run 'fab deploy' I 
> get this error:
>
> django.db.utils.ProgrammingError: ERROR:  permission denied for the 
> relation django_content_type
>
> I'm starting running out of hope...
> Your tutorial  about deployment is still on your TODO list?
>
>
>

-- 
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: Installing Mezzanine on Vagrant

2014-03-04 Thread Josh Cartmell
To answer your last question Tom, fabric isn't intended to be used for
development, it is intended for production and will take a hosting
environment from blank OS to ready to serve your site automagically.


On Mon, Mar 3, 2014 at 9:25 PM, Stephen McDonald  wrote:

> As for the original issue, there's a clear note early on in Mezzanine's
> README covering the very steps necessary to avoid the problem you've hit:
> https://github.com/stephenmcd/mezzanine/#dependencies
>
> Ken's point was that if you spend the time up front understanding vagrant
> and fabric, you'll find that these very steps are automatically handled for
> you.
>
> As for the introductory questions asked just now around how these tools
> work, any reply given here would do an injustice to the excellent
> documentation these projects have, as well as the tutorials that exist -
> seek them out! Ken has posted references to this topic countless times on
> the list before.
>
>
>
>
>
> On Tue, Mar 4, 2014 at 3:06 PM, Tom Brander  wrote:
>
>> So.. Are you suggesting using Fabric instead of Pip for an initial
>> development install?? (seems to be at variance with the doc) but I'm trying
>> too understand...
>>
>>
>> On Monday, March 3, 2014 9:57:56 PM UTC-6, Kenneth Bolton wrote:
>>
>>> One great thing about the fabfile.py that ships with Mezzanine is that
>>> it contains the best practices of a bunch of developers across a half-dozen
>>> technologies - with no cruft - that can immediately go into version control
>>> and grow with your application. If you opt not to use Fabric to manage your
>>> deploy, use the default fabfile to guide whatever deployment or
>>> provisioning solution you choose.
>>>
>>> The lines from the fabfile that should help Tabs:
>>> https://github.com/stephenmcd/mezzanine/blob/master/
>>> mezzanine/project_template/fabfile.py#L351-L352
>>>
>>>
>>>
>>>
>>> On Mon, Mar 3, 2014 at 10:31 PM, Stephen McDonald wrote:
>>>
 Mezzanine's fabric recipe was entirely developed using vagrant - it's
 actually a perfect match.


 On Tue, Mar 4, 2014 at 2:29 PM, Tom Brander  wrote:

> Ken, he is just trying to install on a vagrant instance, presumably to
> give him a Linux VM on Windows?? Fabric doe not apply (yet)
> I was going to recommend Anaconda on Windows (to eliminate vagrant )
> but it seems from a quick check, Anaconda has some issues with Pillows as
> well (surprise..) I'm a bit out of touch with the PIL/Pillows state of the
> art on Windows...
>
> On Monday, March 3, 2014 9:09:41 PM UTC-6, Kenneth Bolton wrote:
>
>> "Use Fabric for repeatable installations", I repeat.
>>
>>
>> On Mon, Mar 3, 2014 at 9:47 PM, Tom Brander wrote:
>>
>>> Looks like you are missing the C compiler and perhaps the associated
>>> dev tools library...
>>>
>>>
>>> On Monday, March 3, 2014 2:40:17 PM UTC-6, Tabs wrote:

 Hi Mezzanine community,

 I am new to the Framework and I am trying to Setup a simple site
 using it.
 I am following the instructions posted here () and Setting up
 everything
 using Vagrant as virtualization Environment.  Everything was going
 fine
 until I tried to install Mezzanine.

 When running (sudo) pip install Mezzanine, I get an error on
 Pillow.  This
 is the last part of the log where the error appears.  Any ideas on
 how to
 fix it?

 Requirement already satisfied (use --upgrade to upgrade):
 future==0.9.0
 in /home
 /vagrant/.virtualenvs/blog/lib/python2.7/site-packages (from
 mezzanine)
 Downloading/unpacking pillow (from mezzanine)
   Running setup.py egg_info for package pillow

 Downloading/unpacking pytz (from tzlocal==1.0->mezzanine)
   Running setup.py egg_info for package pytz

 warning: no files found matching '*.pot' under directory 'pytz'
 warning: no previously-included files found matching
 'test_zdump.py'
 Requirement already satisfied (use --upgrade to upgrade): six
 in /home/vagrant/.
 virtualenvs/blog/lib/python2.7/site-packages (from
 bleach>=1.4->mezzanine)
 Downloading/unpacking html5lib>=0.999 (from bleach>=1.4->mezzanine)
   Running setup.py egg_info for package html5lib

 Downloading/unpacking oauthlib>=0.4.2 (from requests-
 oauthlib>=0.4->mezzanine)
   Running setup.py egg_info for package oauthlib

 Installing collected packages: pillow, pytz, html5lib, oauthlib
   Running setup.py install for pillow

 building 'PIL._imaging' extension
 gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall
 -Wstrict-pro
 totypes -fPIC -DHAVE_LIBZ
 -I/home/vagrant/.virtualenvs/blog/build/pillow/libIma

Re: [mezzanine-users] jquery resize error

2014-03-04 Thread Josh Cartmell
Good stuff, thanks


On Mon, Mar 3, 2014 at 10:21 PM, Stephen McDonald  wrote:

> Yep I found where it was originally introduced, and that was the intention.
>
> But it doesn't even work for me - I'm going to nuke it, so consider it
> fixed next release.
>
>
> On Tue, Mar 4, 2014 at 1:40 PM, Josh Cartmell wrote:
>
>> Off the top of my head I think it has something to do with
>> resizing/centering editable popups when the window is resized.
>>
>>
>> On Mon, Mar 3, 2014 at 4:19 PM, Stephen McDonald  wrote:
>>
>>> I don't recall the intention around this library's introduction - I'd be
>>> more than happy to remove it if someone can work out why it's there and
>>> that it's safe to remove.
>>>
>>>
>>> On Tue, Mar 4, 2014 at 11:16 AM, Ross Laird  wrote:
>>>
 I have finally got round to testing this out, and the fix does not
 actually work for me. The popups still do their thing, but the error
 persists.


  On Wed, Feb 19, 2014 at 9:36 AM, Josh Cartmell 
 wrote:

>  No problem Ross, did you give it a try and if so did it work for you
> as well?
>
>
> On Tue, Feb 18, 2014 at 7:32 PM, Ross Laird wrote:
>
>> Thanks for your work on this, Josh. Much appreciated.
>>
>> On Tuesday, 18 February 2014 09:37:57 UTC-8, Josh Cartmell wrote:
>>
>>> I never worried about it too much since it only affected admins.  In
>>> the past I've played around with popping up the editable form in a
>>> bootstrap modal, but that requires the site to use Bootstrap, which
>>> probably isn't a good assumption.
>>>
>>> I was just thinking (and tried it out which seemed to work) that we
>>> could change ba-resize to define a baresize event, instead of overriding
>>> jquery's default resize event.  Getting this working required two 
>>> changes.
>>> First change the beginning of https://github.com/stephenmcd/
>>> mezzanine/blob/faa736a0b42a6d6a92db13b46b9d32
>>> 2e2d5ffedc/mezzanine/core/static/mezzanine/js/jquery.ba-
>>> resize.min.js from
>>>
>>> e=$.resize=$.extend($.resize,{})
>>>
>>> to
>>>
>>> e=$.baresize=$.extend($.baresize,{})
>>>
>>> Then change https://github.com/stephenmcd/mezzanine/blob/
>>> faa736a0b42a6d6a92db13b46b9d322e2d5ffedc/mezzanine/core/
>>> static/mezzanine/js/editable.js#L68 to:
>>>
>>> $('.editable-original').on('baresize', function(e) {
>>>
>>> I did this and although I didn't test things super thoroughly the
>>> inline editing popups still pop up.
>>>
>>> There may be a better approach, but what do you guys think?
>>>
>>>
>>>
>>> On Mon, Feb 17, 2014 at 9:15 PM, Stephen McDonald wrote:
>>>
 I can tell you one thing at least, it only occurring when logged in
 as an admin user is no mystery - the file only gets used for the live
 editing:

 https://github.com/stephenmcd/mezzanine/blob/master/
 mezzanine/core/templates/includes/editable_loader.html

 I can't speak for the rest of it, its introduction was 2 years ago:

 https://github.com/stephenmcd/mezzanine/commit/
 faa736a0b42a6d6a92db13b46b9d322e2d5ffedc

 Seems to be related to managing the position of the live editing
 overlay - would welcome throwing out the lib in question if there's a
 better approach.



 On Tue, Feb 18, 2014 at 4:11 PM, Ross Laird wrote:

> That's interesting -- yes, I see this error only when I am logged
> in as admin.
> I have installed some extra javascript (such as headroom.js and
> the prettify jQuery plugin), so one of those could be interacting with
> ba-resize. But it's tough for me to know how to debug this further. 
> It's
> not a huge issue, as no regular user to the site will experience this 
> error.
>
>
> On Monday, 17 February 2014 17:54:30 UTC-8, Josh Cartmell wrote:
>
>> Hey Ross, I've seen this before.
>>
>> Tell me if I'm wrong but do you only see it when you log in as an
>> admin?  In my experience, it had something to do with a jquery script
>> trying to use the normal jquery resize functionality (
>> https://api.jquery.com/resize/) and not working because
>> ba-resize changes the way .resize works.
>>
>> Steve, I can't find/think of a concrete example off the top of my
>> head, but if I do I'll definitely post it up.
>>
>>
>> On Mon, Feb 17, 2014 at 5:36 PM, Stephen McDonald > > wrote:
>>
>>> Any hints on how to reproduce?
>>>
>>>
>>>  On Tue, Feb 18, 2014 at 11:59 AM, Ross Laird <
>>> ro...@rosslaird.com> wrote:
>>>
 I'm getting a javascript error ("Uncaught TypeError: cannot set
>>>

[mezzanine-users] Re: Admin navigation

2014-03-04 Thread Eduardo Rivas
Wow guys, excellent work you've done here! It's amazing how different the 
admin looks with this tweaks. Now, I have a few questions:

   1. Would you be interested in using an alternate theme for TinyMCE? I've 
   been using this for several projects: 
   http://thebigreason.com/blog/2008/09/29/thebigreason-tinymce-skin. It only 
   involves dropping a folder into the TinyMCE files and changing a string in 
   tinymce_setup.js.
   2. Should we open a ticket to iron out the issues? The discussion is 
   alive and well here, but Github might be better for tracking progress and 
   referencing commits, etc.
   3. I'm running the latest master branch from github in Firefox on my 
   Linux box and a couple of issues are evident:
  1. The font being used throughout the admin is now the system's 
  default "sans-serif" font. It looks weird and huge, Arial looked better 
  IMO. Perhaps what we are looking for is a better font stack, like 
Helvetica 
  > Arial > sans-serif. That way we can get users in Mac, Linux and Windows 
  to get the same look.
  2. The scrollbar is always visible in the navigation pane.
   
I attach some screenshots to demonstrate the issues. I can contribute on 
all the issues above if you like :)



-- 
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: step by step mezzanine deployment

2014-03-04 Thread Ken Bolton
Pro Tip

Assuming you have reasonable values in your settings.FABRIC, the following
Fabric commands run within your virtualenv will do the backup and restore.
I've pasted the code they run below each command.

$ fab backup
"pg_dump -Fc %s > %s" % (env.proj_name, filename)

$ fab restore
"pg_restore -c -d %s %s" % (env.proj_name, filename)

hth,
ken


On Tue, Mar 4, 2014 at 3:05 AM, Federico Bruni  wrote:

> 2014-03-03 23:33 GMT+01:00 Ross Laird :
>
> Postgresql authentication can be tricky.
>> You may need to make changes to your pg_hba.conf file. Like so:
>>
>> # Database administrative login by Unix domain socket
>> local   all postgrespeer
>> # TYPE  DATABASEUSERADDRESS METHOD
>> # "local" is for Unix domain socket connections only
>> local   all all peer
>> # IPv4 local connections:
>> hostall all 127.0.0.1/32md5
>> # IPv6 local connections:
>> hostall all ::1/128 md5
>> # Allow replication connections from localhost, by a user with the
>> # replication privilege.
>> #local   replication postgrespeer
>> #hostreplication postgres127.0.0.1/32md5
>>
>>
> Ross, thanks for the tips!
> My pg_hba.conf is exactly the same.
>
>
>> Also, this tutorial might help:
>>
>> http://rosslaird.com/blog/building-a-project-with-mezzanine/
>>
>
> I realized that I was not using the correct owner of the database on the
> server
> I've tried changing listen_addresses to accept any using * (as in your
> tutorial) and now I get a different error, which I translate as:
>
>  no entry in pg_hba.conf for host "x.x.x.x", user "project", database
> "project", SSL disabled
>
> The host is my public IP. It's listening to any address but it needs a
> specific entry for my IP, so I've added:
>
> hostall all x.x.x.x/32md5
>
> I've repeated the commands above to sync the databases and I got no
> messages in the terminal.
>  However, the problem persists. I've also tried to repeat the deploy with
> 'fab remove & fab create & fab deploy', but it's not using my database.
>
> My last option is manually dumping the database. So I tried:
>
> 1. fab create
> 2. pg_dump -Fc dbname > db.dump (on localhost and copied db.dump on the
> server)
> 3. pg_restore -d project db.dump (on the server)
> 4. fab deploy
>
> But I get some errors when I run pg_restore and when I run 'fab deploy' I
> get this error:
>
> django.db.utils.ProgrammingError: ERROR:  permission denied for the
> relation django_content_type
>
> I'm starting running out of hope...
> Your tutorial  about deployment is still on your TODO list?
>
>
>  --
> 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] fab all runs, but cannot access mezzanine admin page

2014-03-04 Thread Ken Bolton
In my local_settings.py, I create a FABRIC_VAGRANT(, optional FABRIC_DEV),
FABRIC_QA or FABRIC_STAGE, and FABRIC_PROD, all more or less identical
except for the LIVE_HOSTNAME and HOSTS. The other change is to REPO_URL.
For my "local" Vagrant, I use my local SCM (git), whereas the other
environments get code from the remote "origin".

If you are spending time thinking about IP ports and addresses – whether
gunicorn, postgres, memcached, or nginx – you are working on problems that
have already been solved. A close reading of the fabfile and
settings.FABRIC will point you to a solid configuration.

best,
ken


On Tue, Mar 4, 2014 at 1:44 AM, Stephen McDonald  wrote:

> To be clear - I say "forget the ports", which sounds like it entirely
> contradicts the rest of my "read the docs and understand what these things
> do" advice.
>
> What I mean to say is forget thinking in terms of running a development
> server, using a custom port etc - with the vagrant setup, you're working as
> though you're deploying to a production server, using the same workflow.
>
>
> On Tue, Mar 4, 2014 at 5:40 PM, Stephen McDonald  wrote:
>
>> You shouldn't need to do any of that. Here's my vagrantfile:
>>
>> Vagrant.configure("2") do |config|
>>   config.vm.box = "precise64"
>>   config.vm.network :private_network, ip: "10.10.10.10"
>> end
>>
>> Forget the ports. Your vagrant vm is synonymous with a production server
>> - you're deploying to it, and the various layers of nginx and gunicorn
>> should deal with it. SSH onto this server. Look at the config files
>> deployed there. Read each of the corresponding project's own documentation
>> on these config files, and what they mean.
>>
>>
>>
>>
>> On Tue, Mar 4, 2014 at 5:30 PM, Jesse Carrigan <
>> jesse.m.carri...@gmail.com> wrote:
>>
>>> I tried forwarding a port from my host machine and got the same result.
>>> With localhost:8080 forwarded to 80 on the guest machine, I get the message
>>> from ngnix. Forwarding localhost:8080 to 8000, I get no response.
>>>
>>> --
>>> 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.
>>>
>>
>>
>>
>> --
>> Stephen McDonald
>> http://jupo.org
>>
>
>
>
> --
> 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] Re: Using a foreign key in Model search_fields?

2014-03-04 Thread Lucian Corduneanu
I have the exact same problem. Stephen is there any other solution 
different from just copying it to keywords/description or even one custom 
text field? (redundant)
However this may slightly increase DB storage, but in terms of performance 
it will be a bit faster, not having to join the extra table when searching.

On Tuesday, February 18, 2014 5:48:21 AM UTC+2, step wrote:
>
> Hey guys, I can't figure this out.  I figured this might be something 
> worth resolving on the mailing list as a reference.  
> I'm trying to use a foreignkey in a Model's search_fields (search using a 
> foreignkey).
>
> Anyone have any idea?
>
> *settings.py*
> -
> (
> # Dotted path to field.
> "cartridge.shop.models.Product.artist",
> # Dotted path to field class.
> "ForeignKey",
> # Positional args for field class.
> ("app.Artist",),
> # Keyword args for field class.
> {"blank": False},
> )
>
> *OPTION 1.*
>
> patches.py
> 
> Product.search_fields = {'keywords_string': 10, 'title': 5, 'artist': 5}
>
> results in
> 
> "Related Field got invalid lookup: icontains"
>
>
> *OPTION 2*
>
> patches.py
> 
> Product.search_fields = {'keywords_string': 10, 'title': 5, 
> 'artist__title': 5}
>
> results in
> 
> "'Product' object has no attribute 'artist__title'"
>

-- 
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: step by step mezzanine deployment

2014-03-04 Thread Federico Bruni
2014-03-03 23:33 GMT+01:00 Ross Laird :

> Postgresql authentication can be tricky.
> You may need to make changes to your pg_hba.conf file. Like so:
>
> # Database administrative login by Unix domain socket
> local   all postgrespeer
> # TYPE  DATABASEUSERADDRESS METHOD
> # "local" is for Unix domain socket connections only
> local   all all peer
> # IPv4 local connections:
> hostall all 127.0.0.1/32md5
> # IPv6 local connections:
> hostall all ::1/128 md5
> # Allow replication connections from localhost, by a user with the
> # replication privilege.
> #local   replication postgrespeer
> #hostreplication postgres127.0.0.1/32md5
>
>
Ross, thanks for the tips!
My pg_hba.conf is exactly the same.


> Also, this tutorial might help:
>
> http://rosslaird.com/blog/building-a-project-with-mezzanine/
>

I realized that I was not using the correct owner of the database on the
server
I've tried changing listen_addresses to accept any using * (as in your
tutorial) and now I get a different error, which I translate as:

 no entry in pg_hba.conf for host "x.x.x.x", user "project", database
"project", SSL disabled

The host is my public IP. It's listening to any address but it needs a
specific entry for my IP, so I've added:

hostall all x.x.x.x/32md5

I've repeated the commands above to sync the databases and I got no
messages in the terminal.
However, the problem persists. I've also tried to repeat the deploy with
'fab remove & fab create & fab deploy', but it's not using my database.

My last option is manually dumping the database. So I tried:

1. fab create
2. pg_dump -Fc dbname > db.dump (on localhost and copied db.dump on the
server)
3. pg_restore -d project db.dump (on the server)
4. fab deploy

But I get some errors when I run pg_restore and when I run 'fab deploy' I
get this error:

django.db.utils.ProgrammingError: ERROR:  permission denied for the
relation django_content_type

I'm starting running out of hope...
Your tutorial  about deployment is still on your TODO list?

-- 
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.