Re: Is it possible to use MS SQL 2008 as the Django database engine?

2011-12-08 Thread Petr Přikryl

Thanks, David, for the information.
Have a good time,
   Petr

__
> Od: "David Fischer" 
> Komu: 
> Datum: 03.12.2011 22:23
> Předmět: Re: Is it possible to use MS SQL 2008 as the Django database engine?
>
>It is possible. The two major projects that I know of are 
>django-pyodbcwhich I have used quite 
>a bit and 
>django-mssql  which I have not 
>used. 
>
>Django-mssql only works on Windows and I have no experience with it. As far 
>as I know, it uses the Microsoft drivers underneath so it probably works 
>fairly well.
>
>Django-pyodbc works on Linux or Windows but if you were building for 
>Windows, you would probably just use django-mssql. On Linux, you will need 
>either unixODBC or iODBC as well as FreeTDS. On Ubuntu or CentOS, these are 
>available from the package manager. Getting everything working is not 
>entirely trivial due to different authentication schemes with SQL Server 
>and some other intricacies. The code is not as seamless as the Django 
>supported backends and deciding to use django-pyodbc will probably mean 
>you'll have to learn the code line and submit a few patches. I use it 
>primarily to connect to a read-only legacy database and for that purpose it 
>works well. 
>
>-- 
>You received this message because you are subscribed to the Google Groups 
>"Django users" group.
>To view this discussion on the web visit 
>https://groups.google.com/d/msg/django-users/-/p9T8-gkZp0kJ.
>To post to this group, send email to django-users@googlegroups.com.
>To unsubscribe from this group, send email to 
>django-users+unsubscr...@googlegroups.com.
>For more options, visit this group at 
>http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Deployment problem

2011-12-08 Thread Hassan
Dear ALL,

I am new to django  , i am really worried about deployment  and i have
alot of questions , i hope you can help me guys .

First : I want to you ARVIXE for hosting  , thay dont have django
installed , what would i do when django is not installed and i want to
host a django project ??

Second : i want to use apachy and mod_python  , what is the structure
of my files , what to upload ?

 am sorry about this guys but am really lost ,
best regards ,
Hassan Alnatour ,


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Problem with "trans" and "blocktrans"

2011-12-08 Thread Andre Hagenbruch
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi all,

I have two files with equal strings to translate, in the first file
with "trans" and in the second file with "blocktrans" and a plural form:

a.html:
{% trans 'My string' %}

b.html:
{% blocktrans count counter=mylist|length %}My string{% plural %}My
strings{% endblocktrans %}

and when I run "django-admin.py makemessages -l de" I get

django.po
#: templates/a.html:108
#: templates/b.html:3
msgid "My string"
msgstr ""

and not as I'd expect

django.po
#: templates/a.html:108
#: templates/b.html:3
msgid "My string"
msgid_plural "My strings"
msgstr[0] ""
msgstr[1] ""

I can reproduce this for similar structures in other files.
"blocktrans" strings that don't have "trans" equivalents in other
files correctly produce entries with plural forms in the .po file.
What's going wrong here?

Any help would be greatly appreciated,

Andre
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk7gkRcACgkQZL0DjZDoBMXlMwCcDAlogdg7F6mtQYqqIxNqEY2y
Ne8AnAp8jtGs56WaWXFUTBKz8BlsDLYO
=JP45
-END PGP SIGNATURE-

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Deployment problem

2011-12-08 Thread Reinout van Rees

On 08-12-11 10:57, Hassan wrote:

I am new to django  , i am really worried about deployment  and i have
alot of questions , i hope you can help me guys .

First : I want to you ARVIXE for hosting  , thay dont have django
installed , what would i do when django is not installed and i want to
host a django project ??


ARVIXE has python on its list of supported tools, so that ought to be 
OK. I'd send them an email on how they normally host that.


Normally, if you have to do it manually, you'd install django and your 
own code in a separate directory somewhere. On the Django website, 
you'll find instructions on how to run Django as a so-called "WSGI" service.


WSGI means web server gateway interface, which is the standard way to 
connect from a webserver (apache, for instance) to python (and thus django).



Second : i want to use apachy and mod_python  , what is the structure
of my files , what to upload ?


mod_python is very outdated and unmaintained for years. Almost everyone 
uses wsgi (for apache: mod_wsgi) nowadays. Look a bit at the django 
documentation to get an idea.



Reinout

--
Reinout van Reeshttp://reinout.vanrees.org/
rein...@vanrees.org http://www.nelen-schuurmans.nl/
"If you're not sure what to do, make something. -- Paul Graham"

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Hadware and software configuration for django web application

2011-12-08 Thread Tom Evans
On Thu, Dec 8, 2011 at 11:26 AM, pritesh modi  wrote:
> Hi Guys
>
>    Please suggest me the hardware and software configurartion
> details like operating system,required software,machine details for
> production server of django-website application.it is saas based
> architecture application.and also going to add more plug ins application as
> required in application.
>
> To  run the django application in production server this things are required
> to check with better performance,speed and scalability wise.
>
> Any suggestion will be appericiated
>

I want a piece of string to go from here to there, how long should it be?

You need to write the app, load test it and extrapolate performance
from that. A Django app could be fast or it could be slow, it could
use a lot of memory or it could use a tiny amount of memory, it could
be IO intensive or it could never touch the disk, it could hammer the
database constantly or it could barely use a database at all - it all
depends on what your app does and how it does it.

We can't tell you that. Only you can tell yourself that.

Cheers

Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



DoS susceptability via email logging

2011-12-08 Thread Sam Berry
Hello there,

I am currently running a number of small sites using logging via email
to notify me of 404s and server errors. The volume of email produced
is perfectly manageable due to the low level of traffic.

It does occur to me that it would be very easy to disrupt the site by
simply sending repeated requests which trigger a 404 Not Found. I'm
sure 10 404s a second would completely shutdown the process to normal
requests due to the time taken to send the log emails. I'm not using a
message queueing system.

I would like to keep the option of receiving logging emails. Is there
anything I can do to throttle or limit the email sending without
writing my own logging handler?

Any thoughts would be much appreciated.

Many thanks,
Sam Berry

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Any help regarding the SAAS based django-web application

2011-12-08 Thread pritesh modi
Hi guys

  Any one suggest me that how saas architecture based
application is developed in django.which pattern and architecture way whole
application is developed? also application to be pluggable can be reusable
and applied on saas.

provide me documentation or help on this topic if anyone has already
developed in this way

Thanking you
Pritesh  Modi

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Any help regarding the SAAS based django-web application

2011-12-08 Thread Reinout van Rees

On 08-12-11 14:25, pritesh modi wrote:

   Any one suggest me that how saas architecture based
application is developed in django.which pattern and architecture way
whole application is developed? also application to be pluggable can be
reusable and applied on saas.

provide me documentation or help on this topic if anyone has already
developed in this way


See Tom Evans' reply to your previous email. Your question is way too 
broad to give a meaningful answer. You'll have to give us more information.



Reinout

--
Reinout van Reeshttp://reinout.vanrees.org/
rein...@vanrees.org http://www.nelen-schuurmans.nl/
"If you're not sure what to do, make something. -- Paul Graham"

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django E-Commerce Framework

2011-12-08 Thread Ian Clelland
On Wednesday, December 7, 2011, bobhaugen  wrote:
> I'm guessing that the OP wanted to develop a "standard" e-commerce
> site for a single company, in which case I agree with Stuart and Andre
> that the way to go is a well-tested e-commerce framework.
>
> I had to roll my own because I was doing something very different: B2B
> e-commerce with an efficient order form (order from a grid combining
> many products, not one-product-per-page adding to a shopping cart one
> at a time) and order line items from many producers where the payment
> from the customer needs to get allocated to each producer.  But had a
> well-tested framework for that kind of thing been available, I would
> have grabbed it.

