1. 17 Ara, 2013 16 kayıt (commit)
    • Aymeric Augustin's avatar
      Deprecated get_app(). · 69039bec
      Aymeric Augustin yazdı
      69039bec
    • Aymeric Augustin's avatar
      Deprecated get_apps(). · 2732edc5
      Aymeric Augustin yazdı
      2732edc5
    • Aymeric Augustin's avatar
      Removed the _-prefix for populate(). · d44de9b9
      Aymeric Augustin yazdı
      Several parts of Django call get_apps() with a comment along this lines
      of "this has the side effect of calling _populate()". I fail to see how
      this is better than just calling populate()!
      d44de9b9
    • Aymeric Augustin's avatar
      Simplified register_models. · ebda5800
      Aymeric Augustin yazdı
      Since it's never called with more than one model at a time the current
      signature is needlessly complicated.
      ebda5800
    • Aymeric Augustin's avatar
      Simplified handling of available_apps slightly. · e85932b5
      Aymeric Augustin yazdı
      It feels more natural for self.available_apps to contain app names (like
      INSTALLED_APPS) than app labels, and this is easy to implement now.
      e85932b5
    • Aymeric Augustin's avatar
    • Aymeric Augustin's avatar
      Added get_app_configs() to iterate on app_config instances. · da36d03f
      Aymeric Augustin yazdı
      Refactored get_apps() to rely on that method.
      
      This commit is fully backwards-compatible.
      da36d03f
    • Aymeric Augustin's avatar
      Added get_app_config() to look up app configs by label. · a4cb1400
      Aymeric Augustin yazdı
      Refactored get_app() to rely on that method.
      
      get_app() starts by calling _populate(), which goes through
      INSTALLED_APPS and, for each app, imports the app module and attempts to
      import the models module. At this point, no further imports are
      necessary to return the models module for a  given app. Therefore, the
      implementation of get_app() can be simplified and the safeguards for
      race conditions can be removed.
      
      Besides, the emptyOK parameter isn't used anywhere in Django. It was
      introduced in d6c95e93 but not actually used nor documented, and it has
      just been carried around since then. Since it's an obscure private API,
      it's acceptable to stop supporting it without a deprecation path. This
      branch aims at providing first-class support for applications without a
      models module eventually.
      
      For backwards-compatibility, get_app() still raises ImproperlyConfigured
      when an app isn't found, even though LookupError is technically more
      correct. I haven't gone as far as to preserve the exact error messages.
      I've adjusted a few tests instead.
      a4cb1400
    • Aymeric Augustin's avatar
      Fleshed out AppConfig objects. · c5eac3a2
      Aymeric Augustin yazdı
      Marginally improved creation of AppConfig stubs for non-installed apps.
      c5eac3a2
    • Aymeric Augustin's avatar
      Moved list of models inside AppConfig instances. · b55282b9
      Aymeric Augustin yazdı
      This commit is a refactoring with no change of functionality, according
      to the following invariants:
      
      - An app_label that was in app_configs and app_models stays in
        app_config and has its 'installed' attribute set to True.
      
      - An app_label that was in app_models but not in app_configs is added to
        app_configs and has its 'installed' attribute set to True.
      
      As a consequence, all the code that iterated on app_configs is modified
      to check for the 'installed' attribute. Code that iterated on app_models
      is rewritten in terms of app_configs.
      
      Many tests that stored and restored the state of the app cache were
      updated.
      
      In the long term, we should reconsider the usefulness of allowing
      importing models from non-installed applications. This doesn't sound
      particularly useful, can be a trap in some circumstances, and causes
      significant complexity in sensitive areas of Django.
      b55282b9
    • Aymeric Augustin's avatar
      Removed unused attribute app_errors of the app cache. · 2c9e84af
      Aymeric Augustin yazdı
      get_app_errors() always returned an empty dictionary; this behavior is
      preserved in django.db.models.loading until that module is deprecated.
      2c9e84af
    • Aymeric Augustin's avatar
      Stored AppConfig objects instead of models modules in the app cache. · 0e9d3472
      Aymeric Augustin yazdı
      This is a step towards allowing applications without a models module.
      0e9d3472
    • Aymeric Augustin's avatar
      Removed module-level functions for the app cache. · 8662654d
      Aymeric Augustin yazdı
      Since the original ones in django.db.models.loading were kept only for
      backwards compatibility, there's no need to recreate them. However, many
      internals of Django still relied on them.
      
      They were also imported in django.db.models. They never appear in the
      documentation, except a quick mention of get_models and get_app in the
      1.2 release notes to document an edge case in GIS. I don't think that
      makes them a public API.
      
      This commit doesn't change the overall amount of global state but
      clarifies that it's tied to the app_cache object instead of hiding it
      behind half a dozen functions.
      8662654d
    • Aymeric Augustin's avatar
      Removed ModelDict. · 33455133
      Aymeric Augustin yazdı
      Its only difference with OrderedDict is that it didn't deepcopy its
      keys. However it wasn't used anywhere with models modules as keys, only
      as values. So this commit doesn't result in any change in functionality.
      33455133
    • Aymeric Augustin's avatar
      Removed BaseAppCache.app_store. · 9217b89d
      Aymeric Augustin yazdı
      It was only storing redundant information. This is part of the effort to
      allow applications without a models module.
      9217b89d
    • Aymeric Augustin's avatar
      Moved django.db.models.loading to django.apps.cache. · 860c2c8b
      Aymeric Augustin yazdı
      This commit doesn't contain any code changes; it's purely a refactoring.
      860c2c8b
  2. 16 Ara, 2013 5 kayıt (commit)
  3. 15 Ara, 2013 7 kayıt (commit)
  4. 14 Ara, 2013 10 kayıt (commit)
  5. 13 Ara, 2013 2 kayıt (commit)