innodb ibdata1 file grows irreversibly from testing
from what I understand, the ibdata1 file doesn't recover space from dropped tables. Since django testing creates a test database and then drops it, repeatedly, does this contribute to the ibdata1 file size? Thanks Cody -- 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: Unit Testing: temporarily altering django settings
Thanks -- I didn't know about mock objects, and this is good to know. But this doesn't feel like this is the solution I'm looking for. It's a large project, and your proposal would require extensive patching. Is the solution to create a new testrunner that sets a different environment (with different settings) for each app? Is there another way to fool a testcase into thinking that an app has not been installed? Thanks again, Cody On Feb 17, 2:00 pm, Phlip <phlip2...@gmail.com> wrote: > On Feb 17, 12:03 pm, Cody Django <codydja...@gmail.com> wrote: > > > For example, I have a captcha that is used in parts of a site that > > affects form logic. > > The django settings has a variable CAPTCHA = True, which acts as a > > switch. > > > I'd like to change this setting in the setup for each TestCase. > > You should use a mock object, to fake a-priori things like stochastic > user input. > > Python's mock library has a 'patch.object' feature which mocks a > method on a class, even before objects of that class are instantiated. > > In most of your setUp calls, patch the captcha handler to trivially > pass it, without real user input. > > To test the captcha, mock it to pass or fail. > > -- > Phlip > http://c2.com/cgi/wiki?ZeekLand -- 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.
Unit Testing: temporarily altering django settings
For example, I have a captcha that is used in parts of a site that affects form logic. The django settings has a variable CAPTCHA = True, which acts as a switch. I'd like to change this setting in the setup for each TestCase. The regular unittests tests (in which we are assuming the captcha is off) will not be affected, since their testcase has ensured that the CAPTCHA setting is set to False. The captcha app unittests will be able to test the new form logic, since their testcase has set the CAPTCHA setting to True. I thought I'd be able to simply use a setattr, but apparently it's not so easy. Is the only solution to create a new testrunner that actually sets up a different environment (with different settings) for each app? Thanks, Cody -- 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: adding user instance to the comments constructor for a dynamic comment form
sure, whatever. maybe you miss the point: I'd like to include the user instance in the constructor. Is there a way to do this without rewriting the comments framework? C On Aug 29, 4:24 pm, "Evan H. Carmi" <e...@ecarmi.org> wrote: > On Sun, 29 Aug 2010 16:08:45 -0700 (PDT) > > Cody Django <codydja...@gmail.com> wrote: > > I'd like to have the comment form contain a captcha if the user is > > logged in. > > Do you mean "have the comment form contain a captcha if the user *is > not* logged in? > > -E -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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.
adding user instance to the comments constructor for a dynamic comment form
I'd like to have the comment form contain a captcha if the user is logged in. short of rewriting the provided comment template tags I haven't found a solution. I'm curious if this issue hasn't been already addressed. Thanks -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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.
creating formset with unknown number of unique forms
the formset will contain an unknown series of questions. Each question contains a unique prompt, integerfield for the value, and a choicefield with a unique list of items, based on the scope of the question. I would like to use a formset so I can iterate over each question in the template, marking up the group appropriately. is this possible to achieve with a formset? it seems that I need to pass data to each individual form constructor, but this isn't possible using the "formset_factory" mechanism? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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: Help a newbie with his simple foreignkey problem?
Sorry - it should read: b = Book.objects.get(id=1) #new book request.user.get_profile().shelf1.add(b) #add book to shelf1 request.user.get_profile().shelf1.remove(b)#remove from shelf1 request.user.get_profile().shelf2.add(b) #add to shelf2 I think something like this works: Class Book #details Class Shelf1 user = foreignkey(UserProfile) book = foreignkey(related_name ="shelf1") Class Shelf2 user = foreignkey(UserProfile) book = foreignkey(related_name="shelf2") Class UserProfile user = foreignkey(User, unique = True) but it doesn't look very nice... I'd prefer to find a way to do something like this: b = Book.objects.get(id=1) #new book request.user.get_profile().shelf.1.add(b) #add book to shelf1 request.user.get_profile().shelf.1.remove(b)#remove from shelf1 request.user.get_profile().shelf.2.add(b) #add to shelf2 -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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=.
Help a newbie with his simple foreignkey problem?
Hi - I'm having a hard time wrapping my head around one-to-many relations. I'd like to be able to do this in a view: b = Book.objects.get(id=1) #new book request.user.get_profile().shelf1.add(b) #add book to shelf1 request.user.shelf1.remove(b) #remove from shelf1 request.user.shelf2.add(b) #add to shelf2 Both shelves are exactly the same, and each user always only has two shelves. The shelf objects are create and assigned to the UserProfile variables upon creation of the UserProfile. I figure the models should be organized like so: Class Book(models.Model) #book fields Class Shelf(models.Model) books = models.foreignkey(book) def add(self, b): self.books.append(b) #not sure about this def remove(self, Book): self.books.remove(b) #not sure about this Class UserProfile(models.Model): shelf1 = models.foreignkey(Shelf) shelf2 = models.foreignkey(Shelf) I don't understand how to add and remove objects from a one-to-many relation. According to the docs, going backward through a foreignkey relation makes available queryset methods such as .add, .clear, and .remove - but there aren't similar methods for going forward? Thank you for your insight! -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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=.
Re: Weird: the path to the image, retrieved using filebrowser, is rewritten with a wrong relative instead of absolute.
sorry -- already a fix: http://code.google.com/p/django-tinymce/issues/detail?id=22=1=image=ID%20Type%20Status%20Priority%20Milestone%20Reporter%20Owner%20Summary On Aug 17, 7:31 pm, Cody Django <codydja...@gmail.com> wrote: > I really don't know what is going on here. I've checked all my > settings for django-filebrowser and django-tinymce. > > 1) Using tinymce in admin, I'll click on "add image" > 2) Click on "filebrowser" icon in the image-prompt window, which opens > the filebrowser window > 3) Click on an image, which opens in a window > 4) Copy the absolute address from the url > 5) Paste it into the url field in the image-prompt window and click OK > 6) Image is now viewable in the textarea. > 7) click view object on site > 8) image has a broken link. I check the path for the image and it's > something like: instead > of the absolute path. > > * I've managed to have it display the absolute url if I include a www > in the absolute url field in the tinymce image-prompt window: > > ect: http://www.site.com/static/testimage.jpg (image url becomes > 'http://www.site.com/static/testimage.jpg') > instead ofhttp://site.com/static/testimage.jpg (image url becomes > '../../../../ > static/testimage.jpg') --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Weird: the path to the image, retrieved using filebrowser, is rewritten with a wrong relative instead of absolute.
I really don't know what is going on here. I've checked all my settings for django-filebrowser and django-tinymce. 1) Using tinymce in admin, I'll click on "add image" 2) Click on "filebrowser" icon in the image-prompt window, which opens the filebrowser window 3) Click on an image, which opens in a window 4) Copy the absolute address from the url 5) Paste it into the url field in the image-prompt window and click OK 6) Image is now viewable in the textarea. 7) click view object on site 8) image has a broken link. I check the path for the image and it's something like: instead of the absolute path. * I've managed to have it display the absolute url if I include a www in the absolute url field in the tinymce image-prompt window: ect: http://www.site.com/static/testimage.jpg (image url becomes 'http://www.site.com/static/testimage.jpg') instead of http://site.com/static/testimage.jpg (image url becomes '../../../../ static/testimage.jpg') --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
upgraded to python2.5, but error-reports/traceback still references python2.3?
This is weird: I used to use python2.3 on the mediatemple server, but recently upgraded to python2.5. I've also installed mysqldb, pil, ect under python2.5. I've updated my pythonpath so the python2.5 route is being used. Everything works just fine, but I've noticed in the traceback that python2.3 is still being referenced. For example: File "/usr/lib/python2.3/site-packages/django/core/handlers/base.py", line 92, in get_response response = callback(request, *callback_args, **callback_kwargs) Could there still be a cache that is holding the old paths? How can I completely rid django of python2.3? Thanks. Cody ps. I never told modpython to use python2.5, but apparently python itself updates which version of python to use when you install a new version. So I hear. --~--~-~--~~~---~--~~ 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: python 2.5 --> 2.3, now imagefield error
yes, and it contains the jpg and gif plugins, which I assume means that it does support jpgs. On Jul 27, 9:15 pm, Darryl Ross <dar...@afoyi.com> wrote: > Cody Django wrote: > > ImageFields worked just fine until I moved to a new server. Now I get > > error messages "Upload a valid image". I know the images are fine, > > the media root and www_url are correct, so what else could this be? > > Ideas are greatly appreciated! > > Do you have PIL installed on the new server? > > signature.asc > < 1KViewDownload --~--~-~--~~~---~--~~ 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: python 2.5 --> 2.3, now imagefield error
checked: - pil supports jpgs - permissions set to 775 on upload folders On Jul 27, 7:44 pm, Cody Django <codydja...@gmail.com> wrote: > All imagefields give this error: Upload a valid image. The file you > uploaded was either not an image or a corrupted image. > > I suspect that imagefield itself is compatible with python 2.3, so > where else could the problem be? It's not with the image. > > Ideas are greatly appreciated... Thanks. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
python 2.5 --> 2.3, now imagefield error
All imagefields give this error: Upload a valid image. The file you uploaded was either not an image or a corrupted image. I suspect that imagefield itself is compatible with python 2.3, so where else could the problem be? It's not with the image. Ideas are greatly appreciated... Thanks. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
python 2.5 --> 2.3, now imagefield error
ImageFields worked just fine until I moved to a new server. Now I get error messages "Upload a valid image". I know the images are fine, the media root and www_url are correct, so what else could this be? Ideas are greatly appreciated! Cody --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---