I think the OP's phrase "e-commerce framework" is a bit vague, as well --
there are a lot of different components that could all get tagged with that
label: payment processing, recurring billing, shopping cart, fulfillment,
inventory management -- it's probably not too much of a stretch for some
people to add accounting and customer service to that list, too.

You say you had to roll your own, but really you just didn't need the
shopping cart functionality. Even with your requirements, I'm sure you are
better off using a well-tested payment gateway rather than writing your own
interface to Paypal.

At some level, everybody is going to have to do *some* customization;
whether that's just overriding some templates, or building the whole site
down to the payment provider interface. We could probably provide a survey
of all related packages in this thread, but the OP might also have to do
some more thinking about what their actual requirements are.

The good thing is that the Django community has build lots of high-quality
modules that cover just about every corner of this space, so any specific
needs can almost certainly be addresses here. "What can I use for
e-commerce" is a very open-ended question, though.


>
> As it is, I did use django-paypal with some customizations, which is
> its own kind of pain in the butt.  (Not django-paypal, the
> customizations, because now I am stuck with the version of django-
> paypal that I customized...)  Eventually I'll take another look at
> payment apps and some of the newer e-commerce frameworks that are more
> modular.
>
> --
> You received this message because you are subscribed to the Google Groups
"Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.
>
>

-- 
Regards,
Ian Clelland


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django E-Commerce Framework

2011-12-08 Thread Ian Clelland
On Wednesday, December 7, 2011, bobhaugen  wrote:
> I'm guessing that the OP wanted to develop a "standard" e-commerce
> site for a single company, in which case I agree with Stuart and Andre
> that the way to go is a well-tested e-commerce framework.
>
> I had to roll my own because I was doing something very different: B2B
> e-commerce with an efficient order form (order from a grid combining
> many products, not one-product-per-page adding to a shopping cart one
> at a time) and order line items from many producers where the payment
> from the customer needs to get allocated to each producer.  But had a
> well-tested framework for that kind of thing been available, I would
> have grabbed it.

I think the OP's phrase "e-commerce framework" is a bit vague, as well --
there are a lot of different components that could all get tagged with that
label: payment processing, recurring billing, shopping cart, fulfillment,
inventory management -- it's probably not too much of a stretch for some
people to add accounting and customer service to that list, too.

You say you had to roll your own, but really you just didn't need the
shopping cart functionality. Even with your requirements, I'm sure you are
better off using a well-tested payment gateway rather than writing your own
interface to Paypal.

At some level, everybody is going to have to do *some* customization;
whether that's just overriding some templates, or building the whole site
down to the payment provider interface. We could probably provide a survey
of all related packages in this thread, but the OP might also have to do
some more thinking about what their actual requirements are.

The good thing is that the Django community has build lots of high-quality
modules that cover just about every corner of this space, so any specific
needs can almost certainly be addresses here. "What can I use for
e-commerce" is a very open-ended question, though.


>
> As it is, I did use django-paypal with some customizations, which is
> its own kind of pain in the butt.  (Not django-paypal, the
> customizations, because now I am stuck with the version of django-
> paypal that I customized...)  Eventually I'll take another look at
> payment apps and some of the newer e-commerce frameworks that are more
> modular.
>
> --
> You received this message because you are subscribed to the Google Groups
"Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.
>
>

-- 
Regards,
Ian Clelland


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Novice question...generation of model instances within a "for" loop...

2011-12-08 Thread Marc Edwards
I'm looping through some JSON code and generating new model instances
that I am saving to my SQLiteDB.

I have 3 nested "for" loops, like this:

for app_catalog in JSON_Object['TSS_WorkFlow_Catalog']:
for eda_app in app_catalog['EDA_App']:
new_eda_app =
EDA_App(isv=eda_app['isv'],product_name=eda_app['product_name'],product_category=eda_app['product_category'])
new_eda_app.save()
for cmd_str_pair in eda_app['CmdStrings']['name']:
new_cmd_str = CmdString(name=cmd_str_pair['Text'],
cmd=cmd_str_pair['Value'], eda_app=new_eda_app)
new_cmd_str.save()

My JSON file has 3 EDA_Apps, each EDA_App has 3, 4, and 4 CmdStrings,
respectively.

When I loop through the second nested "for" for the CmdStrings,
the .save() is writing to the same model instance, and at the end of
the first nested "for" loop, I have 3 CmdString instances in my DB,
NOT 3+4+4=11 CmdString instances.

Since my DB has 3 EDA_Apps in the DB, I think that the code to
instance a new model instance to save to the DB seems to be fine. It
is the second nested "for" loop that is acting fishy.  I don't know if
I am doing something wrong relative to the DB, because when I step
through the 2nd nested "for" loop, I can clearly see the "new_cmd_str"
taking on the next values from the JSON file.  This must be related to
how I am using the DB.

When I try using .save(force_insert=True) on the 2nd nested "for" loop
save, I receive a Django DEBUG page message that the "PRIMARY KEY must
be unique".

Any thoughts or observations on my code style?

Kind regards, Marc

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Novice question...generation of model instances within a "for" loop...

2011-12-08 Thread Brian Schott
I think if you set:
new_cmd_str.id = None 
That will force a new PK.  Not sure why the CmdString constructor isn't 
clearing this..

Brian Schott
bfsch...@gmail.com



On Dec 8, 2011, at 11:47 AM, Marc Edwards wrote:

> I'm looping through some JSON code and generating new model instances
> that I am saving to my SQLiteDB.
> 
> I have 3 nested "for" loops, like this:
> 
>for app_catalog in JSON_Object['TSS_WorkFlow_Catalog']:
>for eda_app in app_catalog['EDA_App']:
>new_eda_app =
> EDA_App(isv=eda_app['isv'],product_name=eda_app['product_name'],product_category=eda_app['product_category'])
>new_eda_app.save()
>for cmd_str_pair in eda_app['CmdStrings']['name']:
>new_cmd_str = CmdString(name=cmd_str_pair['Text'],
> cmd=cmd_str_pair['Value'], eda_app=new_eda_app)
>new_cmd_str.save()
> 
> My JSON file has 3 EDA_Apps, each EDA_App has 3, 4, and 4 CmdStrings,
> respectively.
> 
> When I loop through the second nested "for" for the CmdStrings,
> the .save() is writing to the same model instance, and at the end of
> the first nested "for" loop, I have 3 CmdString instances in my DB,
> NOT 3+4+4=11 CmdString instances.
> 
> Since my DB has 3 EDA_Apps in the DB, I think that the code to
> instance a new model instance to save to the DB seems to be fine. It
> is the second nested "for" loop that is acting fishy.  I don't know if
> I am doing something wrong relative to the DB, because when I step
> through the 2nd nested "for" loop, I can clearly see the "new_cmd_str"
> taking on the next values from the JSON file.  This must be related to
> how I am using the DB.
> 
> When I try using .save(force_insert=True) on the 2nd nested "for" loop
> save, I receive a Django DEBUG page message that the "PRIMARY KEY must
> be unique".
> 
> Any thoughts or observations on my code style?
> 
> Kind regards, Marc
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django E-Commerce Framework

2011-12-08 Thread Nan
> I'm guessing that the OP wanted to develop a "standard" e-commerce
> site for a single company, in which case I agree with Stuart and Andre
> that the way to go is a well-tested e-commerce framework.
>
> I had to roll my own because I was doing something very different
> ...
> But had a
> well-tested framework for that kind of thing been available, I would
> have grabbed it.

Seconded.  Satchmo is great if you're trying to create a bog-standard
e-commerce site.  Our requirements turned out to be far outside of
what Satchmo supports, and even using Custom Products, getting Satchmo
to do even half of what we needed was extremely time consuming and
awkward (the documentation skims the surface of implementation and
customization and wasn't much help for a lot of what we needed to
do).

