question about involve "vncserver" command with django

2010-11-09 Thread Bill
on the port which Django used. For example, django listen on tcp port 8000, and the Xvnc also listen on tcp port 8000. It's wired. Is there any way to involve the vncserver? Regards, Bill -- You received this message because you are subscribed to the Google Groups "Django users&

Re: question about involve "vncserver" command with django

2010-11-09 Thread Bill
in, I find the Xvnc process used the 8000 port and killed the Django webserver = [r...@sun]# lsof -P -i -n |grep Xvnc Xvnc 3691 bill0u IPv4 14835 TCP *:6001 (LISTEN) Xvnc 3691 bill3u IPv4 14371 TCP *:8000 (LISTEN)

Re: question about involve "vncserver" command with django

2010-11-09 Thread Bill
Hi Clifford, Thank you, sounds like good, I will try FreeNX later. but you know, I already wrote the python code, it works except I use it on Django. BTW, we are very close, I'm at Eglinton subwaystation. Best regards, Bill > I've found FreeNX with the NoMachine client to be

Re: question about involve "vncserver" command with django

2010-11-10 Thread Bill
really appreciate you guys give me many ideas. but I want to know why Django can't involve the "vncserver" use subprocess. Thanks, Bill -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to dj

Re: question about involve "vncserver" command with django

2010-11-10 Thread Bill
Thank you Sam, I've checked the manual and try to change any port include rfbport or http port, it doesn't work. But finally, I find my way, I use pexpect to involve the command. It works. Thank you everyone! Bill On Nov 10, 4:23 pm, Sam Lai wrote: > Why can't you tell vncser

Re: email in settings.py

2008-01-11 Thread Bill
ettings.py should be considered and override for the defaults specified in django/conf/global_settings.py. See: http://www.djangoproject.com/documentation/settings/ for more info. Running the command: python manage.py diffsettings Will show you what you've changed from the defaults. Bill

Something like an "all in" for filter of related set

2007-10-04 Thread bill
st have all of those three.) I've learned about making my own Manager class, so that's definitely possible, but does there happen to be a built-in way? Thx much, bill --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

MySQL Query

2012-02-08 Thread Bill
Hello I am completing the Django tutorials, however I am having a problem when syncing the DB to Django. I am getting the following message. Any help would be appreciated. C:\Python27\Django-131\django\bin\mysite>manage.py syncdb Traceback (most recent call last): File "C:\Python27\Django-131\

Re: MySQL Query

2012-02-08 Thread Bill
Many thanks it is now working!! On Feb 8, 6:21 pm, Anoop Thomas Mathew wrote: > Hi, > Make sure that you have installed MySQL-python package for python bindings > to mysql. > > Thanks, > Anoop Thomas Mathew > > ___ > Life is short, Live it hard. > > On 8

Re: MySQL Query

2012-02-08 Thread Bill
Many thanks it is now working!! On Feb 8, 6:21 pm, Sandro Dutra wrote: > Probably you've to install python-mysqldb. > > 2012/2/8 Bill : > > > > > > > > > Hello > > > I am completing the Django tutorials, however I am having a problem > > wh

Linux password authentication for django

2010-12-29 Thread Bill
Hi there, I want to know is there any authentication module base on Linux passwd/ shadow file for django? Many thanks, Bill -- 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...@googlegrou

Re: Linux password authentication for django

2010-12-31 Thread Bill
Hi Marc, Thank you so much! You really helped me! Bill On Dec 30, 10:24 am, Marc Aymerich wrote: > On Thu, Dec 30, 2010 at 6:35 AM, Bill wrote: > > Hi there, > > > I want to know is there any authentication module base on Linux passwd/ > > shadow file for django? >

Re: Source changes: How can I resolve import error -- cannot import django.db.models.query.parse_lookup

2008-07-17 Thread Bill Totman
Well, I'm not sure of the nature of the patch, but I hope to find out how to do so. I'll be certain to pass on the HOWTO to you here - since you found out the solution and all. I, too, and going through the book and would like to make progress. -Bill On Jul 17, 4:03 pm, LRP <[EM

Re: Source changes: How can I resolve import error -- cannot import django.db.models.query.parse_lookup

2008-07-17 Thread Bill Totman
ite-packages/ Once 'syncdb' finds the (svn version of the) 'tagging' directory in the $PYTHONPATH it will do it's job. I hope this helps. (I'm off to the book.) -Bill On Jul 17, 4:03 pm, LRP <[EMAIL PROTECTED]> wrote: > Hello, > > Still worki

