*** tpb has joined #tp | 00:00 | |
*** ChanServ sets mode: +o tpb | 00:00 | |
Landon | hey jmtan I'm a little stuck, in test_battle.py you have two classes... one inheriting scene.Scene and one framework.Application | 00:03 |
---|---|---|
Landon | I'm thinking that the BattleScene class should have its own runBattle method to get the ball rolling | 00:04 |
Landon | problem with that is, I think it should handle its own scene too, updating it for events etc | 00:04 |
Landon | not sure how to pull this off cleanly though | 00:04 |
Landon | (basically move changeScene into the BattleScene class) | 00:05 |
Landon | it seems my options are a) pass the TestBattle class in as an argument, or b) keep it in TestBattle and (somehow?) update the current scene when BattleScene has changed it | 00:06 |
Landon | any ideas? | 00:07 |
jmtan | could you explain what the runBattle method should be doing? battlescene should handle it's own scene? | 00:10 |
Landon | runBattle should run through the rounds in th battle and update the scene accordingly | 00:12 |
alanp | /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/4.3.3/../../../../lib/libmzscheme3m.a(bool.o): relocation R_X86_64_32 against `scheme_not_prim' can not beused when making a shared object; recompile with -fPIC | 00:12 |
alanp | /usr/lib/gcc/x86_64-linux-gnu/4.3.3/../../../../lib/libmzscheme3m.a: couldnot read symbols: Bad value | 00:12 |
alanp | collect2: ld returned 1 exit status | 00:12 |
jmtan | hm, what about using the update method in the Scene class? | 00:12 |
alanp | any idea why i'm getting that when compiling tpserver-cpp? | 00:12 |
jmtan | it is called every frame | 00:12 |
Landon | oh, it is? | 00:13 |
Landon | that would work well | 00:13 |
jmtan | yup, check scene.py | 00:13 |
alanp | llnz/mithros:ping | 00:24 |
llnz | alanp: heading out, sorry | 00:24 |
alanp | ok | 00:24 |
*** llnz has quit IRC | 00:24 | |
Landon | jmtan: hm, update is called too early | 00:36 |
Landon | before the TestBattle object has a currentScene, which makes it toss an error | 00:36 |
Landon | or maybe thats not the problem, hrm | 00:38 |
Landon | aha, bad indentation | 00:39 |
ezod | alanp: sent you the scoop on your error | 01:24 |
*** cherez1 has joined #tp | 01:36 | |
*** Vadtec has quit IRC | 01:37 | |
*** jnengland77 has quit IRC | 01:46 | |
*** cherez has quit IRC | 01:48 | |
*** cherez1 has quit IRC | 01:54 | |
*** cherez has joined #tp | 01:54 | |
ezod | mithro: ping? | 02:13 |
ezod | can't push my work on libtpclient-py due to permission error | 02:14 |
*** greenlion has joined #tp | 02:28 | |
mithro | ezod: pong | 02:37 |
mithro | ezod: give it a try now | 02:37 |
cherez | mithro: Is there a reason why Structure's check method raises an exception rather than returning False? | 02:38 |
mithro | cherez: because of the way it's used | 02:40 |
cherez | Alright. | 02:40 |
mithro | cherez: basically it's the type checking function | 02:40 |
cherez | unittest needs an assertion for not raising an exception.... | 02:40 |
mithro | self.assert_(True) right after the function call | 02:41 |
cherez | Oh, and string and character didn't have proper unicode support. | 02:42 |
cherez | I fixed string pretty easily but character would need some pretty low level changes. | 02:42 |
mithro | well character can't support unicode | 02:43 |
mithro | as it's a byte==single character | 02:43 |
cherez | I take it that's no problem, then? | 02:43 |
mithro | which means it's ASCII only | 02:43 |
cherez | We want proper unicode support in string? | 02:44 |
Greywhind | hello mithro | 03:05 |
Greywhind | just posted my blog post for tonight | 03:05 |
mithro | okay | 03:05 |
mithro | cherez: yes | 03:05 |
cherez | Alright, good. | 03:06 |
*** Vadtec has joined #tp | 03:26 | |
mithro | strings are equivalent to the xstruct s | 03:33 |
mithro | while chars are equivalent to the xstruct c | 03:33 |
*** peres has left #tp | 03:38 | |
*** cherez1 has joined #tp | 04:04 | |
cherez1 | Coding in a storm is depressing. | 04:05 |
*** cherez has quit IRC | 04:07 | |
*** cherez1 has quit IRC | 04:21 | |
*** cherez has joined #tp | 04:21 | |
mithro | cherez: why? | 04:24 |
cherez | Lost power twice while working tonight. | 04:24 |
cherez | Saving frequently has minimized damage, but it's starting to get to me. | 04:25 |
mithro | oh - we don't generally loose power here during storms | 04:46 |
mithro | time to get UPS? | 04:46 |
*** Greywhind has quit IRC | 04:54 | |
*** llnz has joined #tp | 04:57 | |
* llnz ponders | 05:07 | |
mithro | llnz: what are you pondering? | 05:52 |
llnz | just catching up from the weekend | 05:57 |
mithro | we had a public holiday today | 06:00 |
llnz | cool, lucky you | 06:06 |
llnz | i had one last monday | 06:07 |
tote | matthewd: ping | 06:12 |
matthewd | tote: Howdy! | 06:24 |
tote | matthewd: my memory is failing me, did we say monday or friday for the meeting? :) | 06:26 |
matthewd | Monday | 06:31 |
tote | matthewd: great, have the meeting now? whats on the agenda? | 06:41 |
matthewd | Good question :) | 06:45 |
matthewd | So, I saw your blog post | 06:46 |
tote | matthewd: is it okey? more/less detailed? missing something? | 06:50 |
matthewd | Yeah, looks good. | 06:54 |
mithro | heyo tote | 06:56 |
mithro | so you got some more commits? | 06:56 |
tote | mithro: for today, or last week? i did 2 commits last week :) | 06:59 |
mithro | so I would be thinking that a full week would be a bit more | 07:00 |
mithro | commit early and commit often | 07:00 |
tote | yeah it wasnt that much, i had my final exam on friday last week so i couldnt work full time | 07:02 |
tote | mithro: i tried submodules and it didn't work | 07:03 |
tote | should a clone both repos inside my own repo? | 07:04 |
matthewd | tote: That may explain why I'm staring at a 'git submodule init' that isn't doing anything :) | 07:08 |
tote | :) | 07:09 |
tote | matthewd: how would i setup submodules? | 07:10 |
tote | git submodule add ?what should be here? | 07:12 |
matthewd | I'm not sure; I haven't actually used submodules. | 07:13 |
tote | git submodule add giturl path seems to work | 07:14 |
matthewd | What do I need to do, to run the WSGI? | 07:21 |
tote | use a python webserver supporting wsgi, or mod_wsgi for apache | 07:22 |
tote | the entry point is tpclient-pyweb.wsgi | 07:22 |
tote | and there is nothing like an install atm, so youll have to play with symlinks to get imports working (im a bit confussed how submodules, installs and imports should work together) | 07:24 |
CIA-46 | joelboh tpclient-pyweb * r76508e109331 / (.gitmodules libtpclient-py libtpproto-py): Fixing git submodules. | 07:27 |
tote | hopefully it should work now :) | 07:28 |
matthewd | Looks like I've managed to get close, at least :) | 08:10 |
matthewd | TypeError: callback() got multiple values for keyword argument 'mode' | 08:10 |
* llnz wanders off | 08:12 | |
llnz | later all | 08:12 |
*** llnz has quit IRC | 08:12 | |
tote | matthewd: hmm, weird :/ | 08:15 |
tote | matthewd: what webserver are you using? and do you have a traceback or something? | 08:19 |
matthewd | Apache2 | 08:20 |
*** DTRemenak has quit IRC | 08:20 | |
*** DTRemenak has joined #tp | 08:21 | |
matthewd | http://pastebin.com/m2fd1a527 | 08:23 |
tpb | Title: pastebin - collaborative debugging tool (at pastebin.com) | 08:23 |
matthewd | (That's while accessing /get/objects/) | 08:23 |
tote | matthewd: i think you have an old version of libtpclient and/or libtpproto | 08:27 |
*** DTRemenak|RDP has joined #tp | 08:31 | |
*** DTRemenak has quit IRC | 08:33 | |
*** DTRemenak|RDP is now known as DTRemenak | 08:33 | |
*** reac has joined #tp | 08:33 | |
reac | wasn't sure whether to post this on tp or tp-devel so i'll just mention it here, but it seems spammers have infiltrated the the TP Gsoc 2009 board | 08:35 |
matthewd | tote: Oh, that's right... it complained when I pulled, then I forgot to go back once I had wsgi working | 08:50 |
matthewd | Yep, that's better :) | 09:04 |
mithro | reac: yeah | 09:21 |
mithro | can you poke JLP? | 09:21 |
mithro | tote: you probably want to create a requirements.py like both daneel-ai and tpclient-pywx use | 09:21 |
tote | mithro: yep, seems like a good idea, thanks :) | 09:24 |
mithro | sadly there is no way to mark "auto checkout submodules" too | 09:25 |
tote | hmm, never written a setup.py script, but wouldnt that be better if it could do git submodule init and install the submodules too? as im using for instance mod_wsgi that might reload the code if it starts a new process than the git commands might slowdown a few requests? | 09:30 |
*** greenlion has quit IRC | 09:40 | |
*** bddebian has joined #tp | 10:06 | |
bddebian | Heya | 10:09 |
CIA-46 | mavrinac libtpclient-py-stable * r4fb41623af7d /tp/client/ (SinglePlayer.py launcher.py): | 10:39 |
CIA-46 | Check for premature subprocess termination and stop the single player | 10:39 |
CIA-46 | game if it occurs. | 10:39 |
CIA-46 | mavrinac libtpclient-py-stable * r67f883c00761 /tp/client/SinglePlayer.py: Import 'started' element. | 10:39 |
CIA-46 | mavrinac libtpclient-py-stable * r3e96a2870ea9 /tp/client/launcher.py: Proper Epydoc docstrings in launcher.py. | 10:39 |
CIA-46 | mavrinac libtpclient-py-stable * r4c83ca3273d8 /tp/client/ (SinglePlayer.py launcher.py): | 10:39 |
CIA-46 | Implement onready callback if a 'started' string to match is available | 10:39 |
CIA-46 | from the server tpconfig XML. | 10:39 |
*** alanp_ has joined #tp | 11:10 | |
alanp_ | llnz/mithro: ping | 11:10 |
*** greenlion has joined #tp | 11:27 | |
CIA-46 | ric daneel-ai * rc27490fab766 / (4 files in 2 dirs): | 12:42 |
CIA-46 | daneel/mod-risk.py: added guards to check connection is not none | 12:42 |
CIA-46 | daneel/basic.py: added delta function argument to startTurn | 12:42 |
CIA-46 | daneel_ai_profiler.py: profiling working on risk save games. | 12:42 |
CIA-46 | daneel_ai.py: added guards to check connection is not none, added delta function argument to startTurn, | 12:42 |
CIA-46 | added SaveGame(), pickle(), checkSaveFolderWriteable() and gameLoopBenchMark() | 12:42 |
*** Erroneous has joined #tp | 12:59 | |
CIA-46 | mavrinac tpserver-cpp * r104409969059 /AUTHORS: | 13:00 |
CIA-46 | Revert "Added myself to the AUTHORS file as per Aaron" | 13:00 |
CIA-46 | This reverts commit 7a7c21df9fee817f3dfddbc28006d4fbf87f5e88. | 13:00 |
CIA-46 | mavrinac tpserver-cpp * redf129ae406d / (24 files in 3 dirs): Merge branch 'master' of git+ssh://[email protected]/git/tpserver-cpp | 13:00 |
CIA-46 | mavrinac tpserver-cpp * r4d076fa5600d / (tpserver-cpp-inplace.xml tpserver-cpp.xml.in): | 13:00 |
CIA-46 | Add 'started' element to tpconfig XML (regex to match so that single | 13:00 |
CIA-46 | player launchers know when the server is ready). | 13:00 |
*** verhoevenv has joined #tp | 13:02 | |
*** Greywhind has joined #tp | 13:16 | |
ezod | need some google account id's from gsoc students | 13:19 |
ezod | Landon: ^ | 13:19 |
ezod | cherez: ^ | 13:19 |
ezod | and epyon | 13:19 |
ezod | cherez: nm got yours | 13:22 |
mithro | ezod: ? | 13:41 |
ezod | mithro: adding them to the google code project for issue tracking, etc. | 13:42 |
*** tansell_laptop has quit IRC | 13:59 | |
*** mithro has quit IRC | 14:00 | |
CIA-46 | mavrinac tpclient-pywx-stable * r337854279125 /libtpclient-py: Update libtpclient-py submodule to latest head. | 14:13 |
*** jmtan has quit IRC | 14:46 | |
*** verhoevenv_ has joined #tp | 14:52 | |
*** alanp_ has quit IRC | 14:59 | |
*** verhoevenv has quit IRC | 15:10 | |
*** alanp has quit IRC | 15:24 | |
*** mhilmi has joined #tp | 15:36 | |
*** alanp has joined #tp | 15:50 | |
*** llnz has joined #tp | 16:03 | |
alanp | llnz, ping | 17:09 |
llnz | alanp: pong | 17:10 |
alanp | having a compile error | 17:10 |
alanp | LINK libtpmzscheme.la | 17:11 |
alanp | /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/4.3.3/../../../../lib/libmzscheme3m.a(bool.o): relocation R_X86_64_32 against `scheme_not_prim' can not be used when making a shared object; recompile with -fPIC | 17:11 |
alanp | /usr/lib/gcc/x86_64-linux-gnu/4.3.3/../../../../lib/libmzscheme3m.a: could not read symbols: Bad value | 17:11 |
alanp | collect2: ld returned 1 exit status | 17:11 |
llnz | alanp: do you have the mzscheme devel library installed? there should be a libmzscheme.so | 17:13 |
llnz | otherwise, use guile instead | 17:13 |
alanp | let me test | 17:14 |
alanp | i don't see a dev package for mzscheme? | 17:14 |
alanp | should i use guile 1.6 or 1.8? | 17:14 |
*** bddebian has quit IRC | 17:14 | |
llnz | alanp: either should work, 1.8 is probably better | 17:15 |
alanp | ok | 17:15 |
llnz | you may also need to pass --without-mzscheme to ./configure | 17:15 |
* alanp tries | 17:15 | |
alanp | same thing with guile | 17:24 |
alanp | /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/4.3.3/../../../../lib/libmzscheme3m.a(bool.o): relocation R_X86_64_32 against `scheme_not_prim' can not be used when making a shared object; recompile with -fPIC | 17:24 |
alanp | /usr/lib/gcc/x86_64-linux-gnu/4.3.3/../../../../lib/libmzscheme3m.a: could not read symbols: Bad value | 17:24 |
llnz | you need to disable building mzscheme | 17:26 |
llnz | try running ./configure with --without-mzscheme or --with-mzscheme=no | 17:27 |
alanp | k | 17:31 |
alanp | both of those halt config, i'm tring with-guile now | 17:34 |
alanp | same thing | 17:34 |
* alanp has idea | 17:35 | |
llnz | ? | 17:36 |
llnz | halt config? | 17:36 |
alanp | i didn't have the headers installed | 17:36 |
llnz | ah | 17:36 |
alanp | halt, like stop ./configure | 17:36 |
alanp | probably not the best verbage | 17:36 |
alanp | running with --with-guile --without-mzscheme now | 17:36 |
alanp | womp womp | 17:37 |
alanp | great success! | 17:37 |
alanp | thanks for the heads up llnz | 17:37 |
llnz | when "halting" was it saying something like, "Either MzScheme or Guile must be used. Please install mzscheme or guile. See ./configure --help if one is already installed." | 17:38 |
llnz | no problem | 17:38 |
alanp | yeah exactly | 17:38 |
alanp | because i didn't have guile-1.8-dev installed | 17:38 |
llnz | does tpguile build ok? | 17:38 |
alanp | yeah it built fine it loosk like | 17:38 |
*** jnengland77 has joined #tp | 17:38 | |
alanp | now if i could just fix this wireless dongle | 17:40 |
alanp | :P | 17:40 |
* alanp gets back to work on mtsec | 17:40 | |
alanp | open("/etc/tpserver-cpp/tpserver.conf", O_RDONLY) = -1 ENOENT (No such file or directory) | 17:43 |
alanp | would be nice if that listened to the ./configure --prefix | 17:43 |
llnz | pass -C /path/to/tpserver-cpp.conf to tpserver-cpp | 17:54 |
llnz | or just ignore it and configure via tpadmin-cpp | 17:55 |
* alanp nods | 18:12 | |
alanp | how can i read all logger output? | 18:12 |
alanp | Logger::getLogger()->debug( "Enter MTSec::createComponents"); | 18:12 |
alanp | for example, that | 18:12 |
ezod | set debug level | 18:13 |
ezod | or log level i should say, to debug | 18:13 |
alanp | it takes a number as a flag? | 18:13 |
alanp | doh | 18:14 |
ezod | i think it's just enumerated 0 - 3? try 0 | 18:14 |
* alanp should read | 18:14 | |
alanp | sweet, i think | 18:14 |
alanp | no | 18:15 |
alanp | i can't get that output from 0 or 3 | 18:16 |
alanp | tpserver-cpp --debug -l 3 | 18:16 |
ezod | log_level option? | 18:20 |
alanp | it's set to 1 in the file, -l doesn't override? | 18:20 |
ezod | -l 0 | 18:22 |
ezod | wait | 18:22 |
ezod | huh, not working for me either | 18:23 |
reac | -l won't override the value set in a config file | 18:23 |
alanp | why not? | 18:23 |
alanp | i mean, shouldn't it? | 18:24 |
ezod | that is the behaviour i am experiencing, but not what i expected | 18:24 |
alanp | yes | 18:24 |
alanp | that is exactly how it is | 18:24 |
alanp | threw me off for a while | 18:24 |
reac | or actually | 18:24 |
reac | if you want to override it | 18:24 |
ezod | alanp: settings.cpp is where the logic is | 18:24 |
reac | make sure the -l option is after the -C option :) | 18:25 |
reac | seems to work for me | 18:25 |
alanp | that is a bug :P | 18:25 |
alanp | haha, a funny one though | 18:25 |
ezod | llnz: is that ^ on purpose? | 18:25 |
ezod | personally i don't like it | 18:25 |
ezod | alanp: feel free to put it in the tracker | 18:25 |
ezod | and fix it ;) | 18:26 |
reac | I think it's just order of evaluation | 18:26 |
ezod | reac: yes, but what purpose does that serve? | 18:26 |
alanp | i can't think of another piece of software that does that... | 18:26 |
reac | Well if it's defined twice, it should use the later definition? | 18:26 |
alanp | command line options should always override | 18:27 |
ezod | opinions: 1. arguments should override conf files, 2. order of arguments should not matter | 18:27 |
alanp | +1 | 18:27 |
reac | yeah i guess so | 18:28 |
ezod | alanp: i would run it by llnz, post to tracker, patch in master branch, merge to your branch | 18:29 |
llnz | sound advice | 18:31 |
ezod | llnz: what do you think? | 18:32 |
ezod | if that is the expected behaviour it's news to me :) | 18:32 |
alanp | 2009-06-08 18:34:06 < Debug > XML Filename set successfully, Reading file | 18:34 |
alanp | woop woop | 18:34 |
llnz | ezod: the whole settings system probably needs a good going over | 18:35 |
llnz | i suspect that epyon's refactoring will removing it in favour of boost::options or some such | 18:36 |
ezod | that would be cool | 18:39 |
*** Vadtec has quit IRC | 18:55 | |
*** Vadtec has joined #tp | 19:01 | |
*** greenlion has quit IRC | 19:24 | |
alanp | tinyxml driving me insane | 19:33 |
Landon | internet! | 19:45 |
Landon | no more living off of neighbors wireless :p | 19:45 |
*** jnengland77 has quit IRC | 19:46 | |
*** tansell_laptop has joined #tp | 20:20 | |
CIA-46 | joelboh tpclient-pyweb * r414eddde36a0 /www/scripts/jquery.cookies.2.1.0.min.js: | 20:51 |
CIA-46 | Frontend: Created a simple login ui. | 20:51 |
CIA-46 | Added a jquery library to handle cookies, used by the login ui. | 20:51 |
CIA-46 | joelboh tpclient-pyweb * rc6f221127bb0 /www/ (index.html scripts/map.js): Woops, missed the two modified files from previous commit. | 20:52 |
Landon | ezod: [email protected] is my google account | 20:53 |
tansell_laptop | morning people | 20:54 |
Landon | morning | 20:54 |
cherez | Morning. | 20:54 |
tansell_laptop | ezod, why did you want people's google accounts? | 20:54 |
cherez | tansell_laptop: : I've got a slightly massive revision up for review when you have time. http://codereview.mithis.com/1004 | 20:56 |
tpb | Title: Issue 1004: Added unit tests for structures. - Code Review (at codereview.mithis.com) | 20:56 |
tansell | cherez, commit early, commit often :) | 20:57 |
tansell | cherez, what is test/test.py ? | 20:57 |
*** bddebian has joined #tp | 20:58 | |
cherez | That's the test.py you already had in the topmost directory. | 20:58 |
tansell | does it run? | 20:58 |
cherez | I don't think it ran to begin with. I guess I should take it out. | 20:59 |
tansell | cherez, well | 21:01 |
tansell | mark at the top | 21:01 |
tansell | FIXME: This test does not work | 21:01 |
tansell | and put the whole thing in a triple quoted string | 21:02 |
cherez | Alright, done. | 21:02 |
tansell | cherez, you done a coverage test on this? | 21:03 |
cherez | tansell: Yeah, there are still some big chunks I don't have covered yet. | 21:05 |
tansell | okay | 21:05 |
cherez | Most notably the __set__ and __get__ methods are untouched still. | 21:07 |
tansell | cherez, yeah - do you want me to explain how that works? | 21:08 |
tansell | I have a meeting now but will be back in about an hour | 21:08 |
tansell | btw check doesn't need to return true | 21:08 |
tansell | you call it, and if no exception then everything is fine | 21:08 |
tansell | but I guess if it makes the tests work better | 21:09 |
cherez | It makes it easier to show what parts are tests. | 21:09 |
cherez | unittest really needs an assertion for not raising an exception. | 21:09 |
tansell | yeah | 21:09 |
tansell | cherez, you should also put a docstring at the top of each module | 21:09 |
tansell | cherez, review done | 21:10 |
tansell | mostly good | 21:10 |
cherez | Alright. | 21:10 |
tansell | missing some cases | 21:10 |
*** tansell_laptop has quit IRC | 21:11 | |
*** tansell_laptop has joined #tp | 21:11 | |
CIA-46 | joelboh tpclient-pyweb * rfa7a16959698 /app/ (requirements.py tpclient-pyweb.wsgi): | 21:14 |
CIA-46 | Added requirements.py, it makes sure the submodules (libtpclient and | 21:14 |
CIA-46 | libtpproto) are loaded correctly. | 21:14 |
CIA-46 | landon tpclient-pyogre * r493d3cc0a731 /src/ (battleviewer.py scene.py): Added some methods to get the battle running as well as constantly updating the battlescene | 21:15 |
tansell_laptop | tote, I would do something like the following | 21:17 |
tansell_laptop | requirements.py setups up the database and directories and stuff | 21:18 |
tansell_laptop | and also touches a "REQUIREMENTS_DONE" file | 21:18 |
tansell_laptop | which your application then checks for | 21:19 |
ezod | tansell_laptop: i'm adding them to the google code project | 21:19 |
tote | tansell_laptop: ah great idea with a req_done file, that and login backend is on my list for stuff to work on tomorrow then :) | 21:21 |
tote | now its time for some sleep, gn :) | 21:22 |
*** zzorn has quit IRC | 21:31 | |
*** zzorn has joined #tp | 21:35 | |
*** verhoevenv_ has quit IRC | 22:13 | |
*** jmtan has joined #tp | 22:39 | |
*** jmtan has left #tp | 22:46 | |
tansell | I'm back now | 22:56 |
tansell | cherez, how you going? | 22:56 |
cherez | tansell: Acting on your suggestions right now. | 22:57 |
cherez | Then hope I understand this __get__ and __set__ magic. | 22:57 |
tansell | do you want me to explain it? | 22:57 |
cherez | And you overloaded __del__, __delete__, and __delattr__ just to mess me up, didn't you? :P | 22:58 |
tansell | cherez, so basically __get__ and __set__ are magic which makes @property work | 23:00 |
cherez | Right.... | 23:01 |
tansell | so basically __get__ gets call when the attribute is being gotten and __set__ is called when the attribute is gotten | 23:01 |
cherez | If a.m is a structure, and you call a.m = 5, it invokes structure.__set__(a,5), right? | 23:02 |
tansell | opps | 23:02 |
tansell | setten | 23:02 |
tansell | not quite | 23:02 |
tansell | well | 23:02 |
tansell | if a is a class which has m (which is a structure) | 23:02 |
tansell | then when you call A.m = 5 (where A is an *instance* of a) it invokes structure.__set__(A, 5) | 23:03 |
tansell | that slight different is quite important | 23:03 |
cherez | Ah, right. | 23:04 |
cherez | Does setattr bypass __set__? | 23:04 |
tansell | no | 23:06 |
tansell | well | 23:06 |
tansell | actually yes | 23:06 |
tansell | if you have a | 23:06 |
tansell | class a: def __setattr__(self, key, value): ..... | 23:07 |
tansell | then A.t = blah | 23:07 |
tansell | will call __setattr__ | 23:07 |
tansell | first | 23:07 |
cherez | So we just want to make sure structures correctly store and recall values? | 23:10 |
tansell | so basically the structures stuff does a couple of things | 23:11 |
tansell | the really basic ones like Integer basically just make sure you are setting the right type | 23:11 |
tansell | IE when you do a | 23:11 |
tansell | A.t = "test" | 23:11 |
tansell | a t is an IntegerStructure then you get an exception right there | 23:12 |
tansell | (rather then many minutes later when you try and pack the string) | 23:12 |
tansell | s/string/packet/ | 23:12 |
*** jmtan has joined #tp | 23:15 | |
tansell | it gets more complicated when you have list of things | 23:17 |
tansell | For example if you have the following | 23:17 |
tansell | A.t = [] | 23:18 |
tansell | A.t.append('blah') | 23:18 |
tansell | skips the __set__ method | 23:18 |
tansell | as it is effectively a | 23:18 |
tansell | (a.t.__get__(A)).append('blah') | 23:19 |
*** alanp has quit IRC | 23:19 | |
*** alanp has joined #tp | 23:19 | |
tansell | cherez, that make sense? | 23:20 |
cherez | Yeah. | 23:20 |
tansell | which is why the GroupStructure is so much more complicated | 23:20 |
*** mithro has joined #tp | 23:20 | |
tansell | it basically the __get__ returns a "proxy" dictionary | 23:20 |
tansell | (The GroupStructure.GroupProxy class) | 23:21 |
tansell | which basically routes things via the GroupStructure class | 23:22 |
cherez | Alright. | 23:22 |
cherez | Won't list need something like that as well? | 23:22 |
tansell | List inherits from GroupStructure | 23:22 |
cherez | Yeah, but they take different values so the inherited methods won't work, will they? | 23:23 |
tansell | thats the beauty of how the GroupProxy works | 23:26 |
tansell | it should still work | 23:26 |
cherez | Well, the unit tests can decide. | 23:26 |
tansell | yeah :) | 23:27 |
tansell | the group proxy also allows you to do | 23:27 |
tansell | A.b.c | 23:27 |
cherez | Oh, nice. | 23:27 |
tansell | if class A has a GroupStructure which defines a .c | 23:28 |
tansell | and if .c is an IntegerStructure | 23:28 |
tansell | then A.b.c = "test" will cause an exception | 23:28 |
*** alanp has quit IRC | 23:29 | |
*** alanp has joined #tp | 23:30 | |
tansell | cherez, so you have a lot to test | 23:31 |
cherez | Yep. | 23:31 |
*** alanp has quit IRC | 23:31 | |
*** alanp has joined #tp | 23:32 | |
tansell | cherez, but once you finish that, it should cover the fundamentals | 23:32 |
*** bddebian has quit IRC | 23:54 |
Generated by irclog2html.py 2.17.2 by Marius Gedminas - find it at https://mg.pov.lt/irclog2html/!