Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!backfill.erje.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'django.': 0.05; 'assigning': 0.09; 'assuming': 0.09; 'line:': 0.09; 'logic': 0.09; 'statements': 0.09; 'developer': 0.10; 'cc:addr:python-list': 0.11; 'suggest': 0.14; 'times,': 0.14; 'changes': 0.15; "(it's": 0.16; 'obj,': 0.16; 'subject:Broken': 0.16; 'sender:addr:gmail.com': 0.17; 'fix': 0.17; 'code.': 0.18; 'trying': 0.19; 'cc:addr:python.org': 0.22; 'exists': 0.24; 'non': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; '>': 0.26; 'header:In-Reply-To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'url:mailman': 0.30; 'code': 0.31; 'supposed': 0.32; 'url:python': 0.33; 'created': 0.35; 'anybody': 0.35; 'received:google.com': 0.35; 'add': 0.35; 'url:listinfo': 0.36; 'url:org': 0.36; 'changing': 0.37; 'url:mail': 0.40; 'even': 0.60; 'new': 0.61; 'to:addr:gmail.com': 0.65 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=ipNbGbvwnHvaN004WsbNdO3CBlpqx9C3szHpMm+lxVQ=; b=oLl1UUH3DxCtY6smSKpW364lSDEl5Gg0ZdtcFhaepybCx6e9hOwX6GqkGICmxxIJE8 pWoNAhG+OM0XagyKQ114NV8uMrdi5etwuefXKRkCn0B+bpA7tmg5y1YMXV7bfIMWRVsr PC/qxGO+TyeTrarp4ysH+ssm8SjjASdsYPItnbTw1DIbu4Nyp1BWlUnTdc3lI81LhKln aveHvwsJmWL9CF0eH9IINTN3otGtx5ZSAYOlemtXrTjhmyDCJDohBi0btb9QVgtOTHfn +9eDAyI2ybbnn5rFnwLjrOSzee8QlIRonnpTN+aZDVGn7t7OUILItY13pu0geWAeeyGf 9tMg== X-Received: by 10.52.33.242 with SMTP id u18mr17212731vdi.78.1421141483957; Tue, 13 Jan 2015 01:31:23 -0800 (PST) MIME-Version: 1.0 Sender: maximesteisel@gmail.com In-Reply-To: References: From: Maxime S Date: Tue, 13 Jan 2015 10:31:03 +0100 X-Google-Sender-Auth: BLx-3_m20due8yVsawgMroJsb48 Subject: Re: Broken IF statement To: joboppsgpp@gmail.com Content-Type: multipart/alternative; boundary=20cf30780b4c53b3e9050c8549a3 Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 52 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1421143058 news.xs4all.nl 2926 [2001:888:2000:d::a6]:55294 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:83680 --20cf30780b4c53b3e9050c8549a3 Content-Type: text/plain; charset=UTF-8 2015-01-12 22:19 GMT+01:00 : > > https://bpaste.net/show/93be9e15634b <--- Line 19 through 22 > > At all times, my program is assigning the object priority of 0, even if one already exists in the database with a priority of 0 (it's supposed to be assigning it a priority of 1 in those cases). > > I'm a non developer trying to fix a freelancer's code. Would anybody be able to suggest changes to the IF logic that might be able to fix it, assuming the statements in the code provided look flawed? > > Thanks... > -- > https://mail.python.org/mailman/listinfo/python-list This line: obj, created = SocialAccount.objects.get_or_create(...) suggest you are using Django. If it is the case you have to add obj.save() after changing the priority to send the new value to the DB. Best, Maxime --20cf30780b4c53b3e9050c8549a3 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

2015-01-12 22:19 GMT+01:00 <joboppsgpp@gmail.com>:
>
> https://bpaste.net/show/93be9e15634b <--- Line 19 through 22
>
> At all times, my program is a= ssigning the object priority of 0, even if one already exists in the databa= se with a priority of 0 (it's supposed to be assigning it a priority of= 1 in those cases).
>
> I'm a non developer trying to fix a= freelancer's code. Would anybody be able to suggest changes to the IF = logic that might be able to fix it, assuming the statements in the code pro= vided look flawed?
>
> Thanks...
> --
>
https://mail.python.o= rg/mailman/listinfo/python-list


This line:

obj, creat= ed =3D SocialAccount.objects.get_or_create(...)

suggest you are usin= g Django. If it is the case you have to add obj.save() after changing the p= riority to send the new value to the DB.

Best,

Maxime
--20cf30780b4c53b3e9050c8549a3--