Re: OK to put app_directories before filesystem template loader?

2009-08-20 Thread Bill Freeman
Thanks for the response. Yeah, I found that while it make my app work, it broke others. I switched to renaming the subdirectory of templates in which my views look for their templates. Bill On Wed, Aug 19, 2009 at 3:53 AM, David Christiansen wrote: > > Well, it doesn't seem t

Re: automatic initialization of sample data

2009-08-20 Thread Bill Freeman
Perhaps I'm not understanding correctly, but how about, assuming you have a function run_data_inits() that calls your chain of init_sample_data() functions: $ python manage.py shell >>> import myproject.myapp.models as m >>> m.run_data_inits() >>> ^D Bill On T

Re: Get project name

2009-08-21 Thread Bill Freeman
Alessandro, In settings.py: import os.path PROJECT_ROOT = os.path.realpath(os.path.dirname(__file__)) PROJECT_NAME = os.path.basename(PROJECT_ROOT) Then, in modules where you need it: from django.conf import settings PROJECT_NAME = settings.PROJECT_NAME Bill On Fri, Aug 21, 2009 at 2:31 PM

Re: template tag response None. but why?

2009-08-27 Thread Bill Freeman
might only apply from one file to another (extends, include). I'm not sure of that. The tag that I wrote has a matching end tag, so the stuff between gets rendered before my render returns, and the variable that I set is available there. Bill --~--~-~--~~~---~--~-

Re: Model Theory 101 - Video Sharing App

2009-08-27 Thread Bill Freeman
Look at django-oembed. A CharField will serve for every (supported) provider. On Wed, Aug 26, 2009 at 8:17 PM, thornomad wrote: > > Hi - need some suggestions. > > I am trying to put together an app that allows users to submit links > to videos at popular video sharing sites (e.g., youtube, vim

Re: subprocess.Popen in django production - are file descriptors closed?

2009-08-31 Thread Bill Freeman
Are you saying that it works in the development server environment? If so, it could be permission issues. Have the ruby script append a time stamp to a world writable log file to confirm that it gets run. Bill On Fri, Aug 28, 2009 at 9:07 PM, aaron smith < beingthexemplaryli...@gmail.

Re: create a link from an object - template tag or?

2009-08-31 Thread Bill Freeman
must be looked up. So, instead of self.object = object in LinkNode, use self.object = template.Variable(object) Not that you need it for this tag, since simple_tag works, but you may want to write something fancier someday. Bill On Fri, Aug 28, 2009 at 10:34 PM, MIL wrote: > > Hi :

Re: how to make admin app use templates from app templates folder?

2009-09-01 Thread Bill Freeman
Add the filesystem template loader, put it before app directories loader, and put the (absolute) path to your templates directory (e.g.; /home/moho/myapp/templates) in TEMPLATES_DIR. Bill On Tue, Sep 1, 2009 at 11:52 AM, Aljosa Mohorovic < aljosa.mohoro...@gmail.com> wrote: > > ad

Re: Is valid {% ifequal model.name "Mymodelname" %}??

2009-09-04 Thread Bill Freeman
passing it into a template, e.g.; context(..., model=x,...). In this case, try something like: {% ifequal model.__class__.__name__ "Foo" %} ... Remember, you can always temporarily add something like {{ model.name }} to the text to see what you're comparing to that string. Bill

Re: automatic initialization of sample data

2009-09-08 Thread Bill Freeman
hey seem to be a supported means of initializing a database. Bill On Mon, Sep 7, 2009 at 4:43 AM, Jan Ostrochovsky wrote: > > Thanks Bill, yes, that is one possible solution, when implementing > such feature from the scratch. > > I am only asking, if there is some existing framework for s

Re: Django settings function object?

2009-09-08 Thread Bill Freeman
On Tue, Sep 8, 2009 at 8:00 AM, Maksymus007 wrote: > > I tried following code > > from django.conf import settings > > ... > > > a = setting.MY_OWN_VARIABLE=2 > If that's really what you have, try, instead: a = settings.My_OWN_VARIABLE=2 (note the &

Abstract Base Classes

2009-09-08 Thread Bill Freeman
foo property). I can make it seem to work by changing the Meta class declaration to: class Meta(models.Model.__metaclass__): The property is there, and isinstance reports that x is an instance of both, but now Thing doesn't have a _meta_ attribute (so it doesn't have fields).

