How to get ./manage.py test to stop spewing "Installing index for whatever"

2009-10-13 Thread Phlip
spew reporting on each installed index? -- Phlip http://zeekland.zeroplayer.com/ --~--~-~--~~~---~--~~ 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@goog

Re: How to get ./manage.py test to stop spewing "Installing index for whatever"

2009-10-13 Thread Phlip
t... But note the fixture system (if that's what's doing it) makes verbosity=1 useless for anything else. Long term, shouldn't The Committee consider bumping them to 2? > > -- > >  Phlip > >  http://zeekland.zeroplayer.com/ --~--~-~--~~

convert passing tests to beautiful test report?

2009-10-23 Thread Phlip
Djangoists: Given a bunch of unittests, how to convert them to some kind of literate or doc-stringed report? The goal is to show off all our tests! -- Phlip http://c2.com/cgi/wiki?ZeekLand --~--~-~--~~~---~--~~ You received this message because you are

slow tests on 1.1.1 w/ sqlite

2009-10-25 Thread Phlip
-who), so I'm open to any suggestions how to profile the system. The code is INSERTing once per test case, not transacting. If the basic Django apps were extruded by 1.0.x, do they need an upgrade? -- Phlip http://c2.com/cgi/wiki?ZeekLand --~--~-~--~~~---~--~-

Cucumber for Python?

2009-11-07 Thread Phlip
the block you write testage, like a test case. There's a ruby-python hybrid of Cuke available, but I would rather not inflict too much Ruby on my current shop. So how easy would something like this be to clone? And has anyone already started, or would like to collaborate on it? --

how to pass a session variable into a test request?

2009-11-12 Thread Phlip
e session object and call .save() on it, I can't because it's not a dict, I'm not logged in yet, etc.) I tried all that stuff and couldn't affect the bug. Any tips? -- Phlip -- You received this message because you are subscribed to the Google Groups "Django users"

Re: slow tests on 1.1.1 w/ sqlite

2009-11-13 Thread Phlip
res=[] should start in the current app. Django intends to be testable and modular, but your tests should not all break just because you suddenly plugged in a new module that came with a fixture that preempted your fixture. > -- >  Phlip >  http://c2.com/cgi/wiki?ZeekLand -- You receiv

Re: slow tests on 1.1.1 w/ sqlite

2009-11-15 Thread Phlip
like you said, the fix is discipline to name all test fixtures "test_foo" or something, and to remember to stay out of each others' namespace... -- Phlip -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this gro

Re: slow tests on 1.1.1 w/ sqlite

2009-11-16 Thread Phlip
> Yours, > Russ Magee %-) Yours wouldn't happen to know an answer for this, right? http://groups.google.com/group/django-users/browse_thread/thread/a91f161f386f10da/2eaccb410c4c0692 I literally don't know how to develop without TDD, and the inability to call any but the most trivial GET actions

Re: slow tests on 1.1.1 w/ sqlite

2009-11-16 Thread Phlip
Karen Tracey wrote: > http://code.djangoproject.com/ticket/10899 Thanks - I missed that one. Yes it's ugly, yes you can hide it in setUp (), and yes it bypasses the problems in the earlier works-around I looked at. -- Phlip http://code.djangoproject.com/ticket/10899 -- You recei

delete every record in a table?

2009-12-04 Thread Phlip
Plutocrat.objects.all(): p.delete() Is there a way to do that in one method call? and could such a method call only send one SQL command? -- Phlip http://c2.com/cgi/wiki?MoreliaViridis -- You received this message because you are subscribed to the Google Groups "Django users" group.

Re: delete every record in a table?

2009-12-04 Thread Phlip
Doug Blank wrote: > > Plutocrat.objects.all().delete() > > I found that quite slow. If you want to stay DB agnostic, I came up with this: > >    from django.db import connection, transaction >    models = [Person, User, ...] >    cursor = connection.cursor() >    flush_tables = [] >    for model i

how to avoid pk collisions at loaddata time