Worse, the Custom Product system resulted in as many as 1200 queries
(I kid you not) for a simple page displaying a dozen products with
"add to cart" buttons -- which couldn't be properly cached due to CSRF
protection.  With some careful query caching added to both our
extensions and Satchmo's core, we brought this down to around 80
queries... when the cache is current.

But now we want to add some features that can't be done without
significantly forking Satchmo itself, so we're probably going to roll
our own.

> The good thing is that the Django community has build lots of high-quality
> modules that cover just about every corner of this space, so any specific
> needs can almost certainly be addresses here. "What can I use for
> e-commerce" is a very open-ended question, though.

Not to hijack the OP's thread, but if you have any suggestions for
basic shopping cart functionality, payment processing (Paypal Pro?),
or coupons / BOGO (that's buy-one-get-one), I for one would love to
hear them.


On Dec 7, 10:19 am, bobhaugen  wrote:
> I'm guessing that the OP wanted to develop a "standard" e-commerce
> site for a single company, in which case I agree with Stuart and Andre
> that the way to go is a well-tested e-commerce framework.
>
> I had to roll my own because I was doing something very different: B2B
> e-commerce with an efficient order form (order from a grid combining
> many products, not one-product-per-page adding to a shopping cart one
> at a time) and order line items from many producers where the payment
> from the customer needs to get allocated to each producer.  But had a
> well-tested framework for that kind of thing been available, I would
> have grabbed it.
>
> As it is, I did use django-paypal with some customizations, which is
> its own kind of pain in the butt.  (Not django-paypal, the
> customizations, because now I am stuck with the version of django-
> paypal that I customized...)  Eventually I'll take another look at
> payment apps and some of the newer e-commerce frameworks that are more
> modular.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Novice question...generation of model instances within a "for" loop...

2011-12-08 Thread J. Marc Edwards
Brian:

I'm getting the same behavior with the new_cmd_str.id=None. 

I'm going to get a sandwich.  I'll think about this more over lunch.

-M

J. Marc Edwards
Lead Architect - Semiconductor Design Portals
Nimbis Services, Inc.
Skype: (919) 747-3775
Cell:  (919) 345-1021
Fax:   (919) 882-8602
marc.edwa...@nimbisservices.com
www.nimbisservices.com


On 12/08/2011 11:52 AM, Brian Schott wrote:
> I think if you set:
> new_cmd_str.id = None 
> That will force a new PK.  Not sure why the CmdString constructor isn't 
> clearing this..
>
> Brian Schott
> bfsch...@gmail.com
>
>
>
> On Dec 8, 2011, at 11:47 AM, Marc Edwards wrote:
>
>> I'm looping through some JSON code and generating new model instances
>> that I am saving to my SQLiteDB.
>>
>> I have 3 nested "for" loops, like this:
>>
>>for app_catalog in JSON_Object['TSS_WorkFlow_Catalog']:
>>for eda_app in app_catalog['EDA_App']:
>>new_eda_app =
>> EDA_App(isv=eda_app['isv'],product_name=eda_app['product_name'],product_category=eda_app['product_category'])
>>new_eda_app.save()
>>for cmd_str_pair in eda_app['CmdStrings']['name']:
>>new_cmd_str = CmdString(name=cmd_str_pair['Text'],
>> cmd=cmd_str_pair['Value'], eda_app=new_eda_app)
>>new_cmd_str.save()
>>
>> My JSON file has 3 EDA_Apps, each EDA_App has 3, 4, and 4 CmdStrings,
>> respectively.
>>
>> When I loop through the second nested "for" for the CmdStrings,
>> the .save() is writing to the same model instance, and at the end of
>> the first nested "for" loop, I have 3 CmdString instances in my DB,
>> NOT 3+4+4=11 CmdString instances.
>>
>> Since my DB has 3 EDA_Apps in the DB, I think that the code to
>> instance a new model instance to save to the DB seems to be fine. It
>> is the second nested "for" loop that is acting fishy.  I don't know if
>> I am doing something wrong relative to the DB, because when I step
>> through the 2nd nested "for" loop, I can clearly see the "new_cmd_str"
>> taking on the next values from the JSON file.  This must be related to
>> how I am using the DB.
>>
>> When I try using .save(force_insert=True) on the 2nd nested "for" loop
>> save, I receive a Django DEBUG page message that the "PRIMARY KEY must
>> be unique".
>>
>> Any thoughts or observations on my code style?
>>
>> Kind regards, Marc
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to 
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at 
>> http://groups.google.com/group/django-users?hl=en.
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

<>

Re: Django E-Commerce Framework

2011-12-08 Thread Brian Schott
I've been playing with django-shop.  It looks lightweight, class extensible, 
and lightweight, but haven't worked with it enough to recommend yet.  That's 
still in my scrum backlog...

Brian Schott
bfsch...@gmail.com



On Dec 8, 2011, at 11:58 AM, Nan wrote:

>> I'm guessing that the OP wanted to develop a "standard" e-commerce
>> site for a single company, in which case I agree with Stuart and Andre
>> that the way to go is a well-tested e-commerce framework.
>> 
>> I had to roll my own because I was doing something very different
>> ...
>> But had a
>> well-tested framework for that kind of thing been available, I would
>> have grabbed it.
> 
> Seconded.  Satchmo is great if you're trying to create a bog-standard
> e-commerce site.  Our requirements turned out to be far outside of
> what Satchmo supports, and even using Custom Products, getting Satchmo
> to do even half of what we needed was extremely time consuming and
> awkward (the documentation skims the surface of implementation and
> customization and wasn't much help for a lot of what we needed to
> do).
> 
> Worse, the Custom Product system resulted in as many as 1200 queries
> (I kid you not) for a simple page displaying a dozen products with
> "add to cart" buttons -- which couldn't be properly cached due to CSRF
> protection.  With some careful query caching added to both our
> extensions and Satchmo's core, we brought this down to around 80
> queries... when the cache is current.
> 
> But now we want to add some features that can't be done without
> significantly forking Satchmo itself, so we're probably going to roll
> our own.
> 
>> The good thing is that the Django community has build lots of high-quality
>> modules that cover just about every corner of this space, so any specific
>> needs can almost certainly be addresses here. "What can I use for
>> e-commerce" is a very open-ended question, though.
> 
> Not to hijack the OP's thread, but if you have any suggestions for
> basic shopping cart functionality, payment processing (Paypal Pro?),
> or coupons / BOGO (that's buy-one-get-one), I for one would love to
> hear them.
> 
> 
> On Dec 7, 10:19 am, bobhaugen  wrote:
>> I'm guessing that the OP wanted to develop a "standard" e-commerce
>> site for a single company, in which case I agree with Stuart and Andre
>> that the way to go is a well-tested e-commerce framework.
>> 
>> I had to roll my own because I was doing something very different: B2B
>> e-commerce with an efficient order form (order from a grid combining
>> many products, not one-product-per-page adding to a shopping cart one
>> at a time) and order line items from many producers where the payment
>> from the customer needs to get allocated to each producer.  But had a
>> well-tested framework for that kind of thing been available, I would
>> have grabbed it.
>> 
>> As it is, I did use django-paypal with some customizations, which is
>> its own kind of pain in the butt.  (Not django-paypal, the
>> customizations, because now I am stuck with the version of django-
>> paypal that I customized...)  Eventually I'll take another look at
>> payment apps and some of the newer e-commerce frameworks that are more
>> modular.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: DoS susceptability via email logging

2011-12-08 Thread Nikolas Stevenson-Molnar
I imagine you can use something like Celery ( has been recommended on
this list before: http://celeryproject.org/ ) to queue email tasks and
handle them in a single background process.

_Nik

On 12/8/2011 4:42 AM, Sam Berry wrote:
> Hello there,
>
> I am currently running a number of small sites using logging via email
> to notify me of 404s and server errors. The volume of email produced
> is perfectly manageable due to the low level of traffic.
>
> It does occur to me that it would be very easy to disrupt the site by
> simply sending repeated requests which trigger a 404 Not Found. I'm
> sure 10 404s a second would completely shutdown the process to normal
> requests due to the time taken to send the log emails. I'm not using a
> message queueing system.
>
> I would like to keep the option of receiving logging emails. Is there
> anything I can do to throttle or limit the email sending without
> writing my own logging handler?
>
> Any thoughts would be much appreciated.
>
> Many thanks,
> Sam Berry
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Novice question...generation of model instances within a "for" loop...

2011-12-08 Thread Marc Edwards
OK...adding the .pk=None did the trick, but why didn't I have to do
this on the outer loop?

On Dec 8, 11:52 am, Brian Schott  wrote:
> I think if you set:
> new_cmd_str.id = None
> That will force a new PK.  Not sure why the CmdString constructor isn't 
> clearing this..
>
> Brian Schott
> bfsch...@gmail.com
>
> On Dec 8, 2011, at 11:47 AM, Marc Edwards wrote:
>
>
>
>
>
>
>
> > I'm looping through some JSON code and generating new model instances
> > that I am saving to my SQLiteDB.
>
> > I have 3 nested "for" loops, like this:
>
> >    for app_catalog in JSON_Object['TSS_WorkFlow_Catalog']:
> >        for eda_app in app_catalog['EDA_App']:
> >            new_eda_app =
> > EDA_App(isv=eda_app['isv'],product_name=eda_app['product_name'],product_cat 
> > egory=eda_app['product_category'])
> >            new_eda_app.save()
> >            for cmd_str_pair in eda_app['CmdStrings']['name']:
> >                new_cmd_str = CmdString(name=cmd_str_pair['Text'],
> > cmd=cmd_str_pair['Value'], eda_app=new_eda_app)
> >                new_cmd_str.save()
>
> > My JSON file has 3 EDA_Apps, each EDA_App has 3, 4, and 4 CmdStrings,
> > respectively.
>
> > When I loop through the second nested "for" for the CmdStrings,
> > the .save() is writing to the same model instance, and at the end of
> > the first nested "for" loop, I have 3 CmdString instances in my DB,
> > NOT 3+4+4=11 CmdString instances.
>
> > Since my DB has 3 EDA_Apps in the DB, I think that the code to
> > instance a new model instance to save to the DB seems to be fine. It
> > is the second nested "for" loop that is acting fishy.  I don't know if
> > I am doing something wrong relative to the DB, because when I step
> > through the 2nd nested "for" loop, I can clearly see the "new_cmd_str"
> > taking on the next values from the JSON file.  This must be related to
> > how I am using the DB.
>
> > When I try using .save(force_insert=True) on the 2nd nested "for" loop
> > save, I receive a Django DEBUG page message that the "PRIMARY KEY must
> > be unique".
>
> > Any thoughts or observations on my code style?
>
> > Kind regards, Marc
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "Django users" group.
> > To post to this group, send email to django-users@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/django-users?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Novice question...generation of model instances within a "for" loop...

2011-12-08 Thread Marc Edwards
Probably because I was setting the ForeignKey in the new_cmd_str to
the new_eda_app that was in the outer loop.  That created a new
reference to that instance, and Django knew that it would need a new
primary key.  Without another external reference, it seemed that the
same primary key was being used.

Would this explanation seem reasonable?

On Dec 8, 12:52 pm, Marc Edwards  wrote:
> OK...adding the .pk=None did the trick, but why didn't I have to do
> this on the outer loop?
>
> On Dec 8, 11:52 am, Brian Schott  wrote:
>
>
>
>
>
>
>
> > I think if you set:
> > new_cmd_str.id = None
> > That will force a new PK.  Not sure why the CmdString constructor isn't 
> > clearing this..
>
> > Brian Schott
> > bfsch...@gmail.com
>
> > On Dec 8, 2011, at 11:47 AM, Marc Edwards wrote:
>
> > > I'm looping through some JSON code and generating new model instances
> > > that I am saving to my SQLiteDB.
>
> > > I have 3 nested "for" loops, like this:
>
> > >    for app_catalog in JSON_Object['TSS_WorkFlow_Catalog']:
> > >        for eda_app in app_catalog['EDA_App']:
> > >            new_eda_app =
> > > EDA_App(isv=eda_app['isv'],product_name=eda_app['product_name'],product_cat
> > >  egory=eda_app['product_category'])
> > >            new_eda_app.save()
> > >            for cmd_str_pair in eda_app['CmdStrings']['name']:
> > >                new_cmd_str = CmdString(name=cmd_str_pair['Text'],
> > > cmd=cmd_str_pair['Value'], eda_app=new_eda_app)
> > >                new_cmd_str.save()
>
> > > My JSON file has 3 EDA_Apps, each EDA_App has 3, 4, and 4 CmdStrings,
> > > respectively.
>
> > > When I loop through the second nested "for" for the CmdStrings,
> > > the .save() is writing to the same model instance, and at the end of
> > > the first nested "for" loop, I have 3 CmdString instances in my DB,
> > > NOT 3+4+4=11 CmdString instances.
>
> > > Since my DB has 3 EDA_Apps in the DB, I think that the code to
> > > instance a new model instance to save to the DB seems to be fine. It
> > > is the second nested "for" loop that is acting fishy.  I don't know if
> > > I am doing something wrong relative to the DB, because when I step
> > > through the 2nd nested "for" loop, I can clearly see the "new_cmd_str"
> > > taking on the next values from the JSON file.  This must be related to
> > > how I am using the DB.
>
> > > When I try using .save(force_insert=True) on the 2nd nested "for" loop
> > > save, I receive a Django DEBUG page message that the "PRIMARY KEY must
> > > be unique".
>
> > > Any thoughts or observations on my code style?
>
> > > Kind regards, Marc
>
> > > --
> > > You received this message because you are subscribed to the Google Groups 
> > > "Django users" group.
> > > To post to this group, send email to django-users@googlegroups.com.
> > > To unsubscribe from this group, send email to 
> > > django-users+unsubscr...@googlegroups.com.
> > > For more options, visit this group 
> > > athttp://groups.google.com/group/django-users?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Filtering across tables

2011-12-08 Thread Craig
Hi -

I'm pretty new to Django and I'm trying to do something that's
probably pretty easy, but getting it to happen is eluding me. Here's a
simplified version of what I want to do:

class A(models.Model):
  name = models.CharField(max_length = 10)

class B(models.Model):
  info = models.CharField(max_length = 10)
  a = models.ForeignKey(A)

class C(models.Model):
  stuff = models.CharField(max_length = 10)
  b = models.ForeignKey(B)

A is one-to-many to B and B is one-to-many to C.

If I know which A I'm interested in [eg, a_instance = A.objects.get(pk
= 1)], is there a way to get all the instances of C that are related
to a_instance in one step?

I know how to get all the B's related to my a_instance and then I can
loop through those to get all their C instances, but that's really
slow. Reading the docs seems to imply I can do this in one step, but
I'm having issues figuring out how it's actually done.

TIA,
- Craig

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: DoS susceptability via email logging

2011-12-08 Thread creecode
Hello Sam,

You might want to do something like detect the situation and then at the 
firewall for your router or server, cut off the offending addresses.  No 
specific details to offer.  The advantage to getting a rule onto your 
firewall would be reduced load on the software side of request processing.

Another approach would be to use server monitoring software such as Nagios 
to regularlly check that the server/websites are up and running and give 
you a heads up when there is a problem.  The advantage here is that you can 
then find out what the problem is and take care of it manually.  If there 
is some kind of pattern to the problem then you might be able to automate a 
solution.  Going the monitoring route generally requires one or more other 
computers to be effective.

Toodle-looo
creecode

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/KNm8dSfpUbEJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Filtering across tables

2011-12-08 Thread Craig Amundsen
Hi -

Responding to myself...

Doesn't this always happen? As soon as you ask for help, you figure out the
solution.

Here's what I want: c_list = C.objects.fiter(b__a__pk = pk_of_a_instance)

- Craig

On Thu, Dec 8, 2011 at 9:36 AM, Craig  wrote:

> Hi -
>
> I'm pretty new to Django and I'm trying to do something that's
> probably pretty easy, but getting it to happen is eluding me. Here's a
> simplified version of what I want to do:
>
> class A(models.Model):
>  name = models.CharField(max_length = 10)
>
> class B(models.Model):
>  info = models.CharField(max_length = 10)
>  a = models.ForeignKey(A)
>
> class C(models.Model):
>  stuff = models.CharField(max_length = 10)
>  b = models.ForeignKey(B)
>
> A is one-to-many to B and B is one-to-many to C.
>
> If I know which A I'm interested in [eg, a_instance = A.objects.get(pk
> = 1)], is there a way to get all the instances of C that are related
> to a_instance in one step?
>
> I know how to get all the B's related to my a_instance and then I can
> loop through those to get all their C instances, but that's really
> slow. Reading the docs seems to imply I can do this in one step, but
> I'm having issues figuring out how it's actually done.
>
> TIA,
> - Craig
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: documentation patch questions