Re: Abstract Base Classes

2009-09-08 Thread Bill Freeman
Actually, maybe it is working. I should have been looking for _meta rather than _meta_ . But does anyone have an opinion about subclassing models.Model.__metaclass__ ? Bill On Tue, Sep 8, 2009 at 4:35 PM, Bill Freeman wrote: > I'm trying to use an Abstract Base Class as described at:

Re: no such table ERROR

2009-09-14 Thread Bill Freeman
Make DATABASE_NAME an absolute path. On Mon, Sep 14, 2009 at 12:11 AM, AIM wrote: > > HI, > > When I browse to > http://127.0.0.1:8000/mysite/Start/ > > I get the following error: > > OperationalError at /mysite/Start/ > > no such table: wiki_page > > Request Method:         GET > Request URL:  

Re: Removing line breaks in a template

2009-09-14 Thread Bill Freeman
in the view: text=text.replace("\r\n","") 5. You can always write a custom filter. 6. You probably actually want to replace the line boundary with a space, rather than cut it, since otherwise you may run words together. Bill On Thu, Sep 10, 2009 at 2:47 PM, EricR86 wrote: &

Re: Naming and scoping guidelines to make apps that are actually 'pluggable'?

2009-10-02 Thread Bill Freeman
ur templatetags directory from ..models import MyModel Note that this makes it possible to have an app specific settings module, in the same directory as models.py, which can calculate APP_NAME, or the like, and be relatively imported (django.conf doesn't help you here). You can almost d

Re: How to pass values between views/templates

2009-10-05 Thread Bill Freeman
ld always compress them and then uuencode the value and use that in the url. Better probably would be just use a database primary key for the url part. Bill --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "D

Re: "manage.py syncdb" fails when called via SCons

2009-10-05 Thread Bill Freeman
Before you start python (assuming *nix, including os/x), type: $ which python Then, in the subshell, before starting python, type the same thing. Compare. Bill On Mon, Oct 5, 2009 at 12:02 PM, Ralph Heinkel wrote: > > Hi, > > I just checked the environment for PYTHONPATH, i

media url naming, philosophies and reasons?

2009-10-06 Thread Bill Freeman
ensions which seem to use ADMIN_MEDIA_PREFIX as a guide. 1. Ignoring, for the moment, OSes that don't implement symbolic links, is there a good reason not to put all usages under the same hierarchy? 2. Is the Django world converging on a single st

Re: compilemessages invalid multibyte sequence error

2009-10-13 Thread Bill Freeman
latin-1.) Bill On Tue, Oct 13, 2009 at 12:40 AM, celopes wrote: > > I have a django.po file containing: > > # SOME DESCRIPTIVE TITLE. > # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER > # This file is distributed under the same license as the PACKAGE > packag

Truth values for current database type for custom queries.

2009-10-26 Thread Bill Freeman
r the representations? Thanks, Bill --~--~-~--~~~---~--~~ 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

Re: static models methods

2009-10-26 Thread Bill Freeman
I have to wonder whether "get_default" is a name that already means something to Django. On Mon, Oct 26, 2009 at 12:22 PM, Alessandro Ronchi wrote: > > I need to create a static method for a model class like this. The line > Settore.objects.all()[0].id gives error  ( > psycopg2.InternalError: cu

Re: Specifying Django Project/Application Templates

2009-10-29 Thread Bill Freeman
d, so that you can still access the original to extend it, without copying and renaming it, that's a more interesting problem. Bill On Thu, Oct 29, 2009 at 8:44 AM, Johan wrote: > > Hi. Is there a way to specify custom project (or what I call sites) > and application templates. At present the

Re: pdb doesn't break in django

2009-10-30 Thread Bill Freeman
ace() but sometimes I'd rather not edit the source code, especially on a shared server, and it's a pain to create a dummy module with a set_trace() and the call to the target function.] Bill On Fri, Oct 30, 2009 at 1:11 PM, skunkwerk wrote: > > Hi, >   i've been trying to use pd

Re: Display Certain Fields of the Model Formset As Text

2009-10-30 Thread Bill Freeman
ne instead of a dict). Bill On Fri, Oct 30, 2009 at 1:47 AM, Anthony Simonelli wrote: > > Hello, > > I am using a Model Formset because there are two foreign keys in my Model and > it makes it easy to create forms with them preselected from data in my model: > > class Foreca

Re: Display Certain Fields of the Model Formset As Text