2009-12-08 Thread Phlip
g how to add the same data thru the Admin. But this would seem to be a systemic problem with fixtures, so I was curious if they had a systemic solution. -- Phlip http://c2.com/cgi/wiki?MoreliaViridis -- You received this message because you are subscribed to the Google Groups "Django us

Re: how to avoid pk collisions at loaddata time

2009-12-09 Thread Phlip
can wait while programmers fix their (hardcoded) PKs and try again. That argument would also work at test time, because the unit tests are expected to always get all PKs right, so the --gentle would be always turned on, and would be a kind of assertion. -- Phlip http://zeekland.zerop

Testing and request META data

2009-12-09 Thread Phlip
On Aug 14 2008, 5:39 am, "Hajo Smulders" wrote: > I need to set the HTTP_REFERER in the request.META data of a test client so > that i can unit test a view. > How do I do this? ie: How do i fake an HTTP header on a test client? Bump? I just hit this problem, and the above question is the only tr

python manage.py list_apps

2009-12-09 Thread Phlip
Djangoids: Given a large application with many apps (could have been called Packages), how to rip out a list of all of them? My initial guess, in the subject line, naturally did not work. -- Phlip http://c2.com/cgi/wiki?MoreliaViridis -- You received this message because you are

Re: python manage.py list_apps

2009-12-09 Thread Phlip
> > Given a large application with many apps (could have been called > > Packages), how to rip out a list of all of them? > > Aren't they listed in settings.py? Hmm. I could have just done python shell -> INSTALLED_APPS instead, I used find .. -name tests.py, and then some cuts and greps. Silly m

Re: how to avoid pk collisions at loaddata time

2009-12-09 Thread Phlip
On Dec 9, 3:10 pm, Russell Keith-Magee wrote: > Ok; using some non-pk value for PK references is certainly one way to > handle this. There is an issue around how to resolve a hash into an > actual pk value, but that shouldn't be impossible. In Rails, a YAML (JSON) fixture like this... norber

how to produce XML output from a test run?

2009-12-09 Thread Phlip
gs.py: TEST_RUNNER='doj.test.xmlrunner.run_tests' However, the above module has no run_tests() method. Is there some way to adapt it? Or is there some other way to get structured output for formatting? (I'm charged with building a test server, if anyone hasn't noticed yet

Re: how to produce XML output from a test run?

2009-12-09 Thread Phlip
On Dec 9, 4:52 pm, Russell Keith-Magee wrote: > If you want to use an XML test runner instead of the default > Text-based runner, take a copy of django.test.simple.run_tests() and > modify to suit your requirements. > > I will admit that this isn't a great solution It is because it's easy after

Re: how to avoid pk collisions at loaddata time

2009-12-10 Thread Phlip
On Dec 9, 4:25 pm, Russell Keith-Magee wrote: > > In general, Django "encourages" screwing with the Admin, then > > extruding sample records, while RoR "encourages" writing very terse, > > very templated YAML files as test code source. > > What rubbish. Just a netiquette note - I stopped reading

Re: how to produce XML output from a test run?

2009-12-10 Thread Phlip
>    python manage.py test --xml just a note; django-test-extensions broke --verbosity. Google Codesearch sez the fix is in there, but pip didn't have it. I'm now patching this up internally. other than that the package works great! Oh, except the assertions need embellished diagnostics... --

Re: Can I change the models.py of an existing django app?

2009-12-11 Thread Phlip
> > I just want to add 2 new fields to the model. If I upload the new > > models.py would the app work as before? > > Yes, but you'll have to manually adjust your database to have the new > fields. What does manage.py syncdb do? -- You received this message because you are subscribed to the Goog

Re: Can I change the models.py of an existing django app?

2009-12-11 Thread Phlip
it seems I guessed right! But this sophistry won't help anyone when they have to run ALTER TABLE... (-: -- Phlip -- 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.c

Re: Testing and request META data

2009-12-22 Thread Phlip
> >>> c = Client() > >>> c.get('/customers/details/', {'name': 'fred', 'age': 7}, > > ...       HTTP_X_REQUESTED_WITH='XMLHttpRequest') Thanks! Now how do I test an action that must use SSL? (I want a 304 bounce message if the user tries to use plain text.) I couldn't find a HTTPS or similar hea

assert_match_hash(self, reference, sample)

2010-04-19 Thread Phlip
diagnostic or '' ) ) diagnostic = diagnostic.strip() self.assert_equal( reference, sample, diagnostic ) Can anyone improve it? Did I overlook any dict manipulations that could simplify it? And if two hash values are themselves hashes, it could recurse, right? & H

