/srv/irclogs.ubuntu.com/2011/09/12/#ubuntu-website.txt

dakermhall119, do you know why this http://pastebin.com/iN59biEq returns MultipleObjectsReturned ?12:35
mhall119daker: duplicate event titles with the same user attending both12:36
mhall119this is very likely to happen with events like "Ubuntu Hour"12:37
dakermhall119, how did you fix it ?12:37
mhall119what are you trying to accomplish?12:37
dakerwell i am trying to use get_or_create, if there is an event it's ok if not create one12:39
dakerevent, created = Event.objects.get_or_create(title=title, attendees__name__in=users)12:39
mhall119you'll need to give enough fields to uniquely identify a record12:39
mhall119if title isn't a unique field, you'll need something else12:39
mhall119you can look at loco_directory/common/management/commands/recoverdata.py to see how I was doing it for the recovery script12:41
dakerok12:42
mhall119if you might have more than one match, then you should to an if not Event.objects.filter(foo=bar).exists():12:43
mhall119and then create one12:43
dakerthe problem is that the sql query return two rows12:43
mhall119right, and .get and .get_or_create will throw an error if it matches more than one12:44
dakerit returns two rows because of attendees__name__in=users12:45
mhall119hang on, is it returning 2 copies of the same Event recort?12:45
mhall119record12:45
mhall119or 2 different Event records?12:45
daker2 records of the same event12:46
mhall119oh, ok.....12:46
dakerimagine you an event and daker & mhall119 are attending and12:46
dakerusers = [u'daker', u'mhal119']12:47
dakerevent, created = Event.objects.get(title=title, attendees__name__in=users)12:47
dakerthis will gives two records of the same events12:47
daker-s12:47
mhall119ok, then I'm not sure how to fix that12:47
mhall119probably the ManyToMany relationship is making that do unexpected things12:48
dakeryeah12:49
mhall119so then you might need to do the filter().exists() check first, and if nothing matches then to an .objects.create()12:55
dakerok12:56
mhall119nigelb: ping19:04
nigelbpong19:04
mhall119nigelb: I added another test case to https://code.launchpad.net/~mhall119/summit/scheduling-testcase/+merge/7392619:04
mhall119this one checks that we're not mixing private/public rooms and meetings19:05
nigelbman, I wish you pinged this to mee when I wasn't sleepy.19:05
mhall119it's currently failing, because we haven't made the autoscheduler aware of private rooms yet19:05
mhall119you're always sleepy :P19:05
nigelbits 0030. I should be sleeping.19:05
nigelbBut I'm a sysadmin.19:05
mhall119boo19:06
mhall119just mark it approved so it'll land, it's only test cases19:06
mhall119as long as your signature is on it, I'm happy19:06
nigelbmhall119: I'd like to run the tests to make sure they pass before I approve.19:06
nigelboh wait.19:07
mhall119I just said they don't pass19:07
nigelbit fails.19:07
nigelbboo.19:07
mhall119the MP is only to add test cases, not new functionality19:07
nigelbgo19:08
nigelbdone19:08
mhall119haha, sucker19:08
mhall119I mean, thanks nigelb19:08
nigelblol19:08
mhall119nigelb or cjohnston: https://code.launchpad.net/~mhall119/summit/fix-etherpad-edit-links/+merge/7506120:03
mhall119that fixed the annoying reverse lookup errors we'd had20:03
mhall119cjohnston: we need the private scheduling test cases passing before we can deploy what's in trunk20:05
mhall119I'll probably add more to them too20:05
james_wthat's not idea20:08
james_wl20:08
james_wcan I help in making trunk deployable again?20:09
james_wI'm being asked for changes that we would want deployed quickly, and so having that blocked isn't good for us20:10
mhall119james_w: we just need to update the autoschedule/reschedule code to be aware of private rooms and not try to schedule public meetings into them20:11
james_wprivate is a flag?20:11
mhall119for uds-p, I'd be okay if we just plain didn't auto-schedule private meetings or private rooms20:11
james_wit's not a type like "openly scheduled"?20:11
mhall119type='private'20:11
mhall119meetings have a private=True field20:12
nigelbmhall119: that's like a one-line changing?20:12
mhall119but rooms use a type20:12
mhall119nigelb: possibly20:12
nigelb*change20:12
mhall119I just wrote the tests for it20:12
mhall119you're more familiar with the scheduler itself20:12
james_wI'll take a look20:12
mhall119TDD20:12
nigelbIs the code that got chcked in that UDS?20:13
nigelbOr was that rescheduler? :P20:13
mhall119that was reschedule20:13
james_wI don't see a test failure on trunk?20:15
mhall119it's not in trunk yet20:16
mhall119wait, yes it is20:16
mhall119you're not seeing a failure?20:16
james_wnope20:17
nigelblol.20:17
nigelbWIN.20:17
mhall119:(20:17
mhall119james_w: how are you running the tests?20:17
james_w    def try_schedule(self):20:18
james_w        """Try to schedule this meeting in a suitable room."""20:18
james_w        open_rooms = self.summit.room_set.filter(type__exact='open')20:18
james_w./manage.py test20:18
james_wso autoschedule already skips private rooms20:18
james_wit does look like it will happily schedule private sessions in to public rooms though20:20
mhall119yeah20:20
james_wand I'm not really sure what reschedule should do20:20
james_wgiven that you can only schedule private rooms manually it should never delete an agenda item for one, so I think we're fine there too20:21
mhall119oh, my tests are wrong20:21
mhall119nigelb: I can't believe you approved bad tests20:22
nigelbmhall119: under threat and duress20:22
mhall119a likely excuse20:24
=== Ronnie2 is now known as Ronnie
mhall119james_w: can you merge in lp:~mhall119/summit/fixes-to-private-scheduling-tests and see if you get failing tests20:38
mhall119I'm still getting one test that fails, looks like a private meeting is being autoscheduled into an open room20:41
james_wstill no failure20:41
mhall119are you running in a virtualenv?20:41
james_wno20:42
mhall119maybe that's the difference....but they should still fail20:42
mhall119well, the one should20:42
james_wseems it's not running these tests?20:42
mhall119try python manage.py test schedule.PrivateSchedulingTestCase20:42
james_wValueError: Test label 'schedule.PrivateSchedulingTestCase' does not refer to a test20:43
mhall119well....that's interesting20:43
mhall119so you see that in summit/schedule/tests.py ?20:43
=== Ronnie1 is now known as Ronnie
james_whmm, looks like it may be a missing dependency20:45
james_wmodel_mommy20:45
mhall119yeah, surprised that didn't throw an error for you though20:45
james_wagain django's test infrastructure leaves a lot to be desired20:46
james_wmodel_mommy doesn't seem to be packaged?20:46
mhall119you can install it with pip20:46
mhall119best to setup a virtualenv20:46
mhall119then pip install -r requirements.txt from within that20:47
james_wgetting errors installing the requirements in a virtualenv21:09
mhall119:/21:09
mhall119on what?21:09
james_wfirst BeautifulSoup21:09
james_wwhich I just deleted from the file21:10
mhall119I don't think we need that anymore21:10
james_wno psycopg221:10
mhall119no?21:10
james_wwarning: manifest_maker: standard file '-c' not found21:10
james_werror: No such file or directory21:10
james_wnow, sorry21:10
mhall119oh, I think that needs dev headers installed system-wide21:10
nigelbdo you have python-dev?21:10
nigelb(gah, to slow :P)21:11
nigelb*too21:11
mhall119james_w: I think you need libpq-dev21:11
mhall119do compile the postgres driver for the virtualenv21:11
james_wpq or pg?21:12
mhall119pq21:12
mhall119weird, I know21:12
james_wok21:12
james_wI have to leave now21:12
mhall119ok21:12
james_wI'll continue with this tomorrow21:12
james_wthanks for the help21:12
nigelbjames_w: thank you for stopping by :)21:13

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!