2009-10-30 Thread Bill Freeman
On Fri, Oct 30, 2009 at 4:36 PM, Preston Holmes wrote: > > > > On Oct 30, 12:00 pm, Bill Freeman wrote: >> Yet another option is to write a widget that subclasses the existing >> one, and adds >> disabled='disabled' to the dictionary that will be used t

Newer PostgreSQL breaks django_friends, maybe deserves ORM fix.

2009-11-02 Thread Bill Freeman
gt; '8' (and unicode(8) -> u'8'), while str() applied to a string (or unicode() applied to a unicode string) leaves it unchanged (doesn't even copy in, in a few quick tests in python 2.6.2). Then the backend will know to quote it. Thoughts? Workaround suggestions?

Re: Newer PostgreSQL breaks django_friends, maybe deserves ORM fix.

2009-11-03 Thread Bill Freeman
On Tue, Nov 3, 2009 at 7:05 AM, Russell Keith-Magee wrote: > > On Tue, Nov 3, 2009 at 12:19 PM, Christophe Pettus wrote: >> >> >> On Nov 2, 2009, at 2:14 PM, Bill Freeman wrote: >>> My presumption is that the older PostgreSQL, expecting to have to >>>

Re: Newer PostgreSQL breaks django_friends, maybe deserves ORM fix.

2009-11-03 Thread Bill Freeman
On Tue, Nov 3, 2009 at 9:14 AM, Bill Freeman wrote: > On Tue, Nov 3, 2009 at 7:05 AM, Russell Keith-Magee > wrote: >> >> On Tue, Nov 3, 2009 at 12:19 PM, Christophe Pettus wrote: >>> >>> >>> On Nov 2, 2009, at 2:14 PM, Bill Freeman wrote: >

Re: Newer PostgreSQL breaks django_friends, maybe deserves ORM fix.

2009-11-03 Thread Bill Freeman
On Tue, Nov 3, 2009 at 6:46 PM, Russell Keith-Magee wrote: > > On Wed, Nov 4, 2009 at 3:05 AM, Bill Freeman wrote: >> >> On Tue, Nov 3, 2009 at 9:14 AM, Bill Freeman wrote: >>> On Tue, Nov 3, 2009 at 7:05 AM, Russell Keith-Magee >>> wrote: >>>>

Re: Dictionary pagination

2009-11-04 Thread Bill Freeman
the next request. Or if you're sure that d won't change between requests, just do the call to the keys method and the sort each time. [Note, too, re your sample, that "dict" is a bad name for a dictionary variable, because it is also the name of the type. It will work, but it w

Re: Imports, works from directory but not from file

2009-11-10 Thread Bill Freeman
Which all of these directories are on your python path, and which of them have __init__.py files? Bill [Hint to answer first question: from pprint import pprint as pp import sys pp(sys.path) ] On Tue, Nov 10, 2009 at 5:12 PM, When ideas fail wrote: > > I have a folder called lib on m

Re: Imports, works from directory but not from file

2009-11-10 Thread Bill Freeman
would probably be clear from the open test above. Check that the __init__.py files are either empty, or have valid python contents. Beyond that, I'm out of ideas. Good luck. Bill On Tue, Nov 10, 2009 at 5:24 PM, When ideas fail wrote: > > I used this in my settings.py to add the o

Re: Imports, works from directory but not from file

2009-11-11 Thread Bill Freeman
nd(os.path.join(FILE_ROOT, 'lib')) Bill --~--~-~--~~~---~--~~ 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

Re: Imports, works from directory but not from file

2009-11-11 Thread Bill Freeman
apps folder, you can say 'microblogging' in your INSTALLED_APPS and it will find yours rather than the system version. (TN.B.: emplate paths are a separate issue.) Bill On Wed, Nov 11, 2009 at 10:34 AM, andreas schmid wrote: > > im experiencing the same problem. > i started with

Re: Imports, works from directory but not from file

2009-11-12 Thread Bill Freeman
dows or something else, but, especially on Windows, I don't take it for granted that environment settings will be properly respected/available. Bill On Thu, Nov 12, 2009 at 2:39 AM, andreas schmid wrote: > Bill Freeman wrote: >> Does your project root (I'm assuming that'

Re: Imports, works from directory but not from file

2009-11-12 Thread Bill Freeman
" to see if it gets an exception, in which case your code passes, but your models wouldn't be available unless you put stuff in app/models/__init__.py to import your other models files. Bill -- You received this message because you are subscribed to the Google Groups "Django use

Re: Help a Rails refugee - how to do site specific layouts?

2009-11-12 Thread Bill Freeman
variable block.super, which allows you to add to rather than replace content from the extended template. Also see the "include" tag, but if you use it very much, you probably don't understand extends. Bill On Thu, Nov 12, 2009 at 1:35 PM, Todd Blanchard wrote: > I like the

Re: django basic blog and inlines

2009-11-16 Thread Bill Freeman
Do you have among your installed apps a name identifying a directory on the python path having both a models.py and a subdirectory named templatetags, that subdirectory containing a file inlines.py ? Or was that in the stuff you excluded from basic.app? Bill On Sun, Nov 15, 2009 at 10:34 PM

Re: django basic blog and inlines

2009-11-16 Thread Bill Freeman
://www.thecigarcastle.com/blog/2009/nov/15/asdfasd/ > > it's like it's trying to call inlines from > django.templatetags.inlines   rather than from the inlines path noted > above. > > > > On Nov 16, 10:49 am, Bill Freeman wrote: >> Do you have among your inst

Re: Strange debugger behavior

2009-11-20 Thread Bill Freeman
ks correctly. Still, unless you're trying to teach yourself how django works, I'd try to avoid stepping through the interior. Bill On Thu, Nov 19, 2009 at 5:28 PM, Nick Arnett wrote: > I'm not sure if this is a bug... couldn't find anything quite like it in the > trac

Re: querySet + select distinct

2009-11-20 Thread Bill Freeman
selects all the fields, messing > up the distinct part. > If you happen to be in PostgreSQL, might you be able to put "DISTINCT ON" in an .extra() where? Of course, you have to know what the ORM is calling the columns. Bill -- You received this message because you are subscribed

Re: how to symlink to django-admin.py from some place on path?????.

2009-11-23 Thread Bill Freeman
ter end with '\n', not '\r\n' if your fond of editing stuff on windows and running it on *nix) as a command to run instead, passing the file itself to the command being run. Because most "interpreters", such a python, have been arranged to treat '#' as the b

Re: form fields slicing

2009-11-23 Thread Bill Freeman
eferably in your view function), pass that, and slice it. (lists do, of course, implement slicing.) Something at least that complicated would need to be going on inside the code that would implement slicing on the form anyway, so this shouldn't have a negative performance impact. Bill On Mon, No