2011-12-08 Thread Russell Keith-Magee
On Wed, Dec 7, 2011 at 4:55 PM, Annie  wrote:
> Hi all -
>
> I have some questions before I submit a ticket with a patch to change
> a few things in the docs/topics/testing.txt file. One change is a typo
> fix, and another is a possible change I have a question about. Since
> they're both relatively minor changes to the same file (no major
> rewrites required), do I submit both on one ticket (after my question
> about the second change is answered here) with my patch, or do they
> need to be submitted separately?

Hi Annie,

If someone were committing in the testing docs, and there are two
minor fixes, they're just as likely to roll them into a single commit,
with the comment "Minor updates to the testing documentation"; in
which case, a single ticket is probably ok.

The point at which a second ticket is called for is the point at which
it is likely that one of the fixes will *not* be applied. This could
be due to a number of reasons:

 * One of the changes is large, and requires further review

 * The updates relate to different parts of the documentation, and
aren't thematically bound (e.g., fixing usage of its/it's in multiple
locations)

 * One of the changes is controversial or requires further discussion.

In this case, I'd be happy to say both these changes could be
classified as two related, uncontroversial improvements, so a single
ticket is probably OK.

> This example under the "Running tests" section of the page is what
> confused me when I read it, so I thought I should check before I
> suggested a change in case I was reading the example incorrectly. *g*
>
> Here's the relevant bit of the docs:
>
> 
>
> And it gets even more granular than that! To run a *single* test
> method inside a test case, add the name of the test method to the
> label::
>
>    $ ./manage.py test animals.AnimalTestCase.testFluffyAnimals
>
> 
>
>
> In both unittest and doctest examples given above that test run
> example, there is no testFluffyAnimals method. The unittest defines
> testSpeaking and the doctest uses speak. I think it would be clearer
> if the example read like this:
>
>    $ ./manage.py test animals.AnimalTestCase.testSpeaking
>
>
> Am I reading the original example correctly? Or is it just that my
> brain's tired from looking at this stuff too long today? :)

