managements.commands and namespace packages

2013-02-11 Thread Alessandro Dentella
Hi,

this email aims at finding a bettere solution to a problem that was already
posted some months ago in the user list [1].  If you use namespaces in
packages to split your code in independently distributable packages as:

  jmb.bar
  jmb.foo

you end up not being able to use managements.commands from one of the 2
packages as the mechanism that finds the packages in
django.core.management.find_management_module uses imp.find_module that will
return a tuple containing just one path to one or the other.

IIUC the problem arises since find_module_managements avoids to load all
modules (efficency concerns I guess) but so doing it misses the .__path__
attribute on 'jmb' in the example that could be used for the next run of
find_module.

I personally think that at least as a fallback django should try to import
the package (or document namespace packages are not supported).

The following patch works for me, but I'm sure there will be other
scenarios I'm not considering:

while parts:
part = parts.pop()
-   f, path, descr = imp.find_module(part, path and [path] or None)

+try:
+f, path, descr = imp.find_module(part, path and [path] or None)
+except ImportError:
+# we're probably dealing with a namespace package
+if len(app_name.split('.')) >= 2:
+mod = __import__(app_name + '.management', {}, {}, [''], -1)
+return mod.__path__[0]


I'd be glad to make a patch for this but I wanted to hear if there's any
better idea. 

sandro
*:-)

[1] 
https://groups.google.com/forum/?hl=it&fromgroups=#!searchin/django-users/commands$20find_module/django-users/PZacS0gE_Js/zmdY56PYTMsJ




-- 
Sandro Dentella  *:-)
http://www.reteisi.org Soluzioni libere per le scuole
http://sqlkit.argolinux.orgSQLkit home page - PyGTK/python/sqlalchemy



-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Mbox of the group

2020-10-29 Thread Alessandro Dentella
On Thu, Oct 29, 2020 at 04:14:03PM +0100, Carlton Gibson wrote:
> Hey Tom. 
> 
> I pinged the Forum Powers That Be™ to see about permissions for you. 
> 
> > On 29 Oct 2020, at 16:09, Tom Forbes  wrote:
> > 
> > One alternative to the scraper might be using Google Takeout 🥡  
> > (https://takeout.google.com/ ), but it’s 
> > unclear if that would export the messages themselves. And it would require 
> > the actual owner of the group to do that with their account.
> 
> Difficulty of getting the messages out was what led me to wonder if someone 
> had an MBOX somewhere with the whole thing in… (But I didn’t try anything.) 


I have an mbox with all messages from dec 7, 2006. It's around  43000 messages.
I'm fairly confident I didn't delete messages on purpose.

You can download it from here:

  https://wikidattica.org/media/django-developers.mbox.gz

sandro
*:-)

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/20201029162124.GA4335%40bluffx.