Re: assert_match_hash(self, reference, sample)

2010-04-19 Thread Phlip
>         for key, value in reference.items(): >             if value == sample.get(key, value or True): if value == sample.get(key, not(value)): D'oh! C-: -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, s

Re: unit tests: database confusion

2010-05-12 Thread Phlip
> Hi jararaca >               Can u brief me the solution.Even i am not able to access test > database ,some how it fetch production database itself Hear galloping, think horses not zebras. are y'all running your test batch like this? python manage.py test --settings=test_settings.py does tes

pass related_name-s into Model.objects.create()?

2010-05-17 Thread Phlip
old-fashioned way, after they are created? -- 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-us...@googlegroups.com. To unsubscribe from this gro

pass related_name-s into Model.objects.create()?

2010-05-17 Thread Phlip
emote_name's in with the kwargs? If not, what's some clean way to construct everything all at once? -- 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 emai

Re: pass related_name-s into Model.objects.create()?

2010-05-18 Thread Phlip
> > But what about 'ForeignKey's? May we pass their 'remote_name's in with > > the kwargs? > > Foreign Keys - yes. Reverse Foreign Keys - no. Point: All kwargs takes is the fields on this object. > In the case of a foreign key, just pass in the object instance that > you want your object to be re

testing client.get('/yo/', {}, HTTPS='on') ?

2010-05-27 Thread Phlip
mewhat fruity if it's off by default! -- Phlip http://zeekland.zeroplayer.com/Hat_Trick/2 -- 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

need help writing FactorySquirrel - a custom fixture handler

2010-05-29 Thread Phlip
se. So am I mishandling the exec...globals() part? Is there a better way to register a handler? Help me bring squirrel-like speed to test cases! -- Phlip http://c2.com/cgi/wiki?ZeekLand -- You received this message because you are subscribed to the Google Groups "Django users" group. T

how to call label_tag?

2010-06-03 Thread Phlip
Djangoists: Given a form, I can expand a template with {{ form.my_field.label }} which inserts the string of label into my HTML. How do I call label_tag? It seems to decorate the label string with and similar HTML-correctness. {{ form.my_field.label_tag }} did not work. -- Phlip http://c2

Re: django + ajax

2010-06-07 Thread Phlip
On Jun 7, 4:48 am, tazimk wrote: > Also how should I implement the same thing using jquery library ? Isn't that how the online examples all work? -- 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..

test's client.post says post but request.method says GET

2010-07-29 Thread Phlip
he other absorbs new form data, as usual. However, when I print request.method, I get GET. Is this a bug in Client? or in (ahem) my comprehension? -- Phlip http://c2.com/cgi/wiki?ZeekLand -- You received this message because you are subscribed to the Google Groups "Django users"

Re: test's client.post says post but request.method says GET

2010-07-29 Thread Phlip
forgot to mention Django 1.1.2 On Jul 29, 5:18 pm, Phlip wrote: > Django aficionados: > > Here's my test code: > >         from django.test.client import Client >         self.client = Client() >         from django.core.files.base import ContentFile >      

Re: test's client.post says post but request.method says GET

2010-07-30 Thread Phlip
> What's the value of `self.url`? One possibility is that it doesn't end > with a slash Ends with a slash. I'm now checking the response goodies, like response.status, to see if any other redirections happen! -- You received this message because you are subscribed to the Google Groups "Django u

Re: test's client.post says post but request.method says GET