Looks like a good catch to me. We should certainly aim to be
internally consistent, and I can't see any reason not to be in this
case.

> Ok, I lied, there's actually a third issue--something I noticed as I
> was double checking before I sent this email: shouldn't the method be
> named test_speaking, if we're supposed to follow the guidelines on the
> coding style page? "Use underscores, not camelCase, for variable,
> function and method names (i.e. poll.get_unique_voters(), not
> poll.getUniqueVoters)."

Also a good catch.

If you're in the area and aiming for perfection, I'd be inclined to
take a closer look at the test names, too. testSpeaking isn't an
especially good test name -- something like test_animals_can_speak(),
that phrases the test as an assertion would be a better example.
Giving the test a docstring that will be used by the test runner
verbose/error output would also be a good idea.

I look forward to seeing your ticket and patch. Thanks for pitching in!

Yours,
Russ Magee %-)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django E-Commerce Framework

2011-12-08 Thread Stuart Laughlin
On Dec 7, 4:39 pm, Martin Tiršel  wrote:
>
> I would not recommend the Satchmo although it is a great project and you
> can learn a lot from it. Reasons:
>
> 1.) very very very bad documentation, you have to search a lot in the
> Satchmo code (good for somebody who wants to learn :). And for some
> features you don't even know how to use them.
>

I concede that the documentation isn't the greatest (patches
welcome!). I think "bad" is probably more accurate than the threefold-
very bad. :) There is, however, a pretty active google group at
http://groups.google.com/group/satchmo-users/.

> 2.) heavyweight - for a page to loat you need 200-300 SQL queries
>

Not true. How many queries are executed will depend upon what page you
are loading, how many products you have, how many variations for a
custom product, etc.

> 3.) Django admin interface is not suited for such application
>

I don't know exactly what you mean by that. I will say that when I
implemented satchmo for a client with thousands of products, I did
have to tweak satchmo's admin templates in a couple places to get
admin pages to load more quickly. Perhaps you were running into this
same kind of issue..?


--Stuart

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Django E-Commerce Framework

2011-12-08 Thread Stuart Laughlin
On Dec 6, 3:45 pm, Stuart Laughlin  wrote:
>
> Another advantage of satchmo (and please forgive the self-promotion)
> is that you can purchase a companion mobile application that extends
> your website to iphones, ipads, android devices, and the like via apps
> native to each platform. Preliminary information is 
> athttp://www.johnheerman.com./portfolio/with a dedicated site coming
> Real Soon Now.
>

As an update, that site is now live at http://satchmobileapp.com/

--Stuart

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Query with no-correspondence results

2011-12-08 Thread wgis
Ian Clelland, it worked! Thanks a lot for your perseverance