Re: Big issue serving big files through a view

2009-11-23 Thread Bill Freeman
1. You could read (and thus write) in smaller chunks, by giving read() an argument indicating the number of bytes to read: f = open(file) # The mode 'r' is default for buf in read(1024*32): response.write(buf) f.close() 2. You could, instead, let Apache serve the files in encrypte

Re: postgresql errors (works in sqlite)

2009-11-23 Thread Bill Freeman
you could downgrade postgresql if you like. But eventually you're likely to want some new feature, so fixing your column seems to me the right thing. Bill On Mon, Nov 23, 2009 at 1:17 PM, Some Guy wrote: > Hi, > I was switching from sqlite3 to postgres, the data was imported ok

Re: string-based fields and null

2009-11-25 Thread Bill Freeman
ill be twice as big. Still, python (and lisp and C) programmers are used to thinking about the possibility of None (or nil or (void *)0), so experienced programmers may have an easy time with maintenance or a NULL flag design. So, it's not a hard and fast rule. I still think that inconsist

Re: How to resolve the view name from a url

2009-11-25 Thread Bill Freeman
le file by importing your version as url. You must be sure that all the views in question are prepared for the extra context. Bill On Tue, Nov 24, 2009 at 5:48 AM, bcurtu wrote: > No, I don't. > > I want to know the name of the url for a given url pattern. So, when I > get in my

Re: Why are collapsed fieldsets expanded on submit in the admin?

2009-11-25 Thread Bill Freeman
You could attempt to conditionalize this on browser version. On Wed, Nov 25, 2009 at 10:14 AM, Tom Evans wrote: > On Mon, Nov 23, 2009 at 3:57 PM, Benjamin Wohlwend > wrote: >> >> Hi, >> >> currently, when a form in the admin has collapsed fieldsets, those >> fieldsets are expanded on submit. As

Re: cannot import name settings - accessing Django environment from external script