2010-07-30 Thread Phlip
On Jul 30, 3:28 am, Phlip wrote: > > What's the value of `self.url`? One possibility is that it doesn't end > > with a slash > > Ends with a slash. I'm now checking the response goodies, like > response.status, to see if any other redirections happen! Yup

do QuerySet joins still suck?

2010-08-10 Thread Phlip
rlooked something obvious... -- Phlip http://bit.ly/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-us...@googlegroups.com. To unsubscribe from this group, send email to django

Re: do QuerySet joins still suck?

2010-08-10 Thread Phlip
rom a child record; it might follow that notation. Could I trouble you for its home page? Googling for [django queryset join] gives zillions of newbs trying simple queries... --   Phlip   http://c2.com/cgi/wiki?ZeekLand -- You received this message because you are subscribed to the Google Grou

python manage.py runserver - can't see error stack traces when an Ajax handler throws an exception

2010-09-07 Thread Phlip
errors to print a simple exception trace to STDOUT, instead of going through all that baloney? -- Phlip http://c2.com/cgi/wiki?SamuraiPrinciple <-- re: django.db! -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this grou

db filter comparing a minimum to a range

2010-09-13 Thread Phlip
whose first comment appears in the date range: SELECT * FROM blog INNER JOIN comment ON comment.blog_id = blog.id WHERE MIN(comment.date) BETWEEN '2010-09-12' AND '2010-09-14' GROUP BY(blog.id) Can I get that without dropping to raw SQL? -- Phlip http://zeekland.zero

Re: db filter comparing a minimum to a range

2010-09-13 Thread Phlip
> Maybe this is what you want: > > http://docs.djangoproject.com/en/1.2/topics/db/aggregation/#filtering... Outrageous, thanks. I seem to have reconstructed the rational for .annotate(), which I didn't understand until now! -- You received this message because you are subscribed to the Google Gr

Re: db filter comparing a minimum to a range

2010-09-13 Thread Phlip
Curiously, if I add another constraint to the dates, it must go into the Min() itself: Blog.objects.annotate(min_date= Min('comment__date', comment__status='sane')).all() Otherwise the date range check is disjoint from the sanity check (important for modern commenters!), and lots of rec

rake routes

2010-10-19 Thread Phlip
A web platform which I will refer to as "Rails" lets you print out all the equivalents of the matchers and modules in the tree of urls.py files using "rake routes". Does Django have such a command? Or how could one be written? -- Phlip http://bit.ly/ZeekLand -- You r

Re: rake routes

2010-10-19 Thread Phlip
> 2. Add 'django.contrib.admindocs' to your INSTALLED_APPS. Tx! But I will rip the innards of that out, because I'm targeting the test side (as usual!), and because we have no admin yet... -- You received this message because you are subscribed to the Google Groups "Django users" group. To post

call more than one view action from an uri path?

2010-10-20 Thread Phlip
be available on some session or file-scope variable.) How to write an url() call in urls.py that handles part of a path, and then dispatches to the next part of the path, if any? -- Phlip http://bit.ly/ZeekLand -- You received this message because you are subscribed to the Google Groups

Re: call more than one view action from an uri path?

2010-10-21 Thread Phlip
it like you said. C-: The point is a REST path that can go arbitrarily shallow or deep without excessive code. What I looked for was a lambda here (simplified): url( 'nest', lambda *a,**k: doit(a, k) ) but that terminates the lookup on the last item (rest), instead of calling the la

Re: call more than one view action from an uri path?

2010-10-21 Thread Phlip
> REST, however, has a fairly rigid one-URL-one-action structure which is > ideally suited to Django's URL dispatch. The only way to get what you > want is to layer another dispatching service atop Django's. I don't > think you can do it with urlconfs alone. knp. The point of urlconf is to adapt a

Re: call more than one view action from an uri path?

2010-10-21 Thread Phlip
> You can't do something like this? > url('^((\w+)/(\d+)/)+$', 'myview', ...) Ah, I started with ^(.*)$ , and put the split on the inside. I will go with your + pattern, because it checks for trivial errors at the correct level. -- You received this message because you are subscribed to the Goo

Re: call more than one view action from an uri path?