Tom's secret sauce it's not working, unfortunately =(
Just (Carrots, Flavour, 3.0)
I guess since some 'contexts' don't have an associated thing-vote, the
filter will cut them off.
It would be more neat with the ORM, but I must be looking for a golden
a pot.

Don't want to seem ungrateful but I realized that I should have not
just an individual vote by context but also an average vote by
context. Can you still pull it of? I'm sorry, I know it's not django
anymore but I have to ask.

Thanks for your help.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Query with no-correspondence results

2011-12-08 Thread Ian Clelland
On Thu, Dec 8, 2011 at 12:45 PM, wgis  wrote:

> Ian Clelland, it worked! Thanks a lot for your perseverance
>
> Tom's secret sauce it's not working, unfortunately =(
> Just (Carrots, Flavour, 3.0)
> I guess since some 'contexts' don't have an associated thing-vote, the
> filter will cut them off.
> It would be more neat with the ORM, but I must be looking for a golden
> a pot.
>
> Don't want to seem ungrateful but I realized that I should have not
> just an individual vote by context but also an average vote by
> context. Can you still pull it of? I'm sorry, I know it's not django
> anymore but I have to ask.
>

I would give this a shot:

select thing, name, avg(vote) from mydatabase_votecontext left
join mydatabase_vote on (mydatabase_vote.context_id =
mydatabase_votecontext.id and thing='Carrots') group by thing, name;

Ian

Thanks for your help.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Regards,
Ian Clelland


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: Filtering across tables

2011-12-08 Thread Matt Schinckel
Tip: have a teddy bear/rubber ducky/other toy that you can explain your 
problem too. They (probably) won't be able to solve it, but formulating it 
in a way to explain what is wrong to someone else is a great way to get 
more clarity on exactly what the problem is, and then solving it yourself.

Personally, I have an empty beer bottle I explain to, but that's because I 
always seem to have a surplus of empty beer bottles.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/ily_g0MZZ5QJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: filesystem path in settings.py

2011-12-08 Thread Timothy Makobu
Hi Tanya,

Also have a look at this
https://docs.djangoproject.com/en/dev/howto/static-files/#serving-static-files-in-production

I personally leave Django out of static file serving entirely, and have the
webserver serve the static media, but I'll experiment and see
what advantage there is to using the staticfilesapp.


On Sun, Dec 4, 2011 at 11:01 AM, Timothy Makobu  wrote:

> In Django 1.3:
>
> STATIC_ROOT = os.path.join(os.path.dirname(__file__),
> 'static').replace('\\','/')
>
> where the folder "static" is in the root of your project folder.
>
>
> On Sun, Nov 27, 2011 at 2:23 PM, TANYA  wrote:
>
>> I read it but after following all steps in it the error still remains.
>>
>>  '/usr/local/lib/python2.6/dist-packages/setuptools-0.6c11-py2.6.egg',
>>  '/usr/lib/python2.6',
>>  '/usr/lib/python2.6/plat-linux2',
>>
>>
>>  '/usr/lib/python2.6/lib-tk',
>>  '/usr/lib/python2.6/lib-old',
>>  '/usr/lib/python2.6/lib-dynload',
>>  '/usr/local/lib/python2.6/dist-packages',
>>  '/usr/lib/python2.6/dist-packages',
>>
>>
>>  '/usr/lib/python2.6/dist-packages/PIL',
>>  '/usr/lib/pymodules/python2.6',
>>  '/usr/lib/pymodules/python2.6/gtk-2.0',
>>  '/usr/lib/python2.6/dist-packages/wx-2.6-gtk2-unicode'
>>
>> I did symlink to /usr/bin/local but still get path error. Please help.
>>
>>
>>
>> On Fri, Nov 25, 2011 at 4:44 AM, Timothy Makobu <
>> makobu.mwambir...@gmail.com> wrote:
>>
>>> And this too http://www.djangobook.com/en/2.0/
>>>
>>>
>>> On Fri, Nov 25, 2011 at 7:41 AM, Timothy Makobu <
>>> makobu.mwambir...@gmail.com> wrote:
>>>
 Hi,

 Please read this whole thing
 https://docs.djangoproject.com/en/dev/howto/static-files/


 On Fri, Nov 25, 2011 at 6:28 AM, TANYA  wrote:

> # Absolute filesystem path to the directory that will hold
> user-uploaded files.
> # Example: "/home/media/media.lawrence.com/media/"
> MEDIA_ROOT = ''
>
> I want to upload css files and images so must I put them in
> /home/media or /home/my/media/path/ ? Should the filesystem path in
> settings.py be changed or should MEDIA_ROOT be left empty?
>
> --
> TANYA
>
> --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>


>>>  --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To post to this group, send email to django-users@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> django-users+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/django-users?hl=en.
>>>
>>
>>
>>
>> --
>> TANYA
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-users@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: filesystem path in settings.py

2011-12-08 Thread Donald Stufft
The static files app doesn't serve static files (except in development).

What it's primary purpose is to take a list of "finders", and locate all of the 
static files from a variety of places, and collect them into one directory. 
This allows reusable apps to package static files within their apps, and then 
have those files available automatically. The alternative is basically include 
as part of the installation instructions "symlink this folder", or "copy these 
files", or "make sure you download these" etc. 


On Thursday, December 8, 2011 at 7:24 PM, Timothy Makobu wrote:

> Hi Tanya,
> 
> Also have a look at this 
> https://docs.djangoproject.com/en/dev/howto/static-files/#serving-static-files-in-production
>  
> 
> I personally leave Django out of static file serving entirely, and have the 
> webserver serve the static media, but I'll experiment and see what advantage 
> there is to using the staticfilesapp.
> 
> 
> On Sun, Dec 4, 2011 at 11:01 AM, Timothy Makobu  (mailto:makobu.mwambir...@gmail.com)> wrote:
> > In Django 1.3:
> > 
> > STATIC_ROOT = os.path.join(os.path.dirname(__file__), 
> > 'static').replace('\\','/')
> > 
> > where the folder "static" is in the root of your project folder. 
> > 
> > 
> > On Sun, Nov 27, 2011 at 2:23 PM, TANYA  > (mailto:tani...@gmail.com)> wrote:
> > > I read it but after following all steps in it the error still remains.
> > > 
> > > '/usr/local/lib/python2.6/dist-packages/setuptools-0.6c11-py2.6.egg',
> > > '/usr/lib/python2.6',
> > > '/usr/lib/python2.6/plat-linux2',
> > > '/usr/lib/python2.6/lib-tk',
> > > '/usr/lib/python2.6/lib-old',
> > > '/usr/lib/python2.6/lib-dynload',
> > > '/usr/local/lib/python2.6/dist-packages',
> > > '/usr/lib/python2.6/dist-packages',
> > > '/usr/lib/python2.6/dist-packages/PIL',
> > > '/usr/lib/pymodules/python2.6',
> > > '/usr/lib/pymodules/python2.6/gtk-2.0',
> > > '/usr/lib/python2.6/dist-packages/wx-2.6-gtk2-unicode'I did symlink to 
> > > /usr/bin/local but still get path error. Please help.
> > > 
> > > 
> > > 
> > > On Fri, Nov 25, 2011 at 4:44 AM, Timothy Makobu 
> > > mailto:makobu.mwambir...@gmail.com)> wrote:
> > > > And this too http://www.djangobook.com/en/2.0/
> > > > 
> > > > 
> > > > On Fri, Nov 25, 2011 at 7:41 AM, Timothy Makobu 
> > > > mailto:makobu.mwambir...@gmail.com)> 
> > > > wrote:
> > > > > Hi,
> > > > > 
> > > > > Please read this whole thing 
> > > > > https://docs.djangoproject.com/en/dev/howto/static-files/ 
> > > > > 
> > > > > 
> > > > > On Fri, Nov 25, 2011 at 6:28 AM, TANYA  > > > > (mailto:tani...@gmail.com)> wrote:
> > > > > > # Absolute filesystem path to the directory that will hold 
> > > > > > user-uploaded files.
> > > > > > # Example: "/home/media/media.lawrence.com/media/ 
> > > > > > (http://media.lawrence.com/media/)"
> > > > > > MEDIA_ROOT = ''
> > > > > > 
> > > > > > I want to upload css files and images so must I put them in 
> > > > > > /home/media or /home/my/media/path/ ? Should the filesystem path in 
> > > > > > settings.py be changed or should MEDIA_ROOT be left empty?
> > > > > > 
> > > > > > -- 
> > > > > > TANYA
> > > > > > -- 
> > > > > > You received this message because you are subscribed to the Google 
> > > > > > Groups "Django users" group.
> > > > > > To post to this group, send email to django-users@googlegroups.com 
> > > > > > (mailto:django-users@googlegroups.com).
> > > > > > To unsubscribe from this group, send email to 
> > > > > > django-users+unsubscr...@googlegroups.com 
> > > > > > (mailto:django-users%2bunsubscr...@googlegroups.com).
> > > > > > For more options, visit this group at 
> > > > > > http://groups.google.com/group/django-users?hl=en.
> > > > > 
> > > > 
> > > > -- 
> > > > You received this message because you are subscribed to the Google 
> > > > Groups "Django users" group.
> > > > To post to this group, send email to django-users@googlegroups.com 
> > > > (mailto:django-users@googlegroups.com).
> > > > To unsubscribe from this group, send email to 
> > > > django-users+unsubscr...@googlegroups.com 
> > > > (mailto:django-users%2bunsubscr...@googlegroups.com).
> > > > For more options, visit this group at 
> > > > http://groups.google.com/group/django-users?hl=en.
> > > 
> > > 
> > > 
> > > -- 
> > > TANYA
> > > -- 
> > > You received this message because you are subscribed to the Google Groups 
> > > "Django users" group.
> > > To post to this group, send email to django-users@googlegroups.com 
> > > (mailto:django-users@googlegroups.com).
> > > To unsubscribe from this group, send email to 
> > > django-users+unsubscr...@googlegroups.com 
> > > (mailto:django-users%2bunsubscr...@googlegroups.com).
> > > For more options, visit this group at 
> > > http://groups.google.com/group/django-users?hl=en.
> > 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com 
> (mailto:django-users@googlegroups.com).
> To unsubscrib

Re: DoS susceptability via email logging

2011-12-08 Thread Russell Keith-Magee
On Thu, Dec 8, 2011 at 8:42 PM, Sam Berry  wrote:
> Hello there,
>
> I am currently running a number of small sites using logging via email
> to notify me of 404s and server errors. The volume of email produced
> is perfectly manageable due to the low level of traffic.

First off, I'd point out that the 404 emails aren't sent every time
your server generates a 404 -- they're only generated as a result of a
404 *from an internal link on your site*. If John Q Hacker hits
http://yoursite.com/this_page_doesnt_exist, you won't get a 404 email.

If you're getting *any* 404 emails, it means there are internal links
on your site that don't resolve. If this is something that is
happening systematically, at a rate that has given you cause for
concern about the potential for DOS, I'd suggest you have a bigger
problem with your site.

> It does occur to me that it would be very easy to disrupt the site by
> simply sending repeated requests which trigger a 404 Not Found. I'm
> sure 10 404s a second would completely shutdown the process to normal
> requests due to the time taken to send the log emails. I'm not using a
> message queueing system.
>
> I would like to keep the option of receiving logging emails. Is there
> anything I can do to throttle or limit the email sending without
> writing my own logging handler?

Interestingly, 404 emails aren't handled by a logging handler (unlike
500 messages) -- they're handled as a direct mail to site managers.
This is something that is probably worth a ticket in itself; using the
logging framework for 404 mails would allow for much more flexibility.