2009-11-25 Thread Bill Freeman
Does /var/www/sites/project/__init__.py exist? Are the files and directories readable, and the directories searchable (excutable) by the user as which the webserver runs? On Wed, Nov 25, 2009 at 12:21 PM, Stodge wrote: > If I break the code out and write a simple python script that only > contai

Re: cannot import name settings - accessing Django environment from external script

2009-11-25 Thread Bill Freeman
eveloping a Mercurial hook in /var/www/sites/ > project/hg/hooks. If I delete this directory it works. If I recreate > the directory and the hook, it fails. Guess Django is getting confused > by its existence. > > On Nov 25, 12:56 pm, Bill Freeman wrote: >> Does /var/w

Re: callback called twice for the same comment_will_be_posted signal

2009-11-30 Thread Bill Freeman
Might you have managed to register it twice? (Just a stab in the dark.) On Mon, Nov 30, 2009 at 3:19 PM, cirip wrote: > Hi, > > I am getting multiple signals (2) called for each comment that is > submitted. The same for comment_will_be_posted. > > Code: > > def comment_wbp(sender, comment, reque

Re: Adding a dashboard to admin

2009-12-01 Thread Bill Freeman
> > I then created my own template file in one of my TEMPLATE_DIRS called > 'admin/custom_index.html" that extends 'admin/index.html'. I ended up > copying the {% block content %} from the admin/index.html and > inserting my template tag into it. I, too, think you're going the right way. One poin

Re: Adding a dashboard to admin

2009-12-01 Thread Bill Freeman
On Tue, Dec 1, 2009 at 12:53 PM, Brian Neal wrote: > On Dec 1, 10:56 am, Bill Freeman wrote: >> > I then created my own template file in one of my TEMPLATE_DIRS called >> > 'admin/custom_index.html" that extends 'admin/index.html'. I ended up >> &

Re: Finding a form field's widget type from the template

2009-12-01 Thread Bill Freeman
Maybe, but the template seems like a bad place to do that. Why not create a derived widget with your custom tweaks in it, and use it for appropriate fields? Or are you introspecting someone else's code that you don't want to customize? On Tue, Dec 1, 2009 at 2:14 PM, Jon wrote: > I'm trying to

Re: How to get rid of anchor in url when rendering via render_to_response()

2009-12-01 Thread Bill Freeman
Filter it off when you create the form action? Or in more detail, probably, in your view function, create a copy of the url with such stuff removed, easy to do with python string manipulations, or maybe just use reverse on the view function itself, and pass that as, say, form_action, and in your t

Re: Browsing Django modules from interactive python shell

2009-12-02 Thread Bill Freeman
import a does not automatically import modules and sub packages of package a. It takes special action in a's __init__.py to make this happen as it does for os.path when you import os. I assume that you're doing this directly in python, since in the manage.py shell other stuff has already caused

Re: Importing users - salted sha1

2009-12-03 Thread Bill Freeman
Do you have access to the password checking code for the source system? It's fine to say that you have an SHA1 hash, but even if that's true, there are many choices for how to represent the digest, and how to apply the salt. If you have access to the code, you might insert print statements to see

Re: Importing users - salted sha1

2009-12-03 Thread Bill Freeman
in django to replace the sha1$ > part of the password field, would I basically need to port this code > to django? > > Thanks again for your help! > > > > On Dec 3, 8:06 am, Bill Freeman wrote: >> Do you have access to the password checking code for the source system? >> It

Re: Forms - readonly representation?

2009-12-03 Thread Bill Freeman
1. You can sub class the form widget of interest to override the render method, and, for example, do "attrs['disabled'] = 'disabled'" before calling the superclass method. This is nasty because some browsers are actually fussy about the fact that the disabled attribute doesn't take a value, but mo

Re: DateTimeField arithmetic problem

2009-12-04 Thread Bill Freeman
On Fri, Dec 4, 2009 at 4:48 AM, Max Battcher wrote: > Continuation wrote: >> if form.is_valid(): >>     object = form.save(commit=False) >>     delta = datetime.timedelta(days=object.days_difference) >>     object.end = object.start + delta >>     object.save() >> >> But I got the error: >> type o

Re: How to create a form to edit an existing object without knowing the object's id?

2009-12-07 Thread Bill Freeman
Off the top of my head, you have three choices. 1. Create a hidden field to carry the id (yes, you do know it once you've done that query - it's z.id or z.pk). 2. (My favorite) encode the id as part of the url or as a query parameter in the action attribute of your form. Then access it in the vi

Re: model design problem

2009-12-07 Thread Bill Freeman
I'm not clear on what you need to store, so I'll assume that you have individual data to store for each port of each type, and it is unrelated to data stored for another instance of the same or a different product. What comes to mind is that there is a "Product" model and a "Port" model (or if red

Re: model design problem

2009-12-07 Thread Bill Freeman
n Mon, Dec 7, 2009 at 11:56 AM, Daniel Goertzen wrote: > Thanks for the reply Bill.  The problem I had with that approach is that > after creating the product I have to worry about creating red and green > ports.  Likewise, upon deletion, I have to mop up the ports.  Looking > through the d

Re: model design problem

2009-12-07 Thread Bill Freeman
Hmmm. Probably just as ugly, and untested, but: class A(basemodel): for o in range(MAXNUMREDPORTS): for i in (1,2): locals()["Port%d_redfield%d" % (o+1, i)] = models.FloatField() ... On Mon, Dec 7, 2009 at 12:10 PM, Daniel Goertzen wrote: > Okay, I explored model gener

Re: model design problem

2009-12-07 Thread Bill Freeman
Or there's overriding the metaclass... On Mon, Dec 7, 2009 at 12:39 PM, Bill Freeman wrote: > Hmmm.  Probably just as ugly, and untested, but: > > class A(basemodel): >    for o in range(MAXNUMREDPORTS): >         for i in (1,2): >             locals()["

Re: How to use debugger from doctest

2009-12-15 Thread Bill Freeman
d and print (or write) to that, and close it. You might also manage this with the logging facility. Bill On Mon, Dec 14, 2009 at 5:21 AM, Phui Hock wrote: > Suppose I have the following in app 'app'. > from django.db import models > class Test(models.Model): >    "

Re: How to use debugger from doctest

2009-12-15 Thread Bill Freeman
Untested, but it looks like you can do: import pdb, sys; pdb.Pdb(stdin=sys.__stdin__, stdout=sys.__stdout__).set_trace() On Tue, Dec 15, 2009 at 11:07 AM, Bill Freeman wrote: > IIUC, the test jig redirects stdin and stdout so that it can drive > interpreter input from > the corr

Re: How to use debugger from doctest

2009-12-15 Thread Bill Freeman
Or maybe: import pdb, sys; pdb.Pdb(stdin=sys.__stdin__, stdout=sys.__stdout__).set_trace(sys._getframe().f_back) On Tue, Dec 15, 2009 at 5:32 PM, Bill Freeman wrote: > Untested, but it looks like you can do: > >   import pdb, sys; pdb.Pdb(stdin=sys.__stdin__, > stdout=sy

Re: How to use debugger from doctest

2009-12-16 Thread Bill Freeman
doesn't get one it does the same calculation, which is probably the actual frame that you want, rather than one level up. so try: import pdb, sys; pdb.Pdb(stdin=sys.__stdin__, stdout=sys.__stdout__).set_trace() The debugger, after all, is just python code with specific knowledge of how the

Re: How to use debugger from doctest

2009-12-16 Thread Bill Freeman
On Wed, Dec 16, 2009 at 9:09 AM, Bill Freeman wrote: > I use pdb with django often, and it works fine (caveats below), so I And I forgot my caveat. I can enter the debugger using set_trace() just fine, but I have trouble using pdb.run('...') in that it seems confused about where

Re: Forms Delay

2009-12-16 Thread Bill Freeman
as the value of choices, so try: ... game = forms.ChoiceField(choices=GetGameChoices) ... That is, pass the function, not what it returns. It will then be called each time the form is rendered. Bill -- You received this message because you are subscribed to the Google Groups "

Re: Directories inside app directory

2009-12-16 Thread Bill Freeman
1. You must place a file __init__.py in each sub-directory (folder) from which you will import, such as your models and views directories. 2. The __init__.py in your models directory must import all modules containing modules. When you add an app to installed apps in settings.py, django will im

Re: Python 2.6 Decompile --- I lost my views.py but have the views.pyc

2009-12-17 Thread Bill Freeman
I saw a demo of a byte code disassembler once. It won't get you the source code back, but you could conceivably construct equivalent from it. You can, for example, see what it's calling, and sketch out the contiditionals and any loops. You could google for it, or ask on the python tutor mailing

Re: Python 2.6 Decompile --- I lost my views.py but have the views.pyc

2009-12-17 Thread Bill Freeman
The name of the byte code disassembler is dis, and it's part of the standard python install in 2.4, 2.5, 2.6, and 3.0 (the ones I have handy to test with) and will be documented in the default docs. You can confirm that you have it by trying "import dis". On Thu, Dec 17, 2009 at 2:45 PM, Shawn Mi

Re: Problem with Meta inner class accessing its parent

2009-12-18 Thread Bill Freeman
set ordering to an instance, whose apparent content depends on the current language. It still might not work, if the __metaclass__ processes Meta.ordering at clas definition time. You have the source code. Bill On Fri, Dec 18, 2009 at 6:07 AM, Kevin Renskers wrote: > Hi, > > I am having a

Re: Directories inside app directory

2009-12-18 Thread Bill Freeman
On Thu, Dec 17, 2009 at 5:02 AM, bruno desthuilliers wrote: ... > > [1] currently 970 LOCs, and I just have the basic models structures > and only one custom manager defined yet, so I know there will be more > to come. YMMV but I don't like modules growing much bigger than 1 to > 1.5 KLOC. In gen

Re: Custom Django-Admin commands

2009-12-22 Thread Bill Freeman
If you are calling this from, for example, crontab note that each line in crontab is executed in its own subshell, so you have the choice of setting PYTHONPATH, or (my personal favorite because it works with so many kinds of scripts) you can cd to the project directory and execute the script as ./m

Re: Does Django support sockets of type SOCK_STREAM for full-duplex communication with a client?

2009-12-22 Thread Bill Freeman
You can fun a separate process to do this. It should probably be written as a manage.py extension to make access to the DB via the ORM as painless as possible. This way the web server thread is not tied up and can handle requests. The saves to the database (that I presume you're not showing) and

Re: i18n: date translation in Python

2009-12-22 Thread Bill Freeman
My first guess is that you create a custom template tag that rebinds the language while rendering its content, then restores it when it returns. On Tue, Dec 22, 2009 at 3:29 AM, Baurzhan Ismagulov wrote: > Hello Itay, > > On Tue, Dec 22, 2009 at 10:01:12AM +0200, Itay Donenhirsch wrote: >> Maybe

Re: Newbie help with namespaces in urls.py

2009-12-23 Thread Bill Freeman
Do you have an __init__.py file in zombie_django/battleships ? It is allowed to be empty, but it must be there for python to consider the folder to be a "package" (folder of modules and sub-packages). See the documentation and tutorials at python.org On Wed, Dec 23, 2009 at 7:29 AM, Martyn wrot

Re: Unicode name of field in form

2009-12-23 Thread Bill Freeman
I think that you need to pass the label as the "label" argument to forms.CharField: field = forms.CharField(label="Ø") or: field = forms.CharField(label=smart_unicode("Ø")) On Wed, Dec 23, 2009 at 9:54 AM, Andrij Skalyuk wrote: > I am trying to create field in form with name "Ø" (specia

Re: super() argument 1 must be type, not None

2009-12-23 Thread Bill Freeman
Are you sure that Lid is defined in this context? Try putting: import pdb;pdb.set_trace() before the super and check. On Wed, Dec 23, 2009 at 10:41 AM, TiNo wrote: >> I am overriding a save function of a model with the following code: >> >>     def save(self, *args, **kwargs): >>         if (n

Re: Unicode name of field in form

2009-12-23 Thread Bill Freeman
ers for names of fields, because > it is easy to manage without any replacement. > > On Dec 23, 5:51 pm, Bill Freeman wrote: >> I think that you need to pass the label as the "label" argument to >> forms.CharField: >> >>    field = forms.CharField(label=

Re: How do you rollback a transaction outside the context of a request?

2010-04-15 Thread Bill Freeman
Yes. I saw that in the implementation of django.db.transaction.rollback(). I hesitate to use "private" methods, but since it's an odd requirement, I may well go this way. Thanks, Bill On Wed, Apr 14, 2010 at 7:25 PM, Joe wrote: > On Apr 14, 6:15 pm, Bill Freeman wrote: &

Re: How do you rollback a transaction outside the context of a request?

2010-04-15 Thread Bill Freeman
How does this apply when there is no request? I'm not following you. Bill On Thu, Apr 15, 2010 at 4:20 AM, Thomas Guettler wrote: > Hi, > > here is the way I do it: I use the TransactionMiddleware. Every request gets > commited or rollbacked (A of ACID (atomar)). > >

  1   2   3   4   5   6   7   8   9   10   >