2010-10-21 Thread Phlip
> url('^((\w+)/(\d+)/)+$', 'myview', ...) Actually, no, that's only giving the last two matches: (u'areas/2/', u'areas', u'2') -- 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.

Re: call more than one view action from an uri path?

2010-10-21 Thread Phlip
> Well, like I said, I haven't tested that particular regex.  But it > should be possible to write a regex that does work. it turns out your regex works fine: print re.search(r'^((\w+)/(\d+)/)+$', 'fries/4/frobs/9/areas/ 2/').group(1) Django uses groups() instead of group(1), for whatever reason

Re: dump sqlite to file when testing

2010-10-21 Thread Phlip
I just tried it: DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', # TODO restore'NAME': ':memory:', 'NAME': '/home/phlip/fun.db', 'USER': '',

Re: dump sqlite to file when testing

2010-10-22 Thread Phlip
On Oct 21, 10:54 pm, Russell Keith-Magee wrote: > On Fri, Oct 22, 2010 at 12:37 PM, Phlip wrote: > > I just tried it: > > > DATABASES = { > >    'default': { > >        'ENGINE': 'django.db.backends.sqlite3', > > #  TODO restore

Django 1.2.3 test fixtures are slower than creating every model object each time setUp() calls.

2010-10-23 Thread Phlip
test case, shouldn't that work at the same speed as manual creation? How on earth could it be slower?? -- Phlip http://zeekland.zeroplayer.com/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send ema

Re: What does an ideal django workflow setup look like?

2010-10-23 Thread Phlip
ile allows for short command lines: fab run # build a sample database from your test fixtures & launch a server fab shell # use iPython for the best shell. fab ci:'what I did' # run all the tests then integrate Also, read the book "Release It!", if you think you

Is there some way to log every SQL command sent to the DB?

2010-10-23 Thread Phlip
Google leads me to this: from django.db import connection print connection.queries It can't see the queries the test runner used to set up the database. So, how to log every SQL command to a log file? (Like RoR can?) -- Phlip -- You received this message because yo

Re: Django 1.2.3 test fixtures are slower than creating every model object each time setUp() calls.

2010-10-23 Thread Phlip
When I switch to TransactionTestCase - meaning a test case that does not use the transaction-rollback trick - the test time goes to 2.5s. This sucks. The test cases WITH transaction-rollback around each test case are SLOWER than test cases that just rebuild the DB by hand each time. -- You recei

Re: inheritance of fields and default values from parent model class

2010-10-24 Thread Phlip
=True, null=True)     manager = [my alias manager here] class Person(models.Model, MyModel):     name = models.CharField(max_length=255) class Place(models.Model, MyModel):     street = models.CharField(max_length=255) And now the model can't see the fields 'alias' or 'ma

Re: inheritance of fields and default values from parent model class

2010-10-24 Thread Phlip
> > class MyModel(models.Model): > >     alias = models.ForeignKey('self', blank=True, null=True) > >     manager = [my alias manager here] > >     def getAlias: > >           [whatever I need] > > > class Person(MyModel): > >     name = models.CharField(max_length=255) > > > class Place(MyModel):

Re: Is there some way to log every SQL command sent to the DB?

2010-10-25 Thread Phlip
> You could turn on logging through your DB Hey! Thinking outside the box is MY job!! grumble grumble grumble thanks grumble... -- 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.

SELECT * FROM `student` WHERE mark=(select max(mark) from student)

2010-10-25 Thread Phlip
Does anyone have a QuerySet for that? ( BTW please don't try to talk me out of it; I've been doing SQL since 1989 and am fully aware of all the alternatives there. C-; ) -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, sen

Re: SELECT * FROM `student` WHERE mark=(select max(mark) from student)

2010-10-26 Thread Phlip
On Oct 26, 2:42 am, Tom Evans wrote: > I'm curious, why can't I talk you into > Student.objects.all().order_by('-score')[0] ? > > It is clearly a superior query :/ > >> ( BTW please don't try to talk me out of it; I've been doing SQL since > >> 1989 and am fully aware of all the alternatives the

Re: SELECT * FROM `student` WHERE mark=(select max(mark) from student)

2010-10-26 Thread Phlip
> st=Student.objects.filter(marks__in=Student.objects.all().aggregate(Max('ma > rks'))) Aha - a marks__in may point to an aggregate subquery. In conclusion, screw my SQL server's optimizer. It deserves to suffer! (I can't seem to find a self-join to do what I need either...) -- You received t

Re: SELECT * FROM `student` WHERE mark=(select max(mark) from student)

2010-10-26 Thread Phlip
Tom Evans wrote: > Phlip, I'm going to try and make a non-stupid comment now :) http://xkcd.com/386/ > If you already know precisely the query you want to use, and you can't > coerce django's ORM to produce it, can you simply use Manager.raw()[1] > to generate t

Re: SELECT * FROM `student` WHERE mark=(select max(mark) from student)

2010-10-26 Thread Phlip
> I hope the auditors are only forcing you to do this with records that > aren't referenced as part of relationships, otherwise your database is > going to get hammered updating all the foreign keys. The design spec (which is ours, not any "CPA auditor's"), say to duplicate the living crap out of

Re: SELECT * FROM `student` WHERE mark=(select max(mark) from student)

2010-10-26 Thread Phlip
lf._db) max_pids = max_pids.values('name').annotate(Max('pid')).values('pid') return qs.filter(pid__in=max_pids) Now we can write any ORM statement we can think of, and (if those lines continue to pass tests) then we only see the top horizon of the data.