So - what you want here isn't a custom logging handler, but a custom
*mail* handler -- django-mailer [1] is a good candidate here. This
makes "sending" an email a very short lived operation from the
perspective of your web server -- all the web request does is queue
the email for sending. The actual sending of mail is handled out of
the request-response cycle. This removes the possibility of "DOS
attack by 404" because the expensive operation is taken out of the
request-response cycle.

Of course, you could still end up being flooded with email -- so you
either need to (a) monitor the size of your mail queue to make sure it
isn't getting flooded, or (b) put a processor in place to
merge/throttle the contents of the mail queue. This could also be
handled with a custom mail handler; however, I can't point you at a
ready-to-use candidate for this.

Another option is to use a mechanism other than the 404 emails to log
and handle errors. Django-sentry [2] and Arecibo [3] are two
candidates here, both of which are easy to install, and provide much
richer analytics than a full mailbox :-)

[1] https://github.com/jtauber/django-mailer/
[2] https://github.com/dcramer/django-sentry/
[3] http://areciboapp.com/

Yours,
Russ Magee %-)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: DoS susceptability via email logging

2011-12-08 Thread Donald Stufft
On Thursday, December 8, 2011 at 7:33 PM, Russell Keith-Magee wrote:
> On Thu, Dec 8, 2011 at 8:42 PM, Sam Berry  (mailto:samkbe...@googlemail.com)> wrote:
> > Hello there,
> > 
> > I am currently running a number of small sites using logging via email
> > to notify me of 404s and server errors. The volume of email produced
> > is perfectly manageable due to the low level of traffic.
> > 
> 
> 
> First off, I'd point out that the 404 emails aren't sent every time
> your server generates a 404 -- they're only generated as a result of a
> 404 *from an internal link on your site*. If John Q Hacker hits
> http://yoursite.com/this_page_doesnt_exist, you won't get a 404 email.
> 
> 

This isn't exactly accurate. It sends them for any 404 response where the 
HTTP_REFERER
header is not in the ignorable urls setting, is not empty, and does not contain 
a ?

This is also trivial to get around and if someone is attempting to trigger a 
boatload of
404 emails this check is only going to prevent someone who knows nothing about 
Django (in
which case how do they know about 404 email sending?). 
> 
> If you're getting *any* 404 emails, it means there are internal links
> on your site that don't resolve. If this is something that is
> happening systematically, at a rate that has given you cause for
> concern about the potential for DOS, I'd suggest you have a bigger
> problem with your site.
> 
> > It does occur to me that it would be very easy to disrupt the site by
> > simply sending repeated requests which trigger a 404 Not Found. I'm
> > sure 10 404s a second would completely shutdown the process to normal
> > requests due to the time taken to send the log emails. I'm not using a
> > message queueing system.
> > 
> > I would like to keep the option of receiving logging emails. Is there
> > anything I can do to throttle or limit the email sending without
> > writing my own logging handler?
> > 
> 
> 
> Interestingly, 404 emails aren't handled by a logging handler (unlike
> 500 messages) -- they're handled as a direct mail to site managers.
> This is something that is probably worth a ticket in itself; using the
> logging framework for 404 mails would allow for much more flexibility.
> 
> 

Agreed, 404 should be configurable via Logging. 
> 
> So - what you want here isn't a custom logging handler, but a custom
> *mail* handler -- django-mailer [1] is a good candidate here. This
> makes "sending" an email a very short lived operation from the
> perspective of your web server -- all the web request does is queue
> the email for sending. The actual sending of mail is handled out of
> the request-response cycle. This removes the possibility of "DOS
> attack by 404" because the expensive operation is taken out of the
> request-response cycle.
> 
> 

This is True.  You could also move email sending to a celery task
or something similar.
> 
> Of course, you could still end up being flooded with email -- so you
> either need to (a) monitor the size of your mail queue to make sure it
> isn't getting flooded, or (b) put a processor in place to
> merge/throttle the contents of the mail queue. This could also be
> handled with a custom mail handler; however, I can't point you at a
> ready-to-use candidate for this.
> 
> Another option is to use a mechanism other than the 404 emails to log
> and handle errors. Django-sentry [2] and Arecibo [3] are two
> candidates here, both of which are easy to install, and provide much
> richer analytics than a full mailbox :-)
> 
> 

This is, in my opinion, the best option if you wish to track 404's. 
> 
> [1] https://github.com/jtauber/django-mailer/
> [2] https://github.com/dcramer/django-sentry/
> [3] http://areciboapp.com/
> 
> Yours,
> Russ Magee %-)
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com 
> (mailto:django-users@googlegroups.com).
> To unsubscribe from this group, send email to 
> django-users+unsubscr...@googlegroups.com 
> (mailto:django-users+unsubscr...@googlegroups.com).
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
> 
> 


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



urls.py?

2011-12-08 Thread Jim Byrnes
I am trying to learning django by working my way through The Definitive 
Guide to django (vers 1.1). I am running django 1.1.1 on Ubuntu 10.04.


I get the following error when trying to import urls:

>>> import urls
Traceback (most recent call last):
  File "", line 1, in 
  File "/home/jfb/MyProgs/djcode/mysite/urls.py", line 16, in 
(r'^contact/$',views.contact),
AttributeError: 'module' object has no attribute 'contact'

Here is urls.py:

from django.conf.urls.defaults import *
from mysite import views
from mysite.views import hello, current_datetime, hours_ahead, display_meta
from django.contrib import admin
from mysite.contact import views
from mysite.books import views

admin.autodiscover()

urlpatterns = patterns('',
(r'^hello/$', hello),
(r'^time/$', current_datetime),
(r'^time/plus/(\d{1,2})/$', hours_ahead),
(r'^admin/' , include(admin.site.urls)),
(r'^contact/$',views.contact),
(r'^search-form/$', views.search_form), #from mysite.books
(r'^search/$', views.search),   # from mysite.books

)

