Re: Integrating Selenium tests into Django unit tests.
On 3 srp, 21:56, Tom Christie wrote: > I just had to do the same thing. Tried to use the django-sane-testing > package, but didn't have much success there. Might I ask what was the problem? > Cheers, > T. Thanks, Almad -- 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@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
reverse() and include('app, namespace='app)
Hi, I have encountered strange behavior with urls.py: namespacing application breaks all reverse()s inside it. Detailed description is here: http://stackoverflow.com/questions/3578922/how-to-do-reverse-url-search-in-django-namespaced-reusable-application Have I missed something, is it a feature or shall it be reported as a bug? Thanks, Almad -- 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-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
How to distribute static/media files with reusable applications?
Hi, is there any "standard"/convention on how to distribute media files (css, js, images, ...) with reusable applications? How is it then integrated into project? Thanks, Almad -- 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-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: reverse() and Django with fastcgi behind lighty with sockets
On Oct 12, 1:32 am, sleepyjames wrote: > you need to set FORCE_SCRIPT_NAME in your settings. > > http://docs.djangoproject.com/en/dev/ref/settings/#force-script-name Missed that - thanks! Almad --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
reverse() and Django with fastcgi behind lighty with sockets
Hi, I'm deploying Django behind lighttpd and have official-docs-like config: fastcgi.server = ( "/django.fcgi" => (( "socket" => "/path/to.socket", "check-local" => "disable", )) ) alias.url += ( "/media" => "/path/to/app/media/" ) url.rewrite-once = ( "^(/media.*)$" => "$1", "^(/.*)$" => "/django.fcgi$1", ) However, when I'm redirecting user using reverse() (like, {% url login %}, user gets redirected to /django.fcgi/login/ instead of /login/. Anyone else having this issue? Any reasonable solution/workaround? Almad --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Multithreaded development server
On 28 Led, 15:20, Ned Batchelder wrote: > Almad, you've pointed to ticket 10117 a few times now, but I don't see > how this has anything to do with a single-threaded server. I think if > you could clarify that point, maybe we'd be able to make some progress > on this. True, I just got that feeling from 'multithreading fixed it for me', but I'll do some more tracing later. > The core devs are not going to change their mind about multi-threading > the development server, so please stop asking them to. OK. > The disagreement > on the table now is whether you have a common problem here, or an > esoteric one. When I look at the code in 10117, there doesn't seem to > be anything multi-threaded about it. That's good news for you, because > it may bring your problem into the category of "will be fixed" from > "won't be fixed". If you could help us understand your precise problem > more, and by that I mean give us more information about where you think > the multi-threading is coming from, or otherwise explain the connection > reset, then we could all get beyond the mud-slinging. OK, I'll investigate it deeper, because from http://code.djangoproject.com/ticket/10117#comment:4 , it looks like it might be a wsgi bug. What puzzles me is, that if I recall my debugging correctly, this bug was fixed for me even without using CP WSGI, just multithreading Django's one. > --Ned.http://nedbatchelder.com Almad --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Multithreaded development server
On 28 Led, 06:01, Malcolm Tredinnick wrote: > On Tue, 2009-01-27 at 06:21 -0800, Almad wrote: > > On Jan 26, 1:19 am, Russell Keith-Magee > > wrote: > Perhaps you could show some simplified example code? I have at least a > few dozen tests that do this and they don't have any problem. Serial > requests work fine with thedevelopmentserver. I know of plenty of > other people doing similar things. Let #10117 (http://code.djangoproject.com/ticket/10117) be impractical, but minimalist example. > Depends on your definition of "serious". Given the thousands of Django > applications that have, at least, started out using thedevelopment > server, your claim seems a little vacuous. True. I'm just under impression of my new Django job in company where Django is used heavily...and I see a lot of problems caused by lack of tests. And tests are lacking because of some problems with test creation in Django I'm trying to point on (in bad manner, right, but being a bit depressed by running into same issues as two years ago when I first tried to develop with Django). > [...] > You might well have some reduced outlook on the time commitment involved > there, which is fine, since you aren't one of the people on the hook for > things like that in Django. The group of core maintainers have decided > to devote time elsewhere. OK, I accept it, althrough I still disagree. BTW I discovered DjangoCerise project (http://xhtml.net/scripts/Django- CherryPy-server-DjangoCerise); main CP WSGI is 44k; wouldn't be worth trying to integrate it in django, as it's well-tested and reviewed enough? I'd do it, if there is any chance for having it in mainline. > > Well, after I fall into small group of users that do some automatized > > acceptance testing (and thus require, like, Selenium) and discovered > > that things looks like working after I lobotomized Django and replaced > > it with CherryPy, I'm now satisfied. > > When you could have just used mod_wsgi, or CherryPy's WSGI server or any > number of other things. Nice over-reaction there. Probably true. I'm just in the camp that test running should be zero- setup and as simple as possible, or dev's will not use them (and I see that around me every day). > Note, also, that there's a ticket open in Trac to add some extra bits > and pieces for allowing Selenium integration with Django's test > framework. That would also give you some idea of the direction things > could go. May I ask which one? For Selenium, I found #2867 (marked as wontfix) and for requirements #3357 denied by core dev and #2879 being practically dead > This was a very disappointing mail to read. Whilst I realise you might > well be frustrated, the tone is simply insulting to the amount of work > that has gone into developing and supporting Django That is true and I'm sorry for that as I certainly have not done so much good work as You and core devs. > and tries to inflate > whatever problem it is that you're having (which hasn't been explained > in detail) way out of proportion. It's true that I have not provided enough details in initial e-mail as I should have. I hope I have now better explained my problems and motivations and why I consider them crutial, coming from TDD environment. > Regards, > Malcolm Almad --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Multithreaded development server
On 28 Led, 01:25, Russell Keith-Magee wrote: > On Tue, Jan 27, 2009 at 11:21 PM, Almad wrote: > Sorry, but my stress-induced fibritis can only take so much. As a > hint, if you ever find yourself in a position where you need to > apologize at the end of an email for the tone you've taken, it's > probably a good indicator that you need to go back and edit for tone. That's certainly true and I'll try to do better next time. > As a further hint, using pejoratives in project naming - like, say, > "Sane Testing in Django" - isn't a good way to encourage others to > assist you. I don't consider "sane testing" to be pejorative, but I can change that. However, I'll be more glad if I can wipe the whole project by finding proper Django ways (or perhaps few Django patches) and do some integration. > I've explained the reasoning behind Django's decisions. I can only > assure you that I know many people that aren't affected by those > decisions, and are able to use Django's testing framework, as is, > without difficulty. Some of them are even able to use Selenium. I guess that then they are doing generic smoke tests, because they cannot use the xUnit infrastructure and setup database in pre-defined state? Or is there a simple way to do it, are there any hints around? > If you sit down and work through the problem, you will establish that > the consequences of those decisions aren't as widespread as you seem > to think. There is _exactly_ one limitation to Django'sdevelopment > server - _concurrent_ web requests. To be sure, this does impose > limitations, but as long as you don't need concurrent server requests, > you won't have any problems with a single-threaded server. Most web > pages can be adequately served by a number of _sequential_ web > requests. Either it's not entirely true, or I'm bad at reading sources and urllib2 do some concurrent requests without my knowledge. See #10117 (http://code.djangoproject.com/ticket/10117) for sample code. > I will also remind you that just because _you_ hit a given problem > every single day, doesn't mean that _everyone_ hits that problem every > single day. Such is the nature of esoteric problems. Looks like so. I have, however, > You will note that so far in this thread, you haven't actually > described your problem - just that amultithreadedserver is > apparently the only way to solve it. If you ever feel like describing > your problem (sans rhetoric) and working constructively towards a > solution, let me know. One of my biggest problems (that I, obviously mistakenly, considered widespread) is regression testing of digest-protected REST APIs. Test client is way around (plus it does not support digest, but as Django do not support it as well, I can't blame it), and I'd like to use some other software tools that cannot do whitebox, and urllib cannot be used due to bug #10117. I must say, however, that now with some integration things works for me and I'm not working on integration (as this relies on #2879 anyway, which was having patch shortly after creation, got ignored and now laying silently for two years as even mikeal got up for runtime patching). > Yours, > Russ Magee %-) Almad --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Multithreaded development server
On Jan 27, 3:21 pm, Almad wrote: > On Jan 26, 1:19 am, Russell Keith-Magee > wrote: > i guess PHP users are our target group. Sorry, that was too bitter, unneccessary, offensive and intended to be removed by my self-censoring filter. Almad --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Multithreaded development server
On Jan 26, 1:19 am, Russell Keith-Magee wrote: > On Sun, Jan 25, 2009 at 10:45 PM,Almad wrote: > > I still feel kinda weird that I must hack around Django so much to > > make basic testing things working :-]]] > > Let's be clear here - the "basic testing" thing that is failing here > is a very specific, and somewhat esoteric edge case - the case of a > view that invokes, via HTTP, another view on the same server. No, case we're talking about is a test that calls one view multiple times in a row - and that is enough to have a problem with dev server. Which I insist on calling basic testing when we're talking about web application. > The Django core team has (repeatedly) made a very deliberate decision > to keep the development server single threaded. There are many very > good web servers out there - Django isn't trying to get into the game > of competing with any of them. We view Django's job as providing a > good web stack for a real web server to use; the development server is > provided as a convenience, nothing more. Yes, through it's very useful for testing. > Having a singlethreaded server makes the implementation much simpler, > so we can concentrate our efforts on making a great web stack, rather > than wasting effort on writing, debugging, and maintaining a web > server that we don't really want people to use for serious work. OK, if it's not meant for serious development and testing work, I guess it's OK then. (I'd just say that opitional multithreading contained in 10-line long patch is not so complicated) > A multithreaded server would also act as a tacit encouragement to use > Django's development server for real deployments, which we _really_ > don't want to encourage. If people start using Django's development > server in production, we would have to start treating it as a > production-ready server - doing security and performance audits and > the like - and again, this distracts us from what we consider to be > the "main game". OK, if community is expected to ignore 'do not use this option for production or you'll be banned from all our communication channels on first complaint', I guess nothing can be done. i guess PHP users are our target group. > The _only_ type of view that is affected by this decision is the view > that uses urllib (or equivalent) to invoke another view on the same > server. Yes, that's the only type of view affected. And some tests... > We (the Django core team) have decided that this is a > compromise we can live with. The set of cases where this behavior is > required is very small, doesn't form a part of the requirements for > most (almost all) web development projects. For that small subset of > users that _do_ have a legitimate use for this, there are some > lightweight multithreaded options (like CherryPy) out there, and to > the best of my knowledge, none of these options _require_ the patching > of core in order to use them. Well, after I fall into small group of users that do some automatized acceptance testing (and thus require, like, Selenium) and discovered that things looks like working after I lobotomized Django and replaced it with CherryPy, I'm now satisfied. > Yours, > Russ Magee %-) Almad P.S.: Sorry for the sarcastic tone of my e-mail. I appreciate Your work as well as Django framework (or at least some parts of it), but I just don't get it: for each and every project I've written in Django, I banged my head against the wall because of some issues that prevented me from normal testing - and were rejected by devs because of 'esoteric edge case'...and then reading 'Testing Django apps' on first presentation slide, 'because it's most important'. --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Multithreaded development server
On Jan 26, 6:21 pm, birkin wrote: > On Jan 24, 7:08 pm,Almad wrote: > > A very simple solution in > this edge-case of mine is to simply start up an additional terminal > window and execute the runserver command again Don't You have a race condition where both servers are trying to bind? But thanks for the tip, would be useful...through it's not exactly nice for automated suite. > -Birkin Almad --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Multithreaded development server
For those interested, patch from #3357 works nicely and can be started from within: http://devel.almad.net/trac/django-sane-testing/changeset/d2c24247d7e4 However, it's still buggy for my case. If You want it too, You can use CP WSGI as suggested by mikeal some time ago, I'm now using it too: http://devel.almad.net/trac/django-sane-testing/changeset/00d317877c55 I still feel kinda weird that I must hack around Django so much to make basic testing things working :-]]] Almad --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Multithreaded development server
Thanks for the responses. My probem is that single-threaded server makes django untestable even under simple conditions (like, using urllib2 with digest authentication). I'd love to use CherryPy as I'm using it for some applications anyway, but I'm now trying to develop library that would allow us to test Django normally and CP dependency is a bit weird... Same goes for real server usage, as manage.py test should run without too much environment configuration. The patch is cool. I'll try to do some runtime patching...and I'll probably fork it on github to ease maintainance. Thanks, Almad --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Multithreaded development server
Hello, is there a way to run development server multithreaded, so it can handle recurring requests? Thanks, Almad --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Port large webapp from PHP to Django: tips, experiences, links needed
Well, I'd like to write some docs first, but hey ,) I'm developing something on top of nose, to express my feelings, I call it django-sane-testing. Grab nose 0.10 and sane testing from http://devel.almad.net/trac/django-sane-testing/wiki/Releases and enjoy usual nose features (test selection, profiling plugin et al) together with: * support for unit tests (yeah, no database handling when not needed - subclass from UnitTestCase) * selenium integration (subclass SeleniumTestCase and enjoy self.selenium) * live server (yup, you can use urllib2 now) * and hey, even TEST_RUNNER='djangosanetesting.testrunner.run_tests' works Well, docs and setuptools thinigies is what's left ;) Almad On Jan 22, 11:32 am, Malcolm Tredinnick wrote: > It's a little disappointing that there aren't a lot more people blogging > about using their test library of choice with Django. It's certainly > possible and would perhaps fill a gap in the accumulated knowledge-base. > Specifics of things that you (webchemist) find hard to emulate with your > favourite framework would obviously be useful to know about, probably in > a separate thread, but I think testing is an area where Django adopts a > nice unobtrusive behaviour and doesn't require any particular framework > for tests. > > Regards, > Malcolm --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Organising django projects
> Has this been discussed before? What are the dev's feelings on this? I'd like to hear them too. > -justin Almad --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Organising django projects
Hi, I'd like to ask how to organize Django application. To me, structure of project/app is nice idea, however I have problems applying it in practice, so I'd like to ask about best practices. Problems come, when application structure become deeper and nested. Is it usual to start an application inside application? Django-admin disagree with it. How is it with dependencies? When part of application depends on another, should it be subapplication, or normal top-level application depending on another one? Plus, when django philosophy is to have "application packages", why are templates separated into another directory structure? I'm more familiar (from my personal cherrypy structure) with lib/apps for model, tpl/apps and web/apps separation for M/V/C, but django seem to mixing it together. What are reasons for this and what are best practices for structuring bigger/complicated apps? --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Integrating Selenium web tests with django test suite
On Jun 4, 4:15 am, "Russell Keith-Magee" <[EMAIL PROTECTED]> wrote: > On 6/2/07,Almad<[EMAIL PROTECTED]> wrote: > I haven't played with Selenium integration extensively; however, the > broad use case (tests against a live server) is one that I am > interested in supporting. > #2879 contains a patch that is intended to make selenium-type tests > easier. Any comments or feedback on that patch, or any other > suggestions, are welcome. I'll give it a shot and provide feedback soon. > Yours, > Russ Magee %-) Almad --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Integrating Selenium web tests with django test suite
Hi, I'd like to ask how do you integrate your webtests with django suite, so it'll be run on manage.py test. I've looked for resources support for unittest framework, but I have not found any way how to skip test gracefully (I guess it's patched for python 2.6), but for now I'd then prefer starting selenium server manually from python by creating SeleniumTestCase. However, I have problems to determine when is selenium server really started and self.p = Popen(['java', '-jar', config.get('selenium', 'path'), '-port', str(config.get('selenium', 'port'))], \ stdout=PIPE, stdin=PIPE, stderr=PIPE) # wait until server start #FIXME find a way to resolve that server is started sleep(2) is just ugly. How do You integrate Your tests with Selenium? Thank You, Almad --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Unicode-branch: testers wanted
On May 30, 3:09 am, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > Everything is ready (you can see all the pieces that were ported over in > the "TODO" list on the UnicdeBranch wiki page). Syndication has > definitely been tested with non-ASCII content, so it should also work. > Any failures are bugs (either in Django or your code). > > Please open a ticket in Trac with a (simple) example of what is going > wrong. I played with it a bit and discovered that unicode description won't work for me. Filled as #4430 > Regards, > Malcolm Regards (and Thank You for branch), Almad --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Best practice: How to test site using openid-only login
On May 29, 6:46 pm, "Joseph Heck" <[EMAIL PROTECTED]> wrote: > You might take a look at twill (http://twill.idyll.org/) - Although I > find it a tad trickier to get rolling with than Selenium, it has the > functionality that you want (emulating a browser, including cookies) > and can be 'programmed' to walk to an OpenID login site and back again > following redirects. You can think of it as a more complex/complete > version of the test client in Django. I knew, but also django client is much faster :-) > -joe And, sorry for disturbing, I thought that client really fills form & co. However, I just passed openid_url instead of identity_url to login() function and thus login failed. I can just use login() to pass it to my openid backend and then I'm logged in without need to go through openid verification process. Almad --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Best practice: How to test site using openid-only login
Hi, I'd like to ask about best testing practice. I'm looking at test client in SVN, which looks great for most of cases and I can get rid of Selenium (great tool, but slow). TestClient looks promising, but I don't knew how to authorize(), when site is only using OpenID login. Any suggestions? (I'd like to use as less workaround/hacks as possible) Thanks, Almad --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Unicode-branch: testers wanted
Hi, I'm trying to migrate to unicode branch, but Syndication framework won't work for me (usual UnicodeDecodeError). I made sure that all strings are u'' ones. Is this middleware ready for unicode? Thank You, Almad --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Problem with string slicing in templates on non-ascii characters
Unicode branch really solved my problem. Thank You very much. Almad On May 27, 2:36 am, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Sat, 2007-05-26 at 15:25 -0700,Almadwrote: > > Hello, > > > when displaying list of my arcitles, I'm displaying first char of my > > article as heading with {{ page.name.0 }} > > > However, for non-ascii characters, this char is crippled - see > >http://rpgpedia.cz/nastroje/wiki/seznam-clanku/(bottom of the page). > > You are (correctly :-( ) being served the first byte from a string of > bytes. It just happens to be half of a UTF-8 (or whetever encoding you > are using) sequence of bytes, but Python has absolutely of knowing that. > > > Where should the problem be? Should this be considered as django bug? > > Bytestrings are not particularly useful in cases like this, where you > want to split and join and do other string operations, so it's not > really a bug. > > As Jeremy mentioned, you'll probably get more joy out of the unicode > branch, since it's much easier (and recommended) to use unicode strings > everywhere there, so you don't have to worry about encoding issues. > Slicing a unicode string as "some_unicode_string[0]" will always give > you the first character, as a unicode character -- so you don't have to > worry about how many bytes it takes up when encoded, because it's not > encoded at that point. > > Regards, > Malcolm --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Problem with string slicing in templates on non-ascii characters
Hello, when displaying list of my arcitles, I'm displaying first char of my article as heading with {{ page.name.0 }} However, for non-ascii characters, this char is crippled - see http://rpgpedia.cz/nastroje/wiki/seznam-clanku/ (bottom of the page). Where should the problem be? Should this be considered as django bug? Thank You, Almad --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Problems with session middleware
Hello, please...nobody have a clue? I've run into same issue again and it's somehow making django usuable for me :-( (and yes, still with the freshest trunk) Thank You, Almad On Jan 28, 4:30 pm, "Almad" wrote: > Hello, > > I'd like to ask about session/auth middleware I'm trying to use. --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Problems with session middleware
Hello, I'd like to ask about session/auth middleware I'm trying to use. I have this view, which tries to act as openid consumer: def prihlas(request): # FIXME: better tmp dir oidconsumer = consumer.Consumer(request.session, FileOpenIDStore('/ tmp/openid')) try: req = oidconsumer.begin(request.POST['openid_url']) except HTTPFetchingError, exc: raise except DiscoveryFailure, exc: raise else: if request is None: raise Exception # everything OK, redirect to OpenID server #TODO: Set processing status redirect_url = req.redirectURL(settings.URL_ROOT, urljoin(settings.URL_ROOT, '/nastroje/autorizace/over/')) return HttpResponseRedirect(redirect_url) However, when middleware tries to save changed cookie, I got Traceback (most recent call last): File "/usr/lib/python2.4/site-packages/django/core/servers/ basehttp.py", line 272, in run self.result = application(self.environ, self.start_response) File "/usr/lib/python2.4/site-packages/django/core/servers/ basehttp.py", line 614, in __call__ return self.application(environ, start_response) File "/usr/lib/python2.4/site-packages/django/core/handlers/ wsgi.py", line 193, in __call__ response = middleware_method(request, response) File "/usr/lib/python2.4/site-packages/django/middleware/common.py", line 59, in process_response if response.status_code == 404: AttributeError: 'str' object has no attribute 'status_code' When middleware classes are like: MIDDLEWARE_CLASSES = ( 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', ) Or this error: Traceback (most recent call last): File "/usr/lib/python2.4/site-packages/django/core/servers/ basehttp.py", line 272, in run self.result = application(self.environ, self.start_response) File "/usr/lib/python2.4/site-packages/django/core/servers/ basehttp.py", line 614, in __call__ return self.application(environ, start_response) File "/usr/lib/python2.4/site-packages/django/core/handlers/ wsgi.py", line 193, in __call__ response = middleware_method(request, response) File "/usr/lib/python2.4/site-packages/django/middleware/common.py", line 59, in process_response if response.status_code == 404: AttributeError: 'str' object has no attribute 'status_code' where middleware's order is MIDDLEWARE_CLASSES = ( 'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.middleware.common.CommonMiddleware', ) or MIDDLEWARE_CLASSES = ( 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', ) I'm using svn trunk, issue same with old revisions as well as HEAD. What am I doing wrong? :] Thank You, Almad --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---