Re: SELECT * FROM `student` WHERE mark=(select max(mark) from student)

2010-10-26 Thread Phlip
> Things.objects.filter(id__in=Things.objects.values('name').annotate(max_id= > Max('id')).values_list('max_id', > flat=True)) I didn't do values_list because I guessed that the inner query would run and produce an array, then the outer query would run. My way, with values() on both sides of the

Re: SELECT * FROM `student` WHERE mark=(select max(mark) from student)

2010-10-26 Thread Phlip
On Oct 26, 10:24 am, Phlip wrote: > > This sounds like what django-reversion[1] does :) > > > [1]:http://github.com/etianen/django-reversion#readme > > We have to cover the situation where some clients might still have > rev(n-1), while some are up-to-date with rev(n

Factory Squirrel

2010-10-27 Thread Phlip
print self.kozmik_order # does not re-read the record >From here, to be more useful, we need to think of details like records without names (shameful!). Models with CamelCase already work - kozmik_LineItem. Any ideas how to improve this towards a true Squirrel? -- Phlip http://zeek

Re: Factory Squirrel

2010-10-28 Thread Phlip
Tx! But! > http://github.com/dnerdy/factory_boy How does this do aggregation? > Also, there is a more general python > solution:http://farmdev.com/projects/fixture/ that supports django. That one's a little _too_ general. But it supports aggregation (association, etc.).. -- You received this

How to override handle_uncaught_exception ?

2010-11-08 Thread Phlip
I just need the usual features - to log the actual error, and stick it in the programmer's face during a test run. But when I Google for this subject, I get ten thousand newbies asking why they got some other error, and self.handle_uncaught_exception appears in their stack trace! --

Re: How to override handle_uncaught_exception ?

2010-11-08 Thread Phlip
On Nov 8, 8:12 am, Phlip wrote: > I just need the usual features - to log the actual error, and stick it > in the programmer's face during a test run. > > But when I Google for this subject, I get ten thousand newbies asking > why they got some other error, and self.handl

Re: Testing and request META data

2009-12-28 Thread Phlip
> Now how do I test an action that must use SSL? (I want a 304 bounce > message if the user tries to use plain text.) This looks promising! class SSLAwareClient(Client): def __init__(self, *args, **kwargs): super(SSLAwareClient, self).__init__(*args, **kwargs) self.ssl = False

how can a test log in as a given user before calling client.get()?

