Re: slow response when using manage runserver without Internet connection
Hi, I'm not sure I have a solution, but are you sure it is the built in server that is slow? Maybe you have some kind of a browser extension trying to access the Internet. Maybe you should try it using a different browser and see if there is any difference. Also, what address are you using to access the site? Mine, for example, is usually http://127.0.0.1:8001/ P.S: this questions might be more appropriate in the django-users group. --Ahmad On 8/22/06, DD <[EMAIL PROTECTED]> wrote: > > Hi, > > I am using the Django built-in web server. The server's reponse time is > nomal when connecting to Internet, once it's offline, the speed is > extremely slow. Does anyone have experience how to fix it? > > Thanks, > > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@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-developers -~--~~~~--~~--~--~---
Re: New Manipulators and Validation Aware models.
Brantley Harris wrote: > > Here is a sample view using a default CreateManipulator: > def create_poll(request): > try: > m = Poll.CreateManipulator() > poll = m.process(request) > return HttpResponseRedirect('/poll/%d/' % poll.id) > except Form, form: > return render_to_response('poll/create.html', {'form': form}) Raising the form as an exception is an interesting alternative to the normal "if posted and everything validates, redirect, else render form" approach. I've also embarked on a quest to improve the situation with manipulators, although I've taken a much more radical approach. I intend to do a full writeup in a couple of days when I've filled a few holes in the code, but here's a quick summary of the path I've taken: I first wanted a way to easily create forms that were minor variations on other forms; in particular, to be able to replace one or two widgets (I've named the form field classes *Widgets to avoid confusion with the database *Field classes) from the default form for a model class with other widgets. So I created a Form class, that is subclassed to allow a declarative-style form specification. Form subclasses can further be subclassed to change or add widgets. The second need I had was to allow forms to easily manipulate data that wasn't in models. So the data from Form instances is first saved into a structure of dicts and lists (a single dict for a form with no nested subforms). The widget-level validation (e.g. ensuring that the user has entered the same password in both text input elements) happens on this data. Of course, forms that directly manipulate models are important too: so a model instance can be updated from this data. The important feature with all this is that forms can have nested subforms and lists of subforms that are the equivalent of edit_inline, and updating the model instance correctly handles foreign keys and many to many relationships. Of course, all the above uses model validation as well. The third need I had was to be able to customise the appearance and/or client-side behaviour of all input elements in a site; so all Widgets use template-based rendering. In an individual project, I can then create new template files that will be used instead of the default templates. One final part of all this was the removal of the AddManipulator/ChangeManipulator dichotomy -- the two are functionally equivalent, with the only difference being that the form data is populated from and saved into a newly created model instance vs. one retrieved from the database. Because these changes involve removing or rewriting significant portions of django.forms, and thoroughly break compatibility with the existing manipulators, I'll be releasing it as a separate module rather than a patch to django. Andrew --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@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-developers -~--~~~~--~~--~--~---
Django.contrib applications modifying Django to work properly?
Hi! The current django.contrib.auth doesn't really do what I need it to do, the per-objects-permission branch does adds some of the things I need, but still not all. So as I am new to Django and it was advertised, that one can move their applications from one project to the other without any fuss, I figured that I'd just copy that per-objects-permissions branch django.contrib.auth to my own project and modify it a bit more to suit my needs. I figured, I should first examine what the branch was doing diferently than the trunk. And then I stumbled upon this: http://code.djangoproject.com/wiki/RowLevelPermissionsDeveloper#HowRowPermissionsAreEnabled First things going through my mind were: Why is the branch owner doing this here? Shouldn't it be in django.contrib.auth? Then I looked around a bit more and saw that the trunk django.contrib.auth also had some of it's code in that same file. Also django.contrib.admin was doing the same thing. Is it how it was intended to be used? That every application that needs abit of magic to work should modify the main Django source? Or there just isn't a better way to do it? Or maybe there is, but it isn't being used? Thanks, Mart --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@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-developers -~--~~~~--~~--~--~---
Re: Thoughts on extensibility of the admin app
El vie, 11-08-2006 a las 19:00 +, [EMAIL PROTECTED] escribió: > [...] > [...] The UI elements in the admin > would be a great start towards a universally useful UI toolkit for > django, they just need to be opened up a bit, provide hooks and > callbacks and abstraction so that they can be reused in different > contexts. In my opinion this is very important... I have developing in Plone for three years (ok it's a CMS... not a web framework) and I love idea of reuse and modify good designed CSS, as Plone ones. In Django, several times I spent two or three hours in copy-pasting django CSS for public site, because: a) I was developing a Intranet site, and I was interested in listing, searching, portlets, etc. CSS styles in django (that I modified later) b) My public site was closer in appaerance than admin site Always, my steps are the same: 1) copy base.html 2) change admin_prefix to a custom prefix 3) statify CSS and JS rendering 4) other changes on: breadcrumbs, tools, options, etc. 5) in last, I change the look-and-feel in CSS This steps I repeated in several projects... no DRY --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@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-developers -~--~~~~--~~--~--~---
Abstract classes support in models
I am developing a web with django, and in my model I need to superclass all model classes with a superclass that add some methods. The problem is django-admin.py create a dummy table not needed for this superclass. I know that multiple-inheritance can be useful here, but I can consider some times that multiple-inheritance doesn't works (for example, I wanted to change __metaclass__ of several classes in my model). I patched django for permit abstract classes in a model. My syntax maybe doesn't like to someone... Here are a model example of use: class FooSuperclass(models.Model): __abstract__ = True def oneFunction(self, x, y): ... class FooClass(FooSuperclass): age = models.IntegerField() -- Manuel Saelices [EMAIL PROTECTED] ICS Yaco S.L. http://www.yaco.es/ Tlfno. +34 954 50 00 57 Fax+34 954 50 09 29 C/ Sierpes, 48 Sevilla --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@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-developers -~--~~~~--~~--~--~--- Index: django/db/models/base.py === --- django/db/models/base.py (revisión: 3641) +++ django/db/models/base.py (copia de trabajo) @@ -23,6 +23,9 @@ # If this isn't a subclass of Model, don't do anything special. if not bases or bases == (object,): return type.__new__(cls, name, bases, attrs) +# If __abstract__ attribute declared, don't do anything more +if '__abstract__' in attrs: +return type.__new__(cls, name, bases, attrs) # Create the class. new_class = type.__new__(cls, name, bases, {'__module__': attrs.pop('__module__')})
Re: Django.contrib applications modifying Django to work properly?
Hi Mart, I'm the per-obect-perm developher. Depends on what magic you are looking for it to do. The row_level_permissions option in the meta class does two things that can be rewritten in a way that doesn't need to involve the db.options (meta class). The first thing the option does is create a generic relationship between the object and row level permisisons, it could have been done manually for each object by using the relation: row_level_permissions = models.GenericRelation(RowLevelPermission, object_id_field="model_id", content_model_field="model_ct") The second thing the option does is check if row level permissions are enabled and does various things with that info. I could have handeled this by checking if the relationship row_level_permissions exists on the object. Hopefully that answers some of your questions. What exactly are you looking to do? I might be able to help, or give some suggestions. As an aside, there have been a few ideas floating around for an application repository and packaging method. For that, I think it would be great if there was a way to have a method of extending the options(meta) model to include some custom options for an application. But that is something for the future. Chris --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@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-developers -~--~~~~--~~--~--~---
Re: Django.contrib applications modifying Django to work properly?
Hi Chris, I was just wondering why wasn't there any helper methods to achieve exactly the same result as you can by editing the Django source (in your case the django.db), but without editing anything out of your application's directory. That way even the code repository wouldn't have invent some way to install the application/add-on, just download the application directory, add it to the project and setup some settings, no mangling with Django's source. (The previous might be exactly what you said in your message's last paragraph.) Mart --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@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-developers -~--~~~~--~~--~--~---
Re: Abstract classes support in models
On 8/22/06, Manuel Saelices <[EMAIL PROTECTED]> wrote: > I patched django for permit abstract classes in a model. My syntax maybe > doesn't like to someone... The new and improved model inheritance that Malcolm is working on will also provide a facility for abstract "base" classes, so I'm thinking this would probably be redundant; there's also been discussion on this list of how the syntax should work, and IIRC the consensus was for a new base class, so that for your abstract class you'd do class MyAbstractModel(models.AbstractModel) -- "May the forces of evil become confused on the way to your house." -- George Carlin --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@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-developers -~--~~~~--~~--~--~---
BigIntegerField
I'd like an integer field larger than postgresql's integer (2^31). Any interest in a patch for BigIntegerField? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@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-developers -~--~~~~--~~--~--~---
Re: The Python Web Framework
I agree with basically everything in that post. Models are too tightly tied to their admin representation. It is too hard to use another ORM with django's contrib apps, and fairly pointless to use one if you can't do that. The admin app itself could benefit greatly from another rewrite, to simplify and open it up. The template language is fantastic for designers and less so for programmers. Enforcing the loading of settings at import time is ... not a choice I would have made, let's just say. But most if not all of those problems are fixable. Django is just at the beginning of its life as an open source project. It's good enough for serious, professional work now and it's getting better all the time. I think it's going to keep getting better as it attracts more users with more good ideas -- so long as the core developers' bandwidth holds up. :) JP --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@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-developers -~--~~~~--~~--~--~---
Re: BigIntegerField
On 8/22/06, Jeremy Dunck <[EMAIL PROTECTED]> wrote: > > I'd like an integer field larger than postgresql's integer (2^31). > > Any interest in a patch for BigIntegerField? Matt Croydon submitted a patch a while ago: http://code.djangoproject.com/ticket/399 It might need a bump. Felix --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@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-developers -~--~~~~--~~--~--~---
Re: The Python Web Framework
On 8/22/06, JP <[EMAIL PROTECTED]> wrote: > I agree with basically everything in that post. Models are too tightly > tied to their admin representation. It is too hard to use another ORM > with django's contrib apps, and fairly pointless to use one if you > can't do that. The admin app itself could benefit greatly from another > rewrite, to simplify and open it up. The template language is fantastic > for designers and less so for programmers. Enforcing the loading of > settings at import time is ... not a choice I would have made, let's > just say. Yeah, I agree with many (but not all) things in that post, as well. Let's get to work! Anybody have ideas on how to change the settings framework not to be required at load time? Adrian -- Adrian Holovaty holovaty.com | djangoproject.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@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-developers -~--~~~~--~~--~--~---
Re: [Fw]The Python Web Framework
On 8/21/06, limodou <[EMAIL PROTECTED]> wrote: > Some points I think are reasonable, for example: django configuration Text really sucks as a medium for certain kinds of things, so keep in mind that the fact that it's in email will probably result in this response sounding much harsher than it was meant to be. Anyway, here goes: I, for one, would appreciate some more specific criticism. For example, just saying that the Django ORM is "a far cry from what SQLAlchemy provides" is basically worthless as far as constructive criticism; what we need is examples of "here's something that you can do with SQLAlchemy that you can't do with the Django ORM, and here are some ideas for how to improve the Django ORM to do this". As a whole, this article seems to run into that problem over and over. Some things that occur to me on other points: * Admin, auth and comments using Django's own ORM, template system, etc.: well... what are we supposed to use? They're Django applications, and they leverage as much or as little of Django as they need to accomplish their goals. Also, it is possible to use another ORM with Django and still use the admin app. * Database connection pooling: not sure what's up with this. The multi-db branch looks fairly stable, but that's not what comes to mind when I think "database connection pooling", and what comes to mind when I think "database connection pooling" isn't something I think belongs in Django. * Requiring DJANGO_SETTINGS_MODULE: I thought we fixed that so that you could do most non-app things without having to provide a full settings file[1]. Or did I misunderstand that? * Escaping in templates: Christopher presents an *extremely* one-sided view of what's actually a fairly complex debate. There is no single obvious solution to escaping. * The template system in general: the template system "doesn't scale down to a single developer"? I'm going to have to call BS on that, because we've seen plenty of one-man projects. The template tag decorators also make it a whole lot easier to write common sorts of tags. * The template system being "dumbed down" for designers? Going to call BS on that too. The real complaint here seems to be that the template system doesn't include a programming language, and personally I don't think it should. If there are things that someone runs into that they find themselves needing to use the same custom template tag over and over again in many different projects, then that needs to be submitted for possible inclusion in the default tags. [1] http://code.djangoproject.com/changeset/2927 -- "May the forces of evil become confused on the way to your house." -- George Carlin --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@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-developers -~--~~~~--~~--~--~---
Re: The Python Web Framework
> Anybody have ideas on how to change the settings framework not to be > required at load time? I'm not sure how acceptable this would be, but what springs to mind immediately is refactoring LazySettings and Settings to push all of the settings-loading logic into the Settings used, and using a Settings subclass by default that is happy to just use whatever the default settings are, and only raises an exception if you try to access a setting that's not in the defaults. Then in environments (like the various http handlers) that want to enforce the settings module being defined or configure() being executed, we can install a Settings instance in settings._target that behaves appropriately for those environments (eg, is thread-local and resets on request start in WSGI environments, for Paste friendliness). JP --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@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-developers -~--~~~~--~~--~--~---
Re: [Fw]The Python Web Framework
On 8/22/06, James Bennett <[EMAIL PROTECTED]> wrote: > I, for one, would appreciate some more specific criticism. For > example, just saying that the Django ORM is "a far cry from what > SQLAlchemy provides" is basically worthless as far as constructive > criticism; what we need is examples of "here's something that you can > do with SQLAlchemy that you can't do with the Django ORM, and here are > some ideas for how to improve the Django ORM to do this". I can give you a laundry list of what SQLAlchemy provides and the Django ORM does not, but I can't tell you how to fix Django ORM. I'm not sure of the full capabilities of the Django ORM, as I'm only a part-time djangoist so I may get a point or two wrong but I think most of these are accurate. I encourage you to look at the sqlalchemy docs to get a full understanding of SA's capabilities. Before I start, I will say that the Django ORM works very well for building content-driven sites from scratch. I have no issues with it for this sort of development, it's only when developing on existing databases and when doing complex models that its limitations (and those of SqlObject as well) come into play. SA provides: * connection pooling - since you asked about it, I'll quote from the SA docs: At the base of any database helper library is a system of efficiently acquiring connections to the database. Since the establishment of a database connection is typically a somewhat expensive operation, an application needs a way to get at database connections repeatedly without incurring the full overhead each time. Particularly for server-side web applications, a connection pool is the standard way to maintain a "pool" of database connections which are used over and over again among many requests. Connection pools typically are configured to maintain a certain "size", which represents how many connections can be used simultaneously without resorting to creating more newly-established connections. * The ability to access the db without mapping the results and without having to bypass the framework completely. This is for when performance is an issue, I've only needed it once. * The ability to mix python expressions and hand-written sql within a single query and still have the result be mappable. Again, I've only used it once. * More efficient queries by combining multiple queries into a single query when possible through the unit of work concept * Composite primary keys - the big one for me, so many databases I run across use composite keys and I don't control the schema. * More flexible mapping including: - Mapping multiple objects to a table - Mapping multiple tables to an object - Mapping the results of an arbitrary query - Selectively overriding join conditions (including both to and from an intermediate table) * Ability to specify whether mapped attributes are loaded eagerly or lazily There's probably other stuff, but that's just what I've run into. Hopefully this information provides a more concrete justification of why I feel SA is superior when it comes to solving more complicated ORM issues. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@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-developers -~--~~~~--~~--~--~---
Re: Django.contrib applications modifying Django to work properly?
On 8/22/06, Mart <[EMAIL PROTECTED]> wrote: > > Hi Chris, > > I was just wondering why wasn't there any helper methods to achieve > exactly the same result as you can by editing the Django source (in > your case the django.db), but without editing anything out of your > application's directory. > That way even the code repository wouldn't have invent some way to > install the application/add-on, just download the application > directory, add it to the project and setup some settings, no mangling > with Django's source. > > (The previous might be exactly what you said in your message's last > paragraph.) > > Mart Do you mean by your question why is this row level permissions feature not available in the main Django distribution? If I understand you correctly, and that was your question, then the answer is that it is very experimental and under heavy development. So it is being isolated for the time being. Once it is a bit more mature, it will be merged with the main Django distribution, and you will not have to download it seperatly. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@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-developers -~--~~~~--~~--~--~---
Re: [Fw]The Python Web Framework
Am 22.08.2006 um 18:22 schrieb James Bennett: > Some things that occur to me on other points: > > * Admin, auth and comments using Django's own ORM, template system, > etc.: well... what are we supposed to use? They're Django > applications, and they leverage as much or as little of Django as they > need to accomplish their goals. Also, it is possible to use another > ORM with Django and still use the admin app. You're taking the original statement out of context. The context was the often-heard argument that Django lets you replace any subsystem if you prefer using a different library. What's less often-heard is that if you do so, you are giving up a lot of the niceties that Django provides (such as the admin if you use a different ORM) > * Database connection pooling: not sure what's up with this. The > multi-db branch looks fairly stable, but that's not what comes to mind > when I think "database connection pooling", and what comes to mind > when I think "database connection pooling" isn't something I think > belongs in Django. Karl Guertin answered this one nicely I think. If you're providing a database access layer on top of the raw DB API, you should probably also provide connection pooling. I bet there's a ticket for that. > * Requiring DJANGO_SETTINGS_MODULE: I thought we fixed that so that > you could do most non-app things without having to provide a full > settings file[1]. Or did I misunderstand that? That change improved the situation, but you still need the "from django.conf import settings; settings.configure(...)" before using any other part of Django. That works, but still doesn't feel clean. > * Escaping in templates: Christopher presents an *extremely* one-sided > view of what's actually a fairly complex debate. There is no single > obvious solution to escaping. Possibly. What concerns me is that many in the Django team seemed to think escaping is the responsibility of the template author, yet the template author shouldn't be bothered with having to care about programming logic. I've yet to meet a designer who understands XSS attacks, but "x < y" they get. Maybe it's just me. What probably wasn't clear enough the post: I think the *benefits* of a solid auto-escaping approach are obvious, not necessarily how that's done. > * The template system in general: the template system "doesn't scale > down to a single developer"? I'm going to have to call BS on that, > because we've seen plenty of one-man projects. The template tag > decorators also make it a whole lot easier to write common sorts of > tags. I'm sorry, but if you have to scurry around multiple files just to implement and use a parameterized reusable snippet of HTML markup, that's > * The template system being "dumbed down" for designers? Going to call > BS on that too. The real complaint here seems to be that the template > system doesn't include a programming language, and personally I don't > think it should. If there are things that someone runs into that they > find themselves needing to use the same custom template tag over and > over again in many different projects, then that needs to be submitted > for possible inclusion in the default tags. > > [1] http://code.djangoproject.com/changeset/2927 > > -- > "May the forces of evil become confused on the way to your house." > -- George Carlin > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@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-developers -~--~~~~--~~--~--~---
Re: Re: [Fw]The Python Web Framework
On 8/22/06, Karl Guertin <[EMAIL PROTECTED]> wrote: > SA provides: > * connection pooling - since you asked about it, I'll quote from the SA docs: This is why I said "what comes to mind when I think 'database connection pooling' isn't something I think belongs in Django." Maintaining in-process connection pools in the framework doesn't, in my experience, provide enough benefit to justify the hassle. I'd rather talk to something like pg_pool which maintains an external connection pool. I'm not sure what others think on this topic, but my general feeling (which I think I've brought up a couple times on-list) is that the framework layer shouldn't be worrying about things like database connection pooling or load balancing. I know that the "enterprise" Java frameworks sell that stuff as a buzzword, but I've never understood that; it just bloats your stack and increases the coupling of its various bits. The ideal situation with Django, IMHO, is to drop load balancing in front of it (say, via perlbal) and connection pooling behind (pg_pool or whatever's appropriate), and not make the framework worry about it -- the less it has to know about the specifics of your load balancing or connection pooling setup, the better off you'll be and the easier it'll be to scale your installation. > * The ability to access the db without mapping the results and without > having to bypass the framework completely. This is for when > performance is an issue, I've only needed it once. Unless I'm misunderstanding, the 'values' method on a QuerySet (which used to be 'get_values' in Django 0.91 and older) handles this fairly cleanly; it just spits you back a list of dictionaries (optionally containing only the attributes you've specifically asked for) and doesn't try to map returned rows into objects. > * The ability to mix python expressions and hand-written sql within a > single query and still have the result be mappable. Again, I've only > used it once. Again, unless I'm misunderstanding, Django's ORM gives you this; you can drop extra "hand-rolled" SQL onto any query by using the 'extra' method. > * More efficient queries by combining multiple queries into a single > query when possible through the unit of work concept QuerySets evaluate lazily; adding filter conditions and methods just slowly builds up the eventual query until you actually do something which causes it to execute. > * Composite primary keys - the big one for me, so many databases I run > across use composite keys and I don't control the schema. Fair point. Every once in a while someone volunteers to work on this, but I don't recall whether it's actually gone anywhere. > * More flexible mapping including: > - Mapping multiple objects to a table > - Mapping multiple tables to an object > - Mapping the results of an arbitrary query > - Selectively overriding join conditions (including both to and from > an intermediate table) Could you give some examples of these? Some of it I think is doable with Django, but I'd need to sit down and think about it a bit. > * Ability to specify whether mapped attributes are loaded eagerly or lazily The 'select_related' method gives you control over whether attributes which map to rows in other tables are loaded lazily (the default) or eagerly (only when you use select_related). Outside of that situation -- because you'd want control over when queries that do joins are going to be executed -- I can't see any obvious use cases, which is (I assume) why there aren't any additional methods for controlling this. -- "May the forces of evil become confused on the way to your house." -- George Carlin --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@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-developers -~--~~~~--~~--~--~---
Re: [Fw]The Python Web Framework
Am 22.08.2006 um 18:22 schrieb James Bennett: > Some things that occur to me on other points: > > * Admin, auth and comments using Django's own ORM, template system, > etc.: well... what are we supposed to use? They're Django > applications, and they leverage as much or as little of Django as they > need to accomplish their goals. Also, it is possible to use another > ORM with Django and still use the admin app. You're taking the original statement out of context. The context was the often-heard argument that Django lets you replace any subsystem if you prefer using a different library. What's less often-heard is that if you do so, you are giving up a lot of the niceties that Django provides (such as the admin if you use a different ORM) > * Database connection pooling: not sure what's up with this. The > multi-db branch looks fairly stable, but that's not what comes to mind > when I think "database connection pooling", and what comes to mind > when I think "database connection pooling" isn't something I think > belongs in Django. Karl Guertin answered this one nicely I think. If you're providing a database access layer on top of the raw DB API, you should probably also provide connection pooling. I bet there's a ticket for that. > * Requiring DJANGO_SETTINGS_MODULE: I thought we fixed that so that > you could do most non-app things without having to provide a full > settings file[1]. Or did I misunderstand that? That change improved the situation, but you still need the "from django.conf import settings; settings.configure(...)" before *importing* any other part of Django. That improves the situation, but doesn't feel clean. > * Escaping in templates: Christopher presents an *extremely* one-sided > view of what's actually a fairly complex debate. There is no single > obvious solution to escaping. Possibly. What concerns me is that many in the Django team seemed to think escaping is the responsibility of the template author, yet the template author shouldn't be bothered with having to care about programming logic. I've yet to meet a designer who understands XSS attacks, but "x < y" they get. Maybe it's just me. What probably wasn't clear enough in the post: I think the *benefits* of a solid auto-escaping approach are obvious, not necessarily how that's done. > * The template system in general: the template system "doesn't scale > down to a single developer"? I'm going to have to call BS on that, > because we've seen plenty of one-man projects. The template tag > decorators also make it a whole lot easier to write common sorts of > tags. I'm sorry, but if you have to scurry around multiple files just to implement and use a parameterized reusable snippet of HTML markup, because the template system doesn't trust you can use functions and parameters, that's additional work you need to do. More code and coupling between code and the templates. If the template system simply allowed you to call functions, you could reuse presentation logic that way, without having to register tags. And you don't need to learn a whole new syntax for every template tag. > * The template system being "dumbed down" for designers? Going to call > BS on that too. The real complaint here seems to be that the template > system doesn't include a programming language, and personally I don't > think it should. If there are things that someone runs into that they > find themselves needing to use the same custom template tag over and > over again in many different projects, then that needs to be submitted > for possible inclusion in the default tags. Allowing the full expressiveness of a programming language (with control structure and all) is quite different from allowing real expressions. Django intentionally does allow the embedding of Python expressions, because the devs think/thought that designers would have problem with the syntax, so for me calling it "intentionally dumbed down" is not all that unfair. I'm not saying that a dumbed down template system is a bad thing... for example, for systems like TypePad etc where (untrusted) users edit templates over the web, what you can do in templates absolutely needs to be restricted, unless you want to allow them to take down the system. My point was that for teams that work on a web-app, where there's no real distinction between programmers and template authors, this actually does not help productivity. Cheers, Chris -- Christopher Lenz cmlenz at gmx.de http://www.cmlenz.net/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@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-developers -~--~~~~--~~--~--~---
Re: [Fw]The Python Web Framework
Am 22.08.2006 um 21:49 schrieb Christopher Lenz: > Am 22.08.2006 um 18:22 schrieb James Bennett: >> Some things that occur to me on other points: >> >> * Admin, auth and comments using Django's own ORM, template system, >> etc.: well... what are we supposed to use? They're Django >> applications, and they leverage as much or as little of Django as >> they >> need to accomplish their goals. Also, it is possible to use another >> ORM with Django and still use the admin app. > > You're taking the original statement out of context. The context was > the often-heard argument that Django lets you replace any subsystem > if you prefer using a different library. What's less often-heard is > that if you do so, you are giving up a lot of the niceties that > Django provides (such as the admin if you use a different ORM) [snip] Sorry, this reply got sent before it was ready :-P For some reason I keep hitting "Send" when I mean "Lookup in Dictionary" :-P Cheers, Chris -- Christopher Lenz cmlenz at gmx.de http://www.cmlenz.net/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@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-developers -~--~~~~--~~--~--~---
Are you getting caught in the Django Trac's spam filter? Read this.
It seems I've been designated the "Django spam maven"; what this means for you, if you've been getting caught in the Django Trac's spam filters, is that you need to write me and let me know your IP address (or the typical range of IP addresses you use) so I can whitelist you. Once I do this, you won't trigger the "Akismet rejected spam" or any other spam-rejection errors. Tom Tobin [EMAIL PROTECTED] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@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-developers -~--~~~~--~~--~--~---
Re: Re: [Fw]The Python Web Framework
On 8/22/06, Christopher Lenz <[EMAIL PROTECTED]> wrote: > You're taking the original statement out of context. The context was > the often-heard argument that Django lets you replace any subsystem > if you prefer using a different library. What's less often-heard is > that if you do so, you are giving up a lot of the niceties that > Django provides (such as the admin if you use a different ORM) Maybe this is just a semantic point, but I think we need to be clear on the distinction between "the Django framework" and "Django applications bundled with the Django framework". And, again, you *can* use the Django admin with other ORMs. There are people using the Django admin app on top of Rails apps, so using it on top of another Python ORM shouldn't be too terribly hard. > Karl Guertin answered this one nicely I think. If you're providing a > database access layer on top of the raw DB API, you should probably > also provide connection pooling. See my other reply for my thinking on that. > That change improved the situation, but you still need the "from > django.conf import settings; settings.configure(...)" before > *importing* any other part of Django. That improves the situation, > but doesn't feel clean. So let's brainstorm solutions. What *would* feel clean to you? > Possibly. What concerns me is that many in the Django team seemed to > think escaping is the responsibility of the template author, yet the > template author shouldn't be bothered with having to care about > programming logic. I've yet to meet a designer who understands XSS > attacks, but "x < y" they get. Maybe it's just me. Again, I think that if there are common cases for which we don't provide tags, that's a separate matter (and can be remedied by putting in a ticket, pointing out the use case, and -- ideally -- also supplying a patch). Escaping, though, is much more complicated. The term "escaping" doesn't even have much meaning in the context of some of the things you can do (and that people *are* doing) with Django's template system -- what sort of "escaping" would be appropriate for, say, LaTeX output? The fact that the template system doesn't tie itself to only being able to output (X)HTML makes this a muddy question, and the fact that there are lots of filters people use (like the ones in django.contrib.markup) which are meant to output unescaped HTML makes it even muddier. Reasons like that are why escaping has been such a long, drawn-out debate. > What probably wasn't clear enough in the post: I think the *benefits* > of a solid auto-escaping approach are obvious, not necessarily how > that's done. The benefits of auto-escaping most variables when the output format is an SGML-derived markup language are obvious. Granted, that's a lot of use cases, but since we're clarifying... ;) > I'm sorry, but if you have to scurry around multiple files just to > implement and use a parameterized reusable snippet of HTML markup, > because the template system doesn't trust you can use functions and > parameters, that's additional work you need to do. More code and > coupling between code and the templates. It's not a matter of "the template system doesn't trust you can use functions and parameters". The template system doesn't assume template authors are idiots, and the complexity of some of the built-in tags should make that obvious. The template system, however, isn't a programming languages, and that's by design. > If the template system simply allowed you to call functions, you > could reuse presentation logic that way, without having to register > tags. And you don't need to learn a whole new syntax for every > template tag. I mean nothing personal by this, but if you're writing multiple tags which do similar things but use significantly different syntaxes, that's not a problem with the template system. And again, if we're talking about a common use case where a built-in tag or tag decorator isn't sufficient, then let's come up with ways to fix it. Having reusable bits of content doesn't require a full programming language. > Allowing the full expressiveness of a programming language (with > control structure and all) is quite different from allowing real > expressions. Django intentionally does allow the embedding of Python > expressions, because the devs think/thought that designers would have > problem with the syntax, so for me calling it "intentionally dumbed > down" is not all that unfair. There's a difference between "dumbing down" and "you shouldn't have to learn Python programming to write a template". The Django template system does its best to provide constructs for common types of presentational logic (if/else, for loops, etc.), but again, this *doesn't* require that the template syntax accept arbitrary Python expressions. > My point was that for teams that work on a web-app, where there's no > real distinction between programmers and template authors, this > actually does not help productivity. I'm still no
Re: [Fw]The Python Web Framework
James Bennett wrote: > On 8/22/06, Karl Guertin <[EMAIL PROTECTED]> wrote: > > SA provides: > > * connection pooling - since you asked about it, I'll quote from the SA > > docs: > > This is why I said "what comes to mind when I think 'database > connection pooling' isn't something I think belongs in Django." > > Maintaining in-process connection pools in the framework doesn't, in > my experience, provide enough benefit to justify the hassle. I'd > rather talk to something like pg_pool which maintains an external > connection pool. I think the problem here is competing definitions of the term 'connection pool'. You're using 'connection pool' to mean a connection that may be transparently directed to one of N databases (say where records 1-100 are on database machine A and 101-20 are on database machine B, or you're writing to A and reading from A and B), I think. And I think that Karl and Christopher are using 'connection pool' to mean a collection of N persistent connections to the SAME database, where threads in a web app can check out and use connections from the pool, so that each thread need not make and hold its own connection. So I agree, django's ORM doesn't need pools (definition 1), but it does need pools (definition 2) to help it scale better in some environments and to reduce request startup time. Hopefully the words I've put in your mouths are the right ones. :) JP --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@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-developers -~--~~~~--~~--~--~---
Re: [Fw]The Python Web Framework
why is it then when a framework doesn't meet a persons ideas of the utopian framework, it is pronounced as due to 'marketing'? i just wish that people remembered that a framework is by nature a set of choices. do we make it easy to configure at the risk of making it not simple to learn/start do we make all the bits work together seamlessly, or do we make then plug and play and switchable do we design the HTML template for designers to use, or for programmers. there is no 'perfect' framework, but a series of decisions made to target a group of people. in this case the decisions were made in the light of what will work best in a publishing house (LJW). and here is the amazing thing.. when I was looking for a framework to use 8-10 months ago, I didn't care about the language it was written in. I learnt python because of django. If django wasn't around I probably would be using rails right now. People like me is who Guido is trying to attract, not experienced python people who live and breathe SQLAlchemy the ones who look at rails, symphony, or java to write their next project. --I On 22/08/2006, at 11:02 AM, limodou wrote: > > http://www.cmlenz.net/blog/2006/08/the_python_web_.html > > Some points I think are reasonable, for example: django configuration > > -- > I like python! > My Blog: http://www.donews.net/limodou > My Django Site: http://www.djangocn.org > NewEdit Maillist: http://groups.google.com/group/NewEdit -- Ian Holsman [EMAIL PROTECTED] http://garden-gossip.com/ -- what's in your garden? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@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-developers -~--~~~~--~~--~--~---
Re: Re: [Fw]The Python Web Framework
On 8/22/06, JP <[EMAIL PROTECTED]> wrote: > I think the problem here is competing definitions of the term > 'connection pool'. You're using 'connection pool' to mean a connection > that may be transparently directed to one of N databases (say where > records 1-100 are on database machine A and 101-20 are on > database machine B, or you're writing to A and reading from A and B), I > think. Most of the connection-pooling utilities I'm thinking of easily handle both cases. > So I agree, django's ORM doesn't need pools (definition 1), but it does > need pools (definition 2) to help it scale better in some environments > and to reduce request startup time. I'm going to stick with thinking we don't need them in either case; the gain of simplicity and loose coupling in your overall stack is, to me, a killer feature. -- "May the forces of evil become confused on the way to your house." -- George Carlin --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@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-developers -~--~~~~--~~--~--~---
Re: [Fw]The Python Web Framework
JP wrote: > James Bennett wrote: >> On 8/22/06, Karl Guertin <[EMAIL PROTECTED]> wrote: >>> SA provides: >>> * connection pooling - since you asked about it, I'll quote from the SA >>> docs: >> This is why I said "what comes to mind when I think 'database >> connection pooling' isn't something I think belongs in Django." >> >> Maintaining in-process connection pools in the framework doesn't, in >> my experience, provide enough benefit to justify the hassle. I'd >> rather talk to something like pg_pool which maintains an external >> connection pool. > > I think the problem here is competing definitions of the term > 'connection pool'. You're using 'connection pool' to mean a connection > that may be transparently directed to one of N databases (say where > records 1-100 are on database machine A and 101-20 are on > database machine B, or you're writing to A and reading from A and B), I > think. And I think that Karl and Christopher are using 'connection > pool' to mean a collection of N persistent connections to the SAME > database, where threads in a web app can check out and use connections > from the pool, so that each thread need not make and hold its own > connection. > > So I agree, django's ORM doesn't need pools (definition 1), but it does > need pools (definition 2) to help it scale better in some environments > and to reduce request startup time. > hmmm..so am i correct when i say, that in a non-multithreaded web-app definition-2-pools are not needed/ do not help? gabor --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@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-developers -~--~~~~--~~--~--~---
Re: Re: [Fw]The Python Web Framework
On 8/22/06, James Bennett <[EMAIL PROTECTED]> wrote: > > * More flexible mapping including: > > - Mapping multiple objects to a table > > - Mapping multiple tables to an object > > - Mapping the results of an arbitrary query > > - Selectively overriding join conditions (including both to and from > > an intermediate table) > > Could you give some examples of these? Some of it I think is doable > with Django, but I'd need to sit down and think about it a bit. http://www.sqlalchemy.org/docs/adv_datamapping.myt I'm not entirely sure that the extra method covers everything but it'd work just fine for my use case. I'm also not sure that the building up of queries is the same as a unit of work (http://www.sqlalchemy.org/docs/unitofwork.myt) but I don't know enough about the frameworks to say for sure. The rest of the responses are either under discussion or close enough that they'd work. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@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-developers -~--~~~~--~~--~--~---
Re: [Fw]The Python Web Framework
> > So I agree, django's ORM doesn't need pools (definition 1), but it does > > need pools (definition 2) to help it scale better in some environments > > and to reduce request startup time. > > I'm going to stick with thinking we don't need them in either case; > the gain of simplicity and loose coupling in your overall stack is, to > me, a killer feature. I still think there is some kind of definitional crosstalk here, because I don't see what's less simple or more tightly coupled about: from django import db # connection is checked out from pool of persistent connections connection = db.connection vs. from django import db # connection is a module-level global initialized on import connection = db.connection The kinds of pools I think would be helpful aren't things like pg_pool, they are more analagous to a thread pool. Like the common use case where a defined number of worker threads consume jobs from a queue. In this case, a defined number of db connections are made at startup, and request handler threads check out a connection when they need one, rather than each thread connecting and disconnecting around every request. For a high-volume threaded server, that can be a life saver. And even for a low-volume server you can get rid of the overhead of making and breaking the connection on each request without the risk of a runaway googlebot starting 10 threads and beating your db server to a pulp. JP --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@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-developers -~--~~~~--~~--~--~---
Re: [Fw]The Python Web Framework
gabor wrote: > hmmm..so am i correct when i say, that in a non-multithreaded web-app > definition-2-pools are not needed/ do not help? Pretty much. The benefit really comes in multi-threaded environments where a new thread is being started for each request. When each of those threads makes its own db connection, you can see how a big traffic spike can be catastrophic -- there's no limit on the number of connections that might be made. With a limited pool of connections, you can at least choose to block or raise an exception when a connection isn't available, so your worst case scenario is a nice error or a slow response, not a dead db server. JP --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@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-developers -~--~~~~--~~--~--~---
Re: Django.contrib applications modifying Django to work properly?
Hi Ahmad, You completely misunderstand me. I know that per row permissions is under heavy development and it's in it's own branch. I just expected that the django.contrib.* applications would have code only under django.contrib., not under django.db, and god knows where else. Mart --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@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-developers -~--~~~~--~~--~--~---
Re: Re: Re: [Fw]The Python Web Framework
On 8/22/06, Karl Guertin <[EMAIL PROTECTED]> wrote: > http://www.sqlalchemy.org/docs/adv_datamapping.myt Some of these examples deal with rather exotic use cases that, I think, are close to the edge of what ORM can reasonably do before the abstraction starts leaking. The "map multiple tables to an object", for example, really feels like something that'd be better handled by a view at the database level. It's something to think about though; if you've got ideas for concrete implementations that would satisfy relatively common use cases, please do submit tickets for them. -- "May the forces of evil become confused on the way to your house." -- George Carlin --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@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-developers -~--~~~~--~~--~--~---
Re: Re: [Fw]The Python Web Framework
On 8/22/06, JP <[EMAIL PROTECTED]> wrote: > I still think there is some kind of definitional crosstalk here, > because I don't see what's less simple or more tightly coupled about: No, the difference isn't in definition; there are pooling utilities which do "multiple connections to multiple database", and there are *also* utilities which do "multiple connections to the same database" (and there are utilities that do both). But to be absolutely clear, everything I've said in this thread about connection pooling is meant to be applicable in the context of an external connection pool which maintains multiple connections to a single database, in order to reduce the overhead of opening connections to that single database. And I still think that's the way to go, for a couple of reasons: 1. It's easier to "switch out" pooling utilities this way, or to switch between pooling and not pooling as circumstances dictate. When your framework tries to do connection pooling for you, it automatically gets harder and, depending on whether you can turn the framework's connection-pooling utility off, maybe even gets impossible. 2. Admittedly I don't have a whole lot of experience in the area, but creating and managing a pool of connections to be passed from thread to thread just feels like much more hassle and overhead than we really need, especially since there are external pooling utilities available. -- "May the forces of evil become confused on the way to your house." -- George Carlin --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@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-developers -~--~~~~--~~--~--~---
Re: Abstract classes support in models
James Bennett wrote: > The new and improved model inheritance that Malcolm is working on will > also provide a facility for abstract "base" classes, so I'm thinking > this would probably be redundant; there's also been discussion on this > list of how the syntax should work, and IIRC the consensus was for a > new base class, so that for your abstract class you'd do Is this still waiting on django.db.models refactoring? The wiki page hasn't been updated in a while. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@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-developers -~--~~~~--~~--~--~---
Re: Re: Abstract classes support in models
On 8/22/06, Gary Wilson <[EMAIL PROTECTED]> wrote: > Is this still waiting on django.db.models refactoring? The wiki page > hasn't been updated in a while. The wiki page probably isn't the most reliable guide; I haven't looked at it, but I'd guess that it's been superseded by discussions on this list. -- "May the forces of evil become confused on the way to your house." -- George Carlin --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@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-developers -~--~~~~--~~--~--~---
Multi-db: Change DatabaseWrappers to no longer be local?
Looking back over the multi-db branch today, I realized that it seems to be duplicating the thread locality of connections. The connection management classes in multi-db django.db manage all connections as thread local, and the DatabaseWrapper classes in the backends are all subclasses of local. I may be missing something, but I think the latter locality can be safely removed in multi-db. DatabaseWrappers don't have to be local because each instance can only be accessed in a particular thread anyway. Since I had previously said multi-db was feature complete, I thought I should bring the change up here before comitting it. Let me know if you have any objections or can see that I am missing something. I'll commit the change within a couple of days if there are no objections, or sooner if anyone wants to try it now. JP --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@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-developers -~--~~~~--~~--~--~---
Re: modularity of apps
James Bennett wrote: > On 8/17/06, Gary Wilson <[EMAIL PROTECTED]> wrote: > > IMO, the dependency checking is the easy part. In the README or > > something, I say MyCoolApp requires the admin app. It's the > > configuration settings of the admin app that's hairy. > > That's what application documentation is for. In theory it's also > possible to use this mechanism to ensure that any additional settings > it requires exist in the project settings file and are non-empty; > something like > > from django.conf import settings > > try: > my_cool_app_setting = settings.COOL_APP_SETTING > except AttributeError: > dependency_errors.append("the setting 'COOL_APP_SETTING' must be > specified in the project's settings file in order to use this > application") > > But as Malcolm has pointed out, the idea here is not to provide a > mechanism for automatically configuring applications -- it's to > provide a way for applications to specify the things they need. Yes I think that, at the least, a mechanism for checking that apps have everything they need would be great. I was more trying to point out that simply checking INSTALLED_APPS is not sufficient. It would be a good start though. I am more concerned about when Djangoers start sharing apps more. (For instance, a Django application repository has been brought up a couple times on the list. Continuing to add applications to contrib is not going to scale.) I wouldn't want a context processor of an application I grabbed from some shared repository to be able to interfere with a context processor of an app I already have installed. Or if it did interfere, then it would be nice if this could be caught by some sort of validation check. I also think that the check should be only a warning. The admin app has checks in its code that makes sure that django.core.context_processors.auth is in TEMPLATE_CONTEXT_PROCESSORS, but I had another application where I wanted to set a context variable with the same name. To do this you have to remove the django.core.context_processors.auth. But then you can't use the admin app because it will raise an error, even if I have a custom context processor that runs either my application's context processor or the auth context processor depending on which application was "handling" the request. Applications shouldn't be able to so easily polute the context variable namespace for every installed application. The default template loaders suffer from this same type of polution. Let's say I want the admin app installed, which in the template directory namespace uses admin, admin_doc, registration, and widget. Now if I later made a registration app (or any application that wanted to use a folder named registration to hold its templates), I would be in trouble. One application shouldn't go looking in all the template directories of every other installed application. That's just wrong. Many users want to extend or alter the admin or authentication applications, but can't because they are so intertwined with each other (and other Django core) that it makes things hard to change. By making applications more modular, you also make them more extensible. > > What do you mean a bit too much toward the app server? Isn't that what > > we are all doing with django? Building and serving blog apps and forum > > apps and news publishing apps and ... > > In my mind, at least, an "app server" is a system whose job is to take > many different applications which may be written using wildly > different frameworks, or even no frameworks at all, and mediate > between them (assuming, for example, that they implement some common > interface for communication with the app server). WSGI is a good > example of this sort of thinking in the Python world -- the idea is > that it doesn't matter what you use to write your application, so long > as it exposes the appropriate WSGI-compliant interfaces for its > intended role. > > That seems to be far and away a larger and more complex task than what > Django aims for -- yes, Django provides facilities for Django-based > applications to work with one another, but Django is first and > foremost a tool for _writing_ applications, not a tool for _running_ > applications. I would never expect Django to handle apps written in other frameworks, but surely Django should be able to run it's own apps well. I would argue that Django is just as much a tool for running Django applications as it is a tool for writing Django applications. What good is writing a Django application if I don't have some equally good way to run it? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@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-developers -~--
Re: Proposal: Django Apps & Project Repository (again)
limodou wrote: > There are some threads talking about the apps repository already, but > till now, no repository be found. So I want to suggest again: we > should build an official project web site to host django apps or > projects. So we can easy share our source code and exchange our ideas. > And I think 0.95 is stable enought, and why we still need to wait 1.0, > if there is an official web site to host these things, we can reuse > others source code easily and make django more improvement I think. I think this is a great idea. Anyone have suggestions on to how this should be organized? One big repository or several small ones? Everybody with an account has access to all projects or form teams for each project? Should every project have its own Trac instance? Separating the projects and forming teams would be more of a Django mini-SourceForge, and while this might be ideal, it would require quite a bit more work to setup. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@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-developers -~--~~~~--~~--~--~---
Re: Proposal: Django Apps & Project Repository (again)
On 8/23/06, Gary Wilson <[EMAIL PROTECTED]> wrote: > > limodou wrote: > > There are some threads talking about the apps repository already, but > > till now, no repository be found. So I want to suggest again: we > > should build an official project web site to host django apps or > > projects. So we can easy share our source code and exchange our ideas. > > And I think 0.95 is stable enought, and why we still need to wait 1.0, > > if there is an official web site to host these things, we can reuse > > others source code easily and make django more improvement I think. > > I think this is a great idea. Anyone have suggestions on to how this > should be organized? > One big repository or several small ones? > Everybody with an account has access to all projects or form teams for > each project? > Should every project have its own Trac instance? > > Separating the projects and forming teams would be more of a Django > mini-SourceForge, and while this might be ideal, it would require quite > a bit more work to setup. > I would like mini-projects, but not a whole repository. If we can make this platform running, maybe it can replace sf platform. And I think mozilla community just like what I want. http://www.mozdev.org And there are some resources: http://www.mozdev.org/resources/ I see there is no trac on it. If we don't build a platform like that but we can make a index page to link separated projects or resources together, I think it's good either. I see there is also a rubyforge(http://rubyforge.org/), and it use php. I think we could provide a simple flatform(maybe just link index page), and if this platform is useful, we can improve it later. -- I like python! My Blog: http://www.donews.net/limodou My Django Site: http://www.djangocn.org NewEdit Maillist: http://groups.google.com/group/NewEdit --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@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-developers -~--~~~~--~~--~--~---
Re: the template system's whitespace handling
I created a ticket: http://code.djangoproject.com/ticket/2594 I also attached a patch that I have done a little testing with and seems to work ok. I first attacked this at the Node level, but realized that might not be the best way because the Nodes get rendered recursively. In order to clean up the line's whitespace, you would have to wait for everything to render and then remember which lines/templatetags/templatevariables the render originated from. The patch attacks the problem at the token level. It finds the end of lines and then evaluates each line to determine if whitespace should be cleaned up. But the patch is not perfect. If you have lines in your template like: {% for item in items %}{{ item.name }}{% endfor %} or {% if item.name %}{{ item.name }}{% endif %} where blocks are on the same line as text and the block renders no output, my patch is fooled and still will insert a blank line in the rendered string. If, however, you were to instead write the above examples as: {% for item in fooitems %} {{ item.name }} {% endfor %} or {% if item.name %} {{ item.name }} {% endif %} then my patch will clean up the whitespace nicely. This patch may also very well not work on windows due to the different line endings. There are a few setbacks though. It seems that with this patch, render_to_string becomes 2-3 times slower. Toying with python's profile for a few minutes shows that most of the time was being spent in Token.__init__ and Node.__init__, which seemed logical due to all the extra tokens, and hence nodes, that get created when using my patch. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@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-developers -~--~~~~--~~--~--~---
Re: [Fw]The Python Web Framework
James Bennett wrote: > > 2. Admittedly I don't have a whole lot of experience in the area, but > creating and managing a pool of connections to be passed from thread > to thread just feels like much more hassle and overhead than we really > need, especially since there are external pooling utilities available. > i think at the end the question is: how expensive is to open a connection to the 'pooling-utility'? because if it's cheap, the it does not matter if you're using an 'external' db-connection-pool, or an 'internal' one. but if it's expensive gabor --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@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-developers -~--~~~~--~~--~--~---