If I comment out either the reference to importing contact and it's 
pattern or books and it's pattern I get no error. Both books and contact 
are directories at the same level under mysite.


Usually when I get in situations like this it is because I missed 
something.  I've gone back a reviewed everything I have done and still 
don't understand what is wrong.


I would appreciate any help you could give me in figuring this out.

Thanks,  Jim


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: urls.py?

2011-12-08 Thread Mario Gudelj
I think you have to add "from views import *" to urls.py and make sure you
have a method called contact in your view.

Cheers,

On 09/12/2011 12:10 PM, "Jim Byrnes"  wrote:

> I am trying to learning django by working my way through The Definitive
> Guide to django (vers 1.1). I am running django 1.1.1 on Ubuntu 10.04.
>
> I get the following error when trying to import urls:
>
> >>> import urls
> Traceback (most recent call last):
>  File "", line 1, in 
>  File "/home/jfb/MyProgs/djcode/**mysite/urls.py", line 16, in 
>(r'^contact/$',views.contact),
> AttributeError: 'module' object has no attribute 'contact'
>
> Here is urls.py:
>
> from django.conf.urls.defaults import *
> from mysite import views
> from mysite.views import hello, current_datetime, hours_ahead, display_meta
> from django.contrib import admin
> from mysite.contact import views
> from mysite.books import views
>
> admin.autodiscover()
>
> urlpatterns = patterns('',
>(r'^hello/$', hello),
>(r'^time/$', current_datetime),
>(r'^time/plus/(\d{1,2})/$', hours_ahead),
>(r'^admin/' , include(admin.site.urls)),
>(r'^contact/$',views.contact),
>(r'^search-form/$', views.search_form), #from mysite.books
>(r'^search/$', views.search),   # from mysite.books
>
> )
>
> If I comment out either the reference to importing contact and it's
> pattern or books and it's pattern I get no error. Both books and contact
> are directories at the same level under mysite.
>
> Usually when I get in situations like this it is because I missed
> something.  I've gone back a reviewed everything I have done and still
> don't understand what is wrong.
>
> I would appreciate any help you could give me in figuring this out.
>
> Thanks,  Jim
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to django-users+unsubscribe@**
> googlegroups.com .
> For more options, visit this group at http://groups.google.com/**
> group/django-users?hl=en
> .
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: documentation patch questions

2011-12-08 Thread Annie
Thanks for the feedback, Russ. :) I've created the ticket and
submitted the patch. It's ticket #17364.

On Dec 7, 4:44 pm, Russell Keith-Magee 
wrote:

> If you're in the area and aiming for perfection, I'd be inclined
> to take a closer look at the test names, too. testSpeaking isn't
> an especially good test name -- something like
> test_animals_can_speak(), that phrases the test as an assertion
> would be a better example.

I've used your suggestion, thanks.

> Giving the test a docstring that will be used by the test runner
> verbose/error output would also be a good idea.

I'm still learning the unittest framework, so I'm not sure exactly how
to clearly phrase what it's doing, but I'll give it a shot. *g* Do you
mean something like:

'''
AnimalTestCase creates several animal objects and uses assertEqual
to verify that the results from speak() match the expected results.
'''

Something in that general vicinity? *g* (There isn't a full example
that all the sample tests are being written for to refer back to,
unfortunately. I know I would find that useful, coming in as someone
not familiar with writing tests, because then it's easier to see what
exactly is different about the *testing* methods being demonstrated,
rather than having to worry about keeping track of what the example
class or method being tested is doing, too. FWIW. *g*)

> I look forward to seeing your ticket and patch. Thanks for
> pitching in!

You bet. :)
Annie

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: urls.py?

2011-12-08 Thread Jim Byrnes

On 12/08/2011 07:23 PM, Mario Gudelj wrote:

I think you have to add "from views import *" to urls.py and make sure you
have a method called contact in your view.

Cheers,


Thanks, but I added "from views import *" and there definitely is a 
method called contact in /mysite/contact and still get the error.


Regards, Jim


On 09/12/2011 12:10 PM, "Jim Byrnes"  wrote:


I am trying to learning django by working my way through The Definitive
Guide to django (vers 1.1). I am running django 1.1.1 on Ubuntu 10.04.

I get the following error when trying to import urls:


import urls

Traceback (most recent call last):
  File "", line 1, in
  File "/home/jfb/MyProgs/djcode/**mysite/urls.py", line 16, in
(r'^contact/$',views.contact),
AttributeError: 'module' object has no attribute 'contact'

Here is urls.py:

from django.conf.urls.defaults import *
from mysite import views
from mysite.views import hello, current_datetime, hours_ahead, display_meta
from django.contrib import admin
from mysite.contact import views
from mysite.books import views

admin.autodiscover()

urlpatterns = patterns('',
(r'^hello/$', hello),
(r'^time/$', current_datetime),
(r'^time/plus/(\d{1,2})/$', hours_ahead),
(r'^admin/' , include(admin.site.urls)),
(r'^contact/$',views.contact),
(r'^search-form/$', views.search_form), #from mysite.books
(r'^search/$', views.search),   # from mysite.books

)

If I comment out either the reference to importing contact and it's
pattern or books and it's pattern I get no error. Both books and contact
are directories at the same level under mysite.

Usually when I get in situations like this it is because I missed
something.  I've gone back a reviewed everything I have done and still
don't understand what is wrong.

I would appreciate any help you could give me in figuring this out.

Thanks,  Jim


--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@**
googlegroups.com.
For more options, visit this group at http://groups.google.com/**
group/django-users?hl=en
.







--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: documentation patch questions

2011-12-08 Thread Russell Keith-Magee
On Fri, Dec 9, 2011 at 9:58 AM, Annie  wrote:
> Thanks for the feedback, Russ. :) I've created the ticket and
> submitted the patch. It's ticket #17364.

Thanks! The patch looks good; the only thing preventing me from
marking it ready for checkin is the discussion below about something
else you may want to add to the patch.

>> Giving the test a docstring that will be used by the test runner
>> verbose/error output would also be a good idea.
>
> I'm still learning the unittest framework, so I'm not sure exactly how
> to clearly phrase what it's doing, but I'll give it a shot. *g* Do you
> mean something like:
>
> '''
> AnimalTestCase creates several animal objects and uses assertEqual
> to verify that the results from speak() match the expected results.
> '''

Close, but probably a little verbose. All you're looking for is a 1
line expression of what is being tested. Aside from the basic
explanatory benefit, the docstring is used when you run the test suite
in verbose mode. If you run Django's test suite with -v 2, you'll see
what I mean. Without a docstring, you will see statements like:

test_can_speak (myapp.AnimalTestCase)... ok

but if you have a docstring on your test method:

def test_animals_can_speak(self):
"Animals that can speak are correctly identified"

The verbose output is a little more humane:

Animals that can speak are correctly identified...  ok

Long comments aren't required; you just need to provide something that
can be answered "OK".

Yours,
Russ Magee %-)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: documentation patch questions

2011-12-08 Thread Annie
Russ:
> Long comments aren't required; you just need to provide something
> that can be answered "OK".

That makes perfect sense, especially now that I see how it's being
used. *g* (Hadn't gotten to that part of the python unittest docs yet.
*g*) I've updated the patch and attached it.

Thanks for your help!
Annie

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Template Renderer safe if used with URL parameters?

2011-12-08 Thread Matthew Roy
I'm presently using a URL parameter to allow requests to specify a
particular template they want the results to be returned in, allowing
AJAX requests to get results in a particular format for inclusion in
different pages without any code duplication.

Is this actually safe? Is the input taken by render_to_response as the
template name actually sanitized enough to prevent Bad Things™ from
happening?

Obviously someone could request a template that's going to generate
errors on rendering (since the requester has no direct control over
the parameters the template will render with), but trying this out it
doesn't look like this will do anything other than generate an error
response. Am I missing something important?

Thanks for your help,
Matthew

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.