2010-01-06 Thread Phlip
redirects to the login page. Fair enough, but tests have to run security-free (unless your administrators and premium users like bugs). So what do I set into the "session", and how do I add that to the .get(), to test a protected page? Watch this space! -- Phlip http://twitter.

Re: how can a test log in as a given user before calling client.get()?

2010-01-06 Thread Phlip
9632495b9ab78a54ff53a0d1145e2b9e8eb2af6') self.client.login(username='admin', password='admin') # <-- the money line self.get('/shop-admin/') # TODO get should demand a 200 Some of you might see fit to put that User into a reusable (but test- only) JSON file... t

ANN - django-test-extensions now provides assert_xml(xml, xpath)

2010-01-27 Thread Phlip
should be wide. Django cultists should test their web pages with client.get(), then drop their response.content strings into assert_xml(), to spot check that their templates populated the correct data values. These "view tests" are orders of magnitude faster and more convenient than,

Re: ANN - django-test-extensions now provides assert_xml(xml, xpath)

2010-01-27 Thread Phlip
elow my sig is a link to a book on view testing w/o screen scraping, for anyone who wants to follow up on these theories. Lots of wicked HTML (and XPath) in it, but no Django! C-: --   Phlip  http://zeroplayer.com/tfui/TestFirstUserInterfaces.pdf -- You received this message because you are subscr

Re: any suggestion about how to build Continuous testing for django project?

2010-02-01 Thread Phlip
t is a state of mind! Constantly test, with fab test, constantly pull in case your colleagues are up to something, and constantly run fab int:'what I did' each time the code gets any tiny bit better. -- Phlip http://browsershots.org/http://zeekland.zeroplayer.com/Uncle_Wiggilys_Travels

Re: any suggestion about how to build Continuous testing for django project?

2010-02-02 Thread Phlip
llustrate the alarm colors...; What does trac integration give bitten? In theory continuously passing builds should be orthogonal to your requirements list... -- Phlip http://browsershots.org/http://zeekland.zeroplayer.com/Uncle_Wiggilys_Travels/1 -- You received this message because you are

Re: Speeding the code-test-debug cycle

2010-02-02 Thread Phlip
s. The test runner should instead push the JSON contents directly into the database as bulk import statements. The final benefit of ":memory:" is SQLite3 is very fast when it does not save anything to disk, so it's the fastest backend possible for test. -- Phlip http://penbird.t

[ANN] Morelia - a BDD framework for Python

2010-02-04 Thread Phlip
40facb6998f778cb The complete user's manual, with illustrations, is here: http://c2.com/cgi/wiki?MoreliaViridis Good hunting! -- Phlip http://penbird.tumblr.com/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this g

Re: Django standards?

2010-02-04 Thread Phlip
temporary debug statements should instead be permanent assert_equal() statements. Tested code is, perforce, highly decoupled, so that tests can easily reach any situation. So Test-Driven Development tends to obviate questions about design - the best design is the one that works under pressure from both te

Re: Django standards?

2010-02-04 Thread Phlip
On Feb 4, 10:29 am, David Parker wrote: > Right on.  I haven't gotten much into testing Django yet.  My previous > experience is with Rails (RSpec/Shoulda/Cucumber) and Java (JUnit).  I > plan on actually driving my app with TDD, but I was curious to know > which "way" most developers in the Djan

sqlite3 gives "OperationalError: no such table: django_redirect"

2010-02-08 Thread Phlip
://www.pylucid.de/root/index.html The versions are Python 2.6.4 and Django 1.0.4. Further details available on request - I wouldn't know where to start describing our packages & setup. -- Phlip http://penbird.tumblr.com/ -- You received this message because you are subscribed to t

Re: sqlite3 gives "OperationalError: no such table: django_redirect"

2010-02-08 Thread Phlip
> It appears you have not run manage.py syncdb after adding > 'django.contrib.redirects' to INSTALLED_APPS. Even when testing into sqlite3 :memory:? I thought that obviated all syncdb considerations... -- You received this message because you are subscribed to the Google Groups "Django users" g

Re: sqlite3 gives "OperationalError: no such table: django_redirect"

