Saturday, July 27, 2013

Re: Digest for django-users@googlegroups.com - 25 Messages in 12 Topics

Is there a group of people on fb or perhaps a seperate google group of people working through The Django Book?


On Fri, Jul 26, 2013 at 8:39 PM, <django-users@googlegroups.com> wrote:

Group: http://groups.google.com/group/django-users/topics

    Cate Liu <remotexiang@gmail.com> Jul 26 05:20PM -0700  

    I am a new newbie to Django. Great tutorial BTW. I followed it to the T
    and 99.9% worked.
    Except the last step in the Advanced tutorial, the step 3 in 'Using your
    own package'.
    I could see http://127.0.0.1:8000/admin/ and create polls without any
    problem.
    But http://127.0.0.1:8000/polls/ would give me the following error.
     
    I see there are two problems.
    1. /Users/nnn/django_exercises/mysite/templates/polls/index.html is the
    wrong location, it should be
    $$/django_polls/polls/templates/polls/index.html.
    2. What is polls/poll_list.html? Nowhere in the tutorial ever created this
    file, no?
     
    Thanks for any advice.
     
     
    ----------------------------------------------------------------------------------------------------------
    TemplateDoesNotExist at /polls/
     
    polls/index.html, polls/poll_list.html
     
    Request Method: GET Request URL: http://127.0.0.1:8000/polls/ Django
    Version: 1.5.1 Exception Type: TemplateDoesNotExist Exception Value:
     
    polls/index.html, polls/poll_list.html
     
    Exception Location: /Library/Python/2.7/site-packages/django/template/loader.py
    in select_template, line 194 Python Executable: /usr/bin/python Python
    Version: 2.7.2 Python Path:
     
    ['/Users/nnn/django_exercises/mysite',
    '/Users/nnn/py_pkg/lib/python/django_polls-0.1-py2.7.egg',
    '/Users/nnn/py_pkg/lib/python',
    '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip',
    '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7',
    '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin',
    '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac',
    '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages',
    '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python',
    '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk',
    '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old',
    '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload',
    '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC',
    '/Library/Python/2.7/site-packages']
     
    Server time: Fri, 26 Jul 2013 16:59:14 -0700
     
    Template-loader postmortem
     
    Django tried loading these templates, in this order:
     
    - Using loader django.template.loaders.filesystem.Loader:
    - /Users/nnn/django_exercises/mysite/templates/polls/index.html,
    polls/poll_list.html (File does not exist)
    - Using loader django.template.loaders.app_directories.Loader:
    - /Library/Python/2.7/site-packages/django/contrib/auth/templates/polls/index.html,
    polls/poll_list.html (File does not exist)
    - /Library/Python/2.7/site-packages/django/contrib/admin/templates/polls/index.html,
    polls/poll_list.html (File does not exist)

     

    Mike Dewhirst <miked@dewhirst.com.au> Jul 27 11:30AM +1000  

    On 27/07/2013 10:20am, Cate Liu wrote:
    > $$/django_polls/polls/templates/polls/index.html.
    > 2. What is ||polls/poll_list.html?| Nowhere in the tutorial ever
    > created this file, no?
     
    I don't know the tutorial and haven't looked through it but you have
    definitely called for poll_list.html somewhere in your code.
     
    The first place to look is in your urls.py. Try and see how the URL you
    entered is being interpreted. It is probably calling a view (in
    views.py?) which names poll_list.html directly.
     
    I put print statements in my settings.py if DEBUG == True which show my
    static, media and template locations every time I use manage.py
    runserver. It is very helpful when debugging file locations.
     
    You might also try http://127.0.0.1:8000/admin/polls/
     

     

    JJ Zolper <codingatmt@gmail.com> Jul 26 07:43AM -0700  

    Hello everyone,
     
    So I want to say thanks to the Django guys for providing more support for
    those of us that want to use a user's email as the UID and login handler
    versus the previous method of handling based on the username. I and
    probably many others appreciate the effort given to the topic and that it
    was integrated into Django 1.5.
     
    Today I would like to request a continuing expansion about this concept.
     
    In referencing this link:
     
    https://geekwentfreak-raviteja.rhcloud.com/2012/12/custom-user-models-in-django-1-5/
     
    I would like to request that if we want to make email the UID we don't have
    to do things such as:
     
    class MyUser(AbstractBaseUser, PermissionsMixin):
    ....
    is_staff = models.BooleanField('staff status', default=False,
    help_text='Designates whether the user can log into this admin '
    'site.')
    is_active = models.BooleanField('active', default=True,
    help_text='Designates whether this user should be treated as '
    'active. Unselect this instead of deleting accounts.')

    def get_full_name(self):
    full_name = '%s %s' % (self.first_name, self.last_name)
    return full_name.strip()

    def get_short_name(self):
    return self.first_name
     
    just to retain what could already be apart of Django. You guys know more
    about Django then I ever will and what the best way is to go about it but
    if we can eliminate additional code that is already in Django that would be
    wonderful.
     
    Now in referencing:
     
    http://stackoverflow.com/questions/16638414/set-email-as-username-in-django-1-5
     
    Basically what I'm saying is, we shouldn't have to do what this fellow had
    to do:
     
    Unfortunately there's nothing within django.contrib.auth that you can
    simply subclass to get a model that has
     
    1.

    email address in place of user name and
    2.

    works nicely with other django.contrib.auth-stuff, like groups.

    The simplest approach is to copy models.py, admin.py and forms.py from
    django.contrib.auth, rip out user name all over the place and put in email
    address in it's place. I've done just that and I'm using it successfully in
    a couple of client projects.
     
    I've put it up on github and pypi so you can install it with
     
    pip install django-libtech-emailuser
     
     
    I thank you for your time and I appreciate your consideration for
    integrating this once and for all into Django.
     
    JJ Zolper

     

    Russell Keith-Magee <russell@keith-magee.com> Jul 27 09:21AM +0800  


    > pip install django-libtech-emailuser
     
    > I thank you for your time and I appreciate your consideration for
    > integrating this once and for all into Django.
     
    Hi JJ,
     
    That's a fair comment -- "Email address as username" is a sufficiently
    common use case that it probably warrants being included in Django's core.
    I think I've overheard Jacob endorsing the same thing at some point in the
    past (although I'll stand corrected on this if I
    misheard/misunderstood/misattributed his comments).
     
    If you've already done the heavy lifting here, then all we need to do is
    massage your external package into contrib. Open a ticket and we can see
    what we can do about getting this in for 1.7.
     
    Yours,
    Russ Magee %-)

     

    veda av <vedaav12@gmail.com> Jul 26 12:10PM -0700  

    manage.py not recognized as an internal or external command
    why do we get this error

     

    Mike Dewhirst <miked@dewhirst.com.au> Jul 27 11:15AM +1000  

    On 27/07/2013 5:10am, veda av wrote:
    > manage.py not recognized as an internal or external command
    > why do we get this error
     
    manage.py isn't there. Or if it is there it isn't on the path. Did you
    cut any corners during installation?
     

     

    Vinod Halaharvi <vinod.halaharvi@gmail.com> Jul 26 10:37AM -0700  

    Is there a way to download just the code examples listed in the Django
    documentation pages ?
     
    VH

     

    Mike Dewhirst <miked@dewhirst.com.au> Jul 27 11:13AM +1000  

    On 27/07/2013 3:37am, Vinod Halaharvi wrote:
    > Is there a way to download just the code examples listed in the Django
    > documentation pages ?
     
    That's not necessarily a good idea but it depends what you want to do..
     
    Why do you want to do that?
     
    It wouldn't be too difficult to write a little screen scraper using requests
     
    http://docs.python-requests.org/en/latest/
     
     

     

    Jon Dufresne <jon.dufresne@gmail.com> Jul 26 03:56PM -0700  

    Hi,
     
    I am creating a form for the user to add, edit, and remove all tags in the
    database. The tag models are handled by taggit. The form will look like like
     
    _Tag1_ [del]
    _Tag2_ [del]
    ______ <--- User enters next tag here
     
    [add tag]
     
    Clicking add tag will fire some javascript to add a new text input to the
    form. I trying to create this form in Django to handle the request. This is
    what I have so far. I am curious if I am going about this the right way. It
    all seems very... roundabout. Thoughts? One part that bothers me is I must
    inspect the incoming data to decide how many form elements to create.
     
    Coming from PHP, I would create form names with array notation (tags[pk] =
    name) and iterate over the array during the request.
     
    The existing_tag dictionary allows me to map form names to tag objects. The
    new_tags list allows me to iterate over tag fields that must be created as
    new tags.
     
    class TagsForm(forms.Form):
    def __init__(self, data=None, *args, **kwargs):
    super(TagsForm, self).__init__(data, *args, **kwargs)
     
    self.existing_tags = {}
    self.new_tags = []
     
    for tag in Tag.objects.all():
    name = 'tag%i' % tag.pk
    self.fields[name] = forms.CharField(
    initial=tag.name,
    required=False)
    self.existing_tags[name] = tag
     
    if data:
    for name in data:
    if name.startswith('newtags'):
    self.fields[name] = forms.CharField(required=False)
    self.new_tags.append(name)
    else:
    name = 'newtags'
    self.fields[name] = forms.CharField(required=False)
    self.new_tags.append(name)

     

    "Daniele Procida" <daniele@vurt.org> Jul 26 04:57PM +0100  

    How is this possible?
     
    # we start with a queryset actual_events
     
    # get forthcoming_events using filter()
     
    forthcoming_events = actual_events.filter(
    Q(single_day_event = True, date__gte = datetime.now()) | \
    Q(single_day_event = False, end_date__gte = datetime.now())
    )
     
    # get previous_events using exclude() and exactly the same terms as above
     
    previous_events = actual_events.exclude(
    Q(single_day_event = True, date__gte = datetime.now()) | \
    Q(single_day_event = False, end_date__gte = datetime.now())
    )
     
    # And now:
     
    # actual_events.count(): 467
    # forthcoming_events.count(): 24
    # previous_events.count(): 442
     
    SInce I have run .filter() and .exclude() with identical terms, should they not between them contain all the items in the queryset they acted upon, *whatever* the terms used?
     
    Daniele

     

    "Daniele Procida" <daniele@vurt.org> Jul 26 10:28PM +0100  


    >Firstly (and I don't think this is the cause of the problem) you're
    >calling datetime.now() four times, which will give you four different
    >datetimes (ie. the queries will not be completely identical).
     
    Good point, I will address that.
     
    >SQL uses a 3-valued logic (with null) so if any of the fields you're
    >filtering on are nullable you may not be able to rely on the law of
    >the excluded middle
     
    So, if one of the fields can be Null, then *neither*:
     
    queryset.filter(field=value)
     
    queryset.exclude(field=value)
     
    will match a record where it's Null?
     
    In that case, is there a better - more reliable - way than using both .filter() and .exclude() with the same terms to split a queryset into all those items that match a filter, and all those that don't?
     
    Thanks,
     
    Daniele

     

    Bill Freeman <ke1g.nh@gmail.com> Jul 26 05:36PM -0400  

    You really should figure out which record isn't showing up in either sub
    case and look at it in detail to see if NULLs are involved before you spend
    time trying to fix a problem that you don't have.
     
    You could, for example collect all the ids from the several queries into
    python sets, union the sub queries, and take the difference of that from
    the total query.
     
     

     

    Steve McConville <mcconville.steve@gmail.com> Jul 26 10:50PM +0100  


    > queryset.filter(field=value)
     
    > queryset.exclude(field=value)
     
    > will match a record where it's Null?
     
    As I understand it, this is correct - it's certainly the way SQL was designed.
     
    > In that case, is there a better - more reliable - way than using both .filter() and .exclude() with the same terms to split a queryset into all those items that match a filter, and all those that don't?
     
    As well as doing the queries above, you can get the nulls by doing
     
    queryset.filter(field__isnull=True)
     
    and then it's just a matter of deciding which of your two sets the
    nulls should be included in (probably with a logical OR). There are a
    number of other approaches as well, but somewhere we'll still have to
    decide what the meaning of null. My bias is towards making that
    explicit. The other obvious approach is to find queryset.all() and
    then the (null-less) set queryset.filter(field=value) and work with
    them.
     
    --
    steve
    http://stevemcconville.com/

     

    Carsten Fuchs <carsten.fuchs@cafu.de> Jul 26 06:32PM +0200  

    Hi Tom,
     
    thank you very much for your detailed reply, it helped at lot!
     
    Am 25.07.2013 19:00, schrieb Tom Evans:
    > entries, and remove all their departments from STAFF_BEREICHE. This
    > user should then be found with the slow query with LEFT OUTER joins,
    > but not with the fast query with INNER joins [...]
     
    Yes, I can reproduce this, and also for the opposite case, where a STAFF
    member has no entries in the related ERFASST table.
     
    And although I've clipped most of your text in the quote above for
    brevity, your text really made me understand the background and
    reasoning, too! :-D
     
    Now with correctness established, this leaves me with the performance
    problem. The formulation with the OR and the LEFT OUTER joins is indeed
    what we semantically need (also see below, about Erfasst and logging ;) ).
     
    The best that I could think of so far is to run the individual queries
    individually, combine the results in Python code (the "OR" operation),
    then (as we need a QuerySet at this place in the code for further
    filtering) run another query with `.filter(id__in=ManuallyCombinedResults)`:
     
     
    S_a = set(Staff.objects. \
    filter(bereiche=SomeDep).values_list('id', flat=True))
     
    S_b = set(Staff.objects. \
    filter(erfasst__datum__gte=FirstDay,
    erfasst__datum__lte=LastDay,
    erfasst__bereich=SomeDep).values_list('id', flat=True))
     
    Q_a_or_b = Staff.objects.filter(id__in=S_a | S_b).distinct()
     
     
    This is still about 50 times better than the form with Q objects and
    LEFT OUTER joins. (Do you see a way to optimize this even further (in
    the Django ORM)?)
     
    My initial assumption was that the OR in the all-in-one query would not
    be much slower than the individual queries, and was really surprised to
    learn otherwise...
     
    > * Erfasst is meaning logging here, right? Reaching the limits of my German :)
     
    Translated verbatim, "Erfasst" means "committed" or "recorded" -- which
    obviously is a really stupid name for a database table. Alas, this is
    the legacy that I got when I overtook the original PHP project, and
    backwards-compatibility has so far kept me from updating the name.
     
    What we really are recording here are "workdays". In my attempt to keep
    the examples in my initial post both easy to understand and correct, I
    only translated the table name for STAFF, but felt that I'd lose
    consistency and thus correctness if things got more involved if I
    translated ERFASST as well (especially with backwards relation names etc.)
     
    So the above is really an attempt to find all STAFF members who are
    assigned to a certain department regularly (via STAFF_BEREICHE), "OR"
    those who have spent a workday in that department in the given time range.
    (So new staff members who have not yet spent a single workday anywhere
    would promptly be missing from any report and form with the
    INNER-joins-only query...)
     
    Tom, many thanks for your help!
     
    Best regards,
    Carsten
     
     
     
    --
    Dipl.-Inf. Carsten Fuchs
     
    Carsten Fuchs Software
    Industriegebiet 3, c/o Rofu, 55768 Hoppstädten-Weiersbach, Germany
    Internet: http://www.cafu.de | E-Mail: info@cafu.de
     
    Cafu - the open-source game and graphics engine for multiplayer 3D action

     

    "Martin J. Laubach" <google@emsi.priv.at> Jul 26 11:48AM -0700  

    > This is still about 50 times better than the form with Q objects and
    > LEFT OUTER joins.
     
     
    This is rather unusual. A join in the database should be quite a bit
    faster than doing things manually, except if the joined tables produce
    massive amounts of data. This suggests that you're missing useful indexes
    and/or statistics for your query.
     
    mjl

     

    Karl Arunachal <kakararunachalservice@gmail.com> Jul 26 11:30PM +0530  

    Hi,
    I want to integrate tinymce in my text area. But i can't find any good
    tutorials for it. Can some someone please advice me how to do this.
    Thank you.

     

    Yu Yang <yy2012cn@gmail.com> Jul 26 08:22AM -0700  

    It is a blog app, I have created a Article model and Tag model. when I add
    data to Article table from Admin interface, the data is stored to database,
    but if I click the link to change the entry, it throws an exception "string
    indices must be integers, not str", the traceback is as follows:
    Environment:
     
     
    Request Method: GET
    Request URL: http://localhost:8000/admin/blog/article/1/
     
    Django Version: 1.5.1
    Python Version: 2.7.3
    Installed Applications:
    ('django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django.contrib.admin',
    'blog')
    Installed Middleware:
    ('django.middleware.common.CommonMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware')
     
     
    Traceback:
    File
    "/home/yangyu/.virtualenvs/django-blog/local/lib/python2.7/site-packages/django/core/handlers/base.py"
    in get_response
    115. response = callback(request, *callback_args,
    **callback_kwargs)
    File
    "/home/yangyu/.virtualenvs/django-blog/local/lib/python2.7/site-packages/django/contrib/admin/options.py"
    in wrapper
    372. return self.admin_site.admin_view(view)(*args,
    **kwargs)
    File
    "/home/yangyu/.virtualenvs/django-blog/local/lib/python2.7/site-packages/django/utils/decorators.py"
    in _wrapped_view
    91. response = view_func(request, *args, **kwargs)
    File
    "/home/yangyu/.virtualenvs/django-blog/local/lib/python2.7/site-packages/django/views/decorators/cache.py"
    in _wrapped_view_func
    89. response = view_func(request, *args, **kwargs)
    File
    "/home/yangyu/.virtualenvs/django-blog/local/lib/python2.7/site-packages/django/contrib/admin/sites.py"
    in inner
    202. return view(request, *args, **kwargs)
    File
    "/home/yangyu/.virtualenvs/django-blog/local/lib/python2.7/site-packages/django/utils/decorators.py"
    in _wrapper
    25. return bound_func(*args, **kwargs)
    File
    "/home/yangyu/.virtualenvs/django-blog/local/lib/python2.7/site-packages/django/utils/decorators.py"
    in _wrapped_view
    91. response = view_func(request, *args, **kwargs)
    File
    "/home/yangyu/.virtualenvs/django-blog/local/lib/python2.7/site-packages/django/utils/decorators.py"
    in bound_func
    21. return func(self, *args2, **kwargs2)
    File
    "/home/yangyu/.virtualenvs/django-blog/local/lib/python2.7/site-packages/django/db/transaction.py"
    in inner
    223. return func(*args, **kwargs)
    File
    "/home/yangyu/.virtualenvs/django-blog/local/lib/python2.7/site-packages/django/contrib/admin/options.py"
    in change_view
    1112. form = ModelForm(instance=obj)
    File
    "/home/yangyu/.virtualenvs/django-blog/local/lib/python2.7/site-packages/django/forms/models.py"
    in __init__
    244. object_data = model_to_dict(instance, opts.fields,
    opts.exclude)
    File
    "/home/yangyu/.virtualenvs/django-blog/local/lib/python2.7/site-packages/django/forms/models.py"
    in model_to_dict
    129. data[f.name] =
    list(f.value_from_object(instance).values_list('pk', flat=True))
    File
    "/home/yangyu/.virtualenvs/django-blog/local/lib/python2.7/site-packages/django/db/models/fields/related.py"
    in value_from_object
    1333. return getattr(obj, self.attname).all()
    File
    "/home/yangyu/.virtualenvs/django-blog/local/lib/python2.7/site-packages/django/db/models/manager.py"
    in all
    128. return self.get_query_set()
    File
    "/home/yangyu/.virtualenvs/django-blog/local/lib/python2.7/site-packages/django/db/models/fields/related.py"
    in get_query_set
    612. return
    self.instance._prefetched_objects_cache[self.prefetch_cache_name]
     
    Exception Type: TypeError at /admin/blog/article/1/
    Exception Value: string indices must be integers, not str
     
     
    the code of Article model and Tag model is as follows:
     
     
    class Tag(models.Model):
    name = models.CharField(max_length=50, unique=True, verbose_name='标签')
    slug = models.SlugField()
     
    def __unicode__(self):
    return self.name
     
    class Meta:
    verbose_name = '标签'
    verbose_name_plural = '标签'
     
    @models.permalink
    def get_absolute_url(self):
    return ('blog_tag', (), {'idx': self.id, 'slug': self.slug})
     
     
    # Create your models here.
    class Article(models.Model):
    """
    the model for blog article
    """
    STATUS_CHOICE = (
    (1, '编辑'),
    (2, '完成'),
    (3, '失效'),
    )
    title = models.CharField(max_length=100, verbose_name='标题')
    slug = models.SlugField(max_length=100)
    content = models.TextField(verbose_name='内容')
    created_time = models.DateTimeField(auto_now_add=True, verbose_name="创建时间")
    modified_time = models.DateTimeField(default=datetime.now,
    verbose_name="修改时间")
    tags = models.ManyToManyField(Tag, verbose_name='标签')
    category = models.ForeignKey('Category', blank=True, null=True, verbose_name='分类')
    always_top = models.BooleanField(default=False, verbose_name='置顶')
    author = models.CharField(max_length=40, verbose_name='作者')
    status = models.IntegerField(choices=STATUS_CHOICE,
    default=1, verbose_name='状态')
     
    @models.permalink
    def get_absolute_url(self):
    return ('blog_article', (), {'idx': self.id, 'slug': self.slug})
     
    def __getattr__(self, name):
    """
    add two attributes(summary, visible_comments) to the object
    Arguments:
    - `name`:
    """
    if name == 'summary':
    return util.get_summary(self.content)
    else:
    return ''
     
    def __unicode__(self):
    return self.title
     
    class Meta:
    ordering = ['-always_top', '-created_time']
    verbose_name = '博客文章'
    verbose_name_plural = '博客文章'
     
    the problem seems to be caused by "tags = models.ManyToManyField(Tag, verbose_name='标签')" , when I delete this line, there is no problem,
    but when I add it to the model, django throws an expcetion, this problem really annoys me, who can help me?

     

    Tom Evans <tevans.uk@googlemail.com> Jul 26 05:21PM +0100  

    > return util.get_summary(self.content)
    > else:
    > return ''
     
    This __getattr__ method is utterly bogus.
     
    With this method, every attempt to get an attribute of this instance
    either returns something special if the attribute is named 'summary',
    but most importantly, **it returns an empty string for EVERYTHING
    else**, regardless of anything, whether the attribute exists or not.
     
    I imagine at some point something in django is looking at an attribute
    which should be None, or raise an AttributeError, but it doesn't, it
    returns an empty string. It then uses this bogus empty string to try
    and index into a string.
     
    I imagine removing the ManyToManyField bypasses the code that does this.
     
    Cheers
     
    Tom

     

    heni yemun <henokie@gmail.com> Jul 26 07:51AM -0700  

    Hi,
    I'm trying to get a django project interact with ajax based site. The
    problem is that when i use the send function to send a POST data
    asynchronously the django app returns a 500 code and the server doesn't do
    anything. How do i correct this?

     

    Matt McClure <matthewlmcclure@gmail.com> Jul 26 06:55AM -0700  

    On Thursday, July 18, 2013 7:30:55 PM UTC-7, Matt McClure wrote:
     
    > TestSuite would otherwise hold after a TestCase runs until the remainder of
    > the suite had finished.
     
    > + self._tests.remove(test)
     
    That turns out to be a bad idea because it modifies a list inside a loop
    iterating over it, making the loop skip items it should visit. Here's an
    updated change that doesn't suffer from that problem:
     
    diff --git a/django/utils/unittest/suite.py b/django/utils/unittest/suite.py
    index f39569b..8530200 100644
    --- a/django/utils/unittest/suite.py
    +++ b/django/utils/unittest/suite.py
    @@ -1,5 +1,6 @@
    """TestSuite"""

    +import gc
    import sys
    import unittest
    from django.utils.unittest import case, util
    @@ -96,7 +97,11 @@ class TestSuite(BaseTestSuite):
    ################################
    # private methods
    def _wrapped_run(self, result, debug=False):
    - for test in self:
    + while True:
    + try:
    + test = self._tests.pop(0)
    + except IndexError:
    + break
    if result.shouldStop:
    break

    @@ -116,6 +121,7 @@ class TestSuite(BaseTestSuite):
    test(result)
    else:
    test.debug()
    + #gc.collect()

    def _handleClassSetUp(self, test, result):
    previousClass = getattr(result, '_previousTestClass', None)

     

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

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

No comments:

Post a Comment