2010-02-08 Thread Phlip
> It appears you have not run manage.py syncdb after adding > 'django.contrib.redirects' to INSTALLED_APPS. > > Karen Ah, I don't know if I have that in there yet (yes, it's hard to check), but I DO have this... 'django.contrib.redirects.middleware.RedirectFallbackMiddleware' ...in test_setti

bio-patch - the diagnostic "Mod matching query does not exist" should post MOAR

2010-02-12 Thread Phlip
gives no clue what record it sought. Hence my bio patch.) So, is this already in there somewhere? Maybe in a version > 1.0.4? Or would anyone like to add a cleaner version of it to the HEAD? Or does it totally suck in some way I can't realize? -- Phlip http://penbird.tumblr.com/ --

Re: bio-patch - the diagnostic "Mod matching query does not exist" should post MOAR

2010-02-12 Thread Phlip
> per my other appropriations oppropriations friggin' spell checker! -- 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-user

python manage.py test --omit=bad_app_one,bad_app_two

2010-02-17 Thread Phlip
trying to add a --skip feature to django-test-extensions, and it defers to ./django/test/simple.py's run_tests(), which has no argument that knocks out applications. So before I go hacking Django's core, is there a back-door (or a patch or module out there) that I'm overlooking? --

Re: Use django auth system with ruby on rails

2010-02-17 Thread Phlip
how about the RoR site serve authentications to the Django site over Oauth? unless if, as Tim's answer suggests, users don't want to log in twice? and shouldn't the salt and hash pattern appear inside the auth contrib? -- You received this message because you are subscribed to the Google Groups

Re: Use django auth system with ruby on rails

2010-02-19 Thread Phlip
I would start with unit tests that attack known passwords, entered into the View, and compare them with their hashed results extracted from the DB. -- Phlip http://penbird.tumblr.com/post/398311631/avatar-redux -- You received this message because you are subscribed to the Google Groups "D

Re: Django in the enterprise?

2010-02-24 Thread Phlip
it in Django instead, and link it to the old system. (And use TDD to write it all.) Eventually a new system will emerge, completely obscuring the old one. And, yes, Django can do webservices and such, just like platforms with much bigger advertising budgets. -- Phlip http://c2.com/cgi/wi

Re: Django in the enterprise?

2010-02-24 Thread Phlip
> Err... What's an "enterprise application", actually ??? An app written for a company large enough to run an in-house programming team. Their job consists of figuring out how to connect diverse systems that never expected to be connected! -- You received this message because you are subscribed

update a record without typing too much

2010-02-26 Thread Phlip
e way that bypasses "eval()", and other tawdry assaults on an object's private data? -- Phlip http://penbird.tumblr.com/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to dja

Re: update a record without typing too much

2010-03-01 Thread Phlip
On Feb 26, 2:35 pm, "ge...@aquarianhouse.com" wrote: > maybe like this?: > > def up(model, **kw): >     m.objects.filter(pk=model.pk).update(**kw) too kewt. .update only works on a recordset-in-progress, and so .update saves the record in one line. But... it can't change model at the same time

shortest way to recover from a QuerySet "object not found"

2010-03-04 Thread Phlip
ct (v 1.1.1) of Django to support my magic _default keyword. What's the absolute shortest stretch of code which pops a NullObject into my foo if the record 'bar' is not found? -- Phlip http://c2.com/cgi/wiki?ZeekLand -- You received this message because you are subscribed to the

Re: shortest way to recover from a QuerySet "object not found"

2010-03-04 Thread Phlip
method to use .get(). So to squeeze my attempt into one line, we get foo = (list(Foo.objects.filter(name='bar')) + [Foo()])[0], which is way too much typing. Doesn't anyone in Django-land have experience with the platforms that make this problem incredibly easy? -- Phlip -- You

Re: shortest way to recover from a QuerySet "object not found"

2010-03-04 Thread Phlip
Oh, look! "123"[:7] ! The string doesn't have 7 characters! Gee, shouldn't that throw an exception? -- Phlip -- 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...@googl

  1   2   >