Re: [django-announce] Django security releases issued: 3.2.1, 3.1.9 and 2.2.21

2021-05-07 Thread Ned Batchelder
): >     raise SuspiciousFileOperation("File name '%s' includes path elements" % name) Is this level of strictness necessary? --Ned. On 5/4/21 4:54 AM, Carlton Gibson wrote: Details are available on the Django project weblog: https://www.djangoproject.com/webl

Re: Django template coverage

2015-09-24 Thread Ned Batchelder
This plugin won't work with Jinja2 templates, but another coverage.py plugin could be written for Jinja2, sure. Get in touch if you want to get started on it. --Ned. On 9/20/15 9:45 AM, Avraham Serour wrote: would this work with jinja2 templates also? On Tue, Aug 25, 2015 at 3:45 AM

Django template coverage

2015-08-24 Thread Ned Batchelder
ement of templates: https://pypi.python.org/pypi/django_coverage_plugin Install it, run your tests under coverage.py, and you'll see what lines in your templates are used by your tests, and which lines are not. If you have any trouble with it, let me know, --Ned. -- You received th

Django 1.4 (LTS) end of life?

2015-06-26 Thread Ned Horvath
ommitters gratefully accepted. Ned Horvath Python Production Environment lead UT Austin -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubsc

Re: makemessages failing to extract all strings from Javascript

2011-04-12 Thread Ned Batchelder
et it into Django 1.3.1, but I'm encountering resistance to that idea. If you have any sway over Django core committers, use your power for good now! :) --Ned. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this gr

Re: How to "convert" data of anonymous users who then sign up

2009-10-13 Thread Ned Batchelder
do on the site. If later they sign up and provide you with their identity, you simply record that on the User record, and nothing else has to be affected. --Ned. http://nedbatchelder.com --~--~-~--~~~---~--~~ You received this message because you are subscribed

Re: Moving the .py(c|o) files out of the app?

2009-09-27 Thread Ned Batchelder
just for this purpose: $ python -m compileall . will search the tree rooted in the current directory for .py files newer than their .pyc files, and compile them. --Ned. http://nedbatchelder.com Christophe Pettus wrote: > This is more a deployment question, but: Is there a way of specifyi

Re: issue when creating new project on windows

2009-06-05 Thread Ned Batchelder
mysite --Ned. http://nedbatchelder.com grimmus wrote: > Hi, > > I am trying to run the following in dos > > django-admin.py startproject mysite > > When it press enter, the django-admin.py file opens in notepad and the > script isnt executed ?? > > Any ideas why this is

Re: RE searches using sqlite3 on server failing

2009-05-17 Thread Ned
t; On Sun, May 17, 2009 at 5:20 PM, Ned wrote: > > > I would greatly appreciate any explanations or suggested > > courses of action to get to the bottom of the problem described below. > > If more information would be helpful I'd be glad to supply it. I'm > >

RE searches using sqlite3 on server failing

2009-05-17 Thread Ned
I would greatly appreciate any explanations or suggested courses of action to get to the bottom of the problem described below. If more information would be helpful I'd be glad to supply it. I'm using Django 1.0. I have a search application, in prototype stage, that makes use of regular expressio

Re: Decoding django user password

2009-04-29 Thread Ned Batchelder
superuser password) and then log the user in. More details here: http://stackoverflow.com/questions/263367/how-do-you-support-a-web-app-with-hashed-or-encrypted-passwords --Ned. http://nedbatchelder.com Miguel wrote: > Hello, > > is there any way to decode the passwords that django keeps t

Re: Sending a filtered array to HTML

2009-03-14 Thread Ned Batchelder
This is a Python question. Python doesn't have "arrays", you are using lists. Lists are indexed only by integers. What you want is a dictionary, which can be indexed by any value. Change your first line to: people = {} and you should be all set. --Ned. http://nedbatc

Re: Manually parsing a URL and returning the view name and args

2009-02-27 Thread Ned Batchelder
h results to continue working in the future also? --Ned. http://nedbatchelder.com Andrew Ingram wrote: > Hi All, > > I'm trying to to build a model which can store a link to any page on > the site. Ordinarily I'd just use a URLField, but I want to future- > proof it. Inst

Re: Docstring documentation

2009-02-27 Thread Ned Batchelder
Inside a function, the function is known by its own name. Just as you can call a function recursively by name, you can access its properties by name: def myview(request): """ My docstring """ help = myview.__doc__ --Ned. motard wrote: >

Re: Beginner URL question.

2009-02-20 Thread Ned Batchelder
You could try using a tag to explicitly state what the base for relative URLs should be. --Ned. http://nedbatchelder.com JoeG wrote: > I've tried to find this on Google but I don't know the terminology so > I don't know what to search for. It's more of an html qu

Re: No module named PIL - Django - Gae

2009-02-06 Thread Ned Batchelder
You aren't showing enough of your code, but there's no module named PIL. When you install PIL, you get a module named Image. --Ned. Edgard Matos wrote: > Hi! > > I'm trying to do a form to upload a image using Google App Engine + > Django. > In my view,

Re: charts in django

2009-01-29 Thread Ned Batchelder
Pygooglechart is a good interface to the Google charting API: http://pygooglechart.slowchop.com/ --Ned. http://nedbatchelder.com Chris Haynes wrote: > I need to generate some line charts and bar graphs from django. I > recall seeing a very promissing package a couple months ago and

Re: Multithreaded development server

2009-01-28 Thread Ned Batchelder
e explain the connection reset, then we could all get beyond the mud-slinging. --Ned. http://nedbatchelder.com Almad wrote: > On 28 Led, 06:01, Malcolm Tredinnick wrote: > >> On Tue, 2009-01-27 at 06:21 -0800, Almad wrote: >> >>> On Jan 26, 1:19 am, Russell

Re: Using dinamically created tables

2009-01-24 Thread Ned Batchelder
m to solve here? Relational databases really are quite good at what they do, it's unusual cases where you have to help them with partitioning and the like. --Ned. Alessandro Ronchi wrote: > One simple solution for my problem is table partitioning. Both MySQL > and PosgreSQL can hand

Re: Using dinamically created tables

2009-01-23 Thread Ned Batchelder
st of Django has been built to do a good job with this model. Trying to create new tables as you propose is going against the grain at every level. --Ned. http://nedbatchelder.com Alessandro Ronchi wrote: > I need to start a project with thousand of tuples every day for N > solar plants.

Re: ELSE condition not working

2009-01-18 Thread Ned Batchelder
se If you change "if delete" to "elif delete", it will work the way you want. You code is first checking for edit, then checking for delete, and the else only applies to the "if delete". In the edit case, "if delete" is false, so of cou

Re: parameter not getting passed to view function

2008-11-24 Thread Ned Batchelder
Your URL regex is wrong, it should be: (r'^hello/(?P\S+)/$', 'swamiji.poll.views.hello') --Ned. http://nedbatchelder.com mahesh_aka_amol wrote: > Parameter not getting passed to view function > > upon accessing http://localhost:8000/hello/TEST it merely p

Re: dynamic method calling

2008-11-23 Thread Ned Batchelder
getattr is definitely preferable to self.__class__.__dict__ --Ned. http://nedbatchelder.com Henry Andrews wrote: > I've aways been under the impression that direct use of __dict__ was > discouraged. Something along the lines of __dict__ being an > implementation detail while getat

Re: Subtle Memory Leak Finally Found! (DEBUG is off)

2008-11-18 Thread Ned Batchelder
Are you using MySQL? It's been implicated in these sorts of issues before: http://nedbatchelder.com/blog/200809/a_server_memory_leak.html --Ned. http://nedbatchelder.com 7timesTom wrote: > Some time ago Webfaction notified me "Memory usage over your > limit" (80MB) It&#x

Re: Different settings.py files for server and development

2008-10-23 Thread Ned Batchelder
And BTW, my bad. Change the except: line to except ImportError, then the syntax error from the dash will be apparent in your 500 page. --Ned. http://nedbatchelder.com Ned Batchelder wrote: > settings-custom isn't a valid Python file name, because a Python > identifier can't h

Re: Different settings.py files for server and development

2008-10-23 Thread Ned Batchelder
settings-custom isn't a valid Python file name, because a Python identifier can't have a dash in it. Use an underscore. --Ned. http://nedbatchelder.com Dana wrote: > Ned/Felix, > > Ok, I tried your guys solution but it does not seem to be working for > me, so Im wo

Re: Different settings.py files for server and development

2008-10-23 Thread Ned Batchelder
In settings.py: try: from settings_local import * except: pass --Ned. http://nedbatchelder.com Dana wrote: > Hello everyone, > > I know a form of this question has been asked before on this group but > I can't for the life of me find the thread. >

Re: setting a 'default' filter for templates

2008-10-23 Thread Ned Batchelder
h build your context... return render_special(context) --Ned. http://nedbatchelder.com Dennis Schmidt wrote: > Hi there, > > I need to get every variable that will be printed out in my templates > to be passed through a special function. > Since I need this function globally and my

Re: Console output

2008-10-19 Thread Ned Batchelder
hem. Your other option is to change where sys.stdout points, but that will change it for the entire process, which may not be what you want. --Ned. http://nedbatchelder.com Bob Cowdery wrote: > I didn't say I was using it in production. This is development and I > would prefer not to

Re: Getting lists/dictionaries out of the database

2008-10-18 Thread Ned Batchelder
roduction code, but when you're digging in the database forensically, it can be useful. OTOH, pickling will be more compact, and safer, depending on how you reconstitute it... --Ned. http://nedbatchelder.com Eric Abrahamsen wrote: > On Oct 18, 2008, at 4:38 AM, timc3 wrote: > >

Re: Getting lists/dictionaries out of the database

2008-10-17 Thread Ned Batchelder
field, he could add "[os.system('rm -rf /etc')]" to it, and a full eval would cause havoc, for example. --Ned. http://nedbatchelder.com timc3 wrote: > Thanks for the help. Yeah, my terminology is quite often wrong, to > much context switching with other things. > &g

Re: Memory leak!

2008-10-16 Thread Ned Batchelder
If you have DEBUG = True, then the SQL for the queries against the database are collected for debugging purposes. That can consume a lot of memory (especially for 800k+ records). Could that be the problem? --Ned. http://nedbatchelder.com bcrem wrote: > Hi all, > > I've got

Re: How to render a static html page and keep processing after?

2008-09-15 Thread Ned Batchelder
that isn't being served directly to a browser. --Ned. http://nedbatchelder.com emy_66 wrote: > Hello, > > I'm new to web development and I am not sure how to code for this: > > Displaying an html page straight away after the user hits submit > (telling the user that th

Re: Django questions

2008-09-10 Thread Ned Batchelder
Your view functions are simply Python functions. However you want to use Python to compute an HTML response is fine. Most people choose to use the template engine for that, but you can do whatever you like: def hello_world(request): return HttpResponse("Hello, world") -

Re: Double Slash in URL

2008-09-08 Thread Ned Batchelder
This isn't true: forward slashes are not meaningful in Python regular expressions, and so do not need to be escaped. Even if you choose to (it doesn't hurt), you'd escape them with backslashes, not forward slashes. --Ned. http://nedbatchelder.com James Matthews wrote: > It&

Re: interacting django with external programs

2008-09-07 Thread Ned Batchelder
ery for work at all: chances are really good that the work itself will be far larger than the effort to find the work. And no, I don't have any concrete examples... --Ned. David wrote: > Thanks Ned, and what about the case when it may be an unreasonable > interval? > is there any oth

Re: interacting django with external programs

2008-09-06 Thread Ned Batchelder
the work is in your Python code. --Ned. http://nedbatchelder.com David wrote: > Hey'a I have a newbie question. > > I want to execute an external (lets say python, but can be any) > program given a interval set by a user (which would be in the user > table). The external pr

Re: django and sql databases

2008-09-03 Thread Ned Batchelder
eing generated. If they all have the same schema, then "dynamically generated tables" means you are going against the grain of a relational database. You will likely be much happier adding one more column to your table and using one statically defined table to hold all

Re: Dreamhost now supports Django

2008-07-17 Thread Ned Batchelder
"credits" or "license" for more information. >>> import MySQLdb >>> MySQLdb.version_info (1, 2, 1, 'gamma', 3) >>> --Ned. http://nedbatchelder.com Malcolm Tredinnick wrote: > On Fri, 2008-07-18 at 01:37 +0530, Ramdas S wrote: >

Re: Modulo of 4 not working right

2008-07-16 Thread Ned Batchelder
People here are right: remove the "not". You want to keep adding blanks until the total length is zero mod 4. Then, at line 19 in the dpaste, change the loop to: for blank in range(amountofblanks). You shouldn't be subtracting one from the value there. --Ned. http://ne

Re: escape filter

2008-07-15 Thread Ned Batchelder
ic, so you may not need it at all. --Ned. http://nedbatchelder.com Fernando Rodríguez wrote: > Hi, > > I'm using this simple template with flatpages: > > > > {{ flatpage.title|escape }} > > > > {{flatpage.title|esc

Re: Markup languages vs HTML

2008-07-08 Thread Ned Batchelder
omfortable editing Markdown, then use that. The user experience concerns are far more important, and will dictate the data storage. --Ned. http://nedbatchelder.com Matic Žgur wrote: > Hi, > > I'm working on some project, a part of which is a small blog app. All > the blog pos

Re: Markup languages vs HTML

2008-07-08 Thread Ned Batchelder
omfortable editing Markdown, then use that. The user experience concerns are far more important, and will dictate the data storage. --Ned. Matic Žgur wrote: > Hi, > > I'm working on some project, a part of which is a small blog app. All > the blog posts are saved as HTML (usi

Re: Sort a list of objects by an attribute of the objects

2008-07-08 Thread Ned Batchelder
This is a bit more complicated than you need. This will work: def sort_by_attr_inplace(seq, attr): import operator seq.sort(key=operator.attrgetter(attr)) --Ned. http://nedbatchelder.com joshuajonah wrote: > Resolved. > > Answer for those interested: > &

Re: "Eval" in templates?

2008-07-05 Thread Ned Batchelder
gument to the include tag doesn't need to be a literal string, it can be a value from the context. This has the added advantage that the common "{% include " in each of your button choices is factored out and appears only once, in blah.html. --Ned. http://nedbatchelder.com Ben Kovi

Re: python strings containing backslashes

2008-06-29 Thread Ned Batchelder
a single backslash here either: >>> r'\\' '' >>> r'\' File "", line 1 r'\' ^ SyntaxError: EOL while scanning single-quoted string >>> --Ned. Leeland (The Code Janitor) wrote: > I would use a raw strin

Re: Add db tables on-the-fly

2008-06-22 Thread Ned Batchelder
Creating a table per user is definitely going against the grain in a relational database world. You'll be much happier with one table to store the data across users, with a foreign key to the users table to keep everything straight. --Ned. http://nedbatchelder.com MickaelC wrote: > I

Re: iterate over alphabet in template

2008-06-17 Thread Ned Batchelder
If you wanted to keep the alphabet issue out of the view, you could also do this: {% for letter in "ABCDEFGHIJKLMNOPQRSTUVWXYZ" %} --Ned. http://nedbatchelder.com M.Ganesh wrote: > Joel Bernstein wrote: > >> For an easy (but locale-dependent) way to get a list of the u

Re: newbie: Filter an inclusion tag

2008-06-16 Thread Ned Batchelder
I think this will work: {% filter truncatewords:10 %} {% i18n_attr auction 'description' LANGUAGE_CODE %} {% endfilter %} --Ned. http://nedbatchelder.com pihentagy wrote: > Hi all! > > I have an inclusion tag: > {% i18n_attr auction 'description' L

Re: Try Except Statement not working properly.

2008-05-21 Thread Ned Batchelder
f the loop is a new transaction, limiting the damage when an update fails, 2) clean your data before entering the loop so there won't be a uniqueness violation, 3) write a Python check against the uniqueness so that you won't attempt an update that would fail. --Ned. Greg wrote: >

Re: google search results, returned to your site?

2008-04-16 Thread Ned Batchelder
ld be able to at least keep it all within your chrome. --Ned. http://nedbatchelder.com Jeff Anderson wrote: > visitorQ wrote: > >> i'm familiar with the google search feature that allows you to search >> the contents of a particular site by adding "site: www.targets

Re: alternative to (r'^house/edit/(\d+)/$',ediHouse)?

2008-04-12 Thread Ned Batchelder
You are talking about security through obscurity, which is no security at all. --Ned. ydjango wrote: > Thanks, I will use Slug, which will be unique and alphanumeric but > will not be sequential. > > I agree best protection is proper authorization, and that I check on > ea

Re: alternative to (r'^house/edit/(\d+)/$',ediHouse)?

2008-04-11 Thread Ned Batchelder
have suggested. --Ned. http://nedbatchelder.com/blog ydjango wrote: > I am displaying a list of houses and on clicking on one of the houses > I want to show/edit details > > currently I am using constructing url as /house/edit/123/ > where 123 is house data base primary key for that hou

Re: Best practice for databases and distributed development with Django

2008-04-03 Thread Ned Batchelder
I'm surprised to see this suggestion of storing a SQLite db in version control. Don't you quickly run into problems where two developers each write new data to the database, and then cannot merge their changes? Or do you have a read-only database? --Ned. http://nedbatchelder.com/b

Re: sys.path question

2008-03-29 Thread Ned Batchelder
They are not meant to be the same. Windows' PATH is the list of directories Windows will search for executables when running a command from the command line. Python's sys.path is the list of directories Python will search for modules to import. --Ned. http://nedbatchelder.com/

Re: How are you storing binary data in db

2008-03-28 Thread Ned Batchelder
pet, and the last in the last. --Ned. http://nedbatchelder.com/blog shabda wrote: > Yes I was looking for snippets and recipes, not storing them in DB. > There are some instances when storing things in DB is just too > convinient comaring to storing them on files. For example I get so

Re: OT: Django logo

2008-03-25 Thread Ned Batchelder
en text would be in different faces, but there you are. --Ned http://nedbatchelder.com/blog Alvaro Mouriño wrote: > On Tue, Mar 25, 2008 at 10:02 PM, Justin Lilly <[EMAIL PROTECTED]> wrote: > >> whatthefont.com couldn't find a good match. >> >> > I didn

Re: A Python question

2008-03-24 Thread Ned Batchelder
return some_html_content It's one more line than you are looking for, but is simple, and everyone will understand it, and you don't have to find something complicated: it works. --Ned. http://nedbatchelder.com/blog Julien wrote: > In fact, what I want is to hijack a view: >

Re: A Python question

2008-03-24 Thread Ned Batchelder
o template). Maybe if you told us a bit more about the problem, we could help you find a solution. --Ned. http://nedbatchelder.com/blog Julien wrote: > Hi all, > > This is more a Python issue than a Django one, but I thought the > Python-aware people that you are might be able to help

Re: Using HttpResponse as a file - 'HttpResponse' object has no attribute 'seek' error

2008-02-21 Thread Ned Batchelder
d. As Malcolm points out, seek() would require buffering, which you can provide by using an intermediary like StringIO. --Ned. http://nedbatchelder.com/blog Malcolm Tredinnick wrote: > On Thu, 2008-02-21 at 03:41 -0800, kip wrote: > >> I thought I would be able to use an HttpRespon

Re: Domain Parsing Question

2008-02-18 Thread Ned Batchelder
information are you trying to get from the domain? --Ned. http://nedbatchelder.com/blog Dave Fowler wrote: > This doesn't have a lot to do with django, but python and web > programming. > > I'm having an issue parsing the sub domain from a lot of non-US urls. > In the US the

Re: is_secure() behind reverse proxy

2008-02-18 Thread Ned Batchelder
://nedbatchelder.com/blog/200710/httphttps_transitions_and_relative_urls.html --Ned. [EMAIL PROTECTED] wrote: > Does anyone have suggestions on how to make request.is_secure() work > from behind a reverse proxy? I have nginx proxying to apache but since > nginx (and not apache) is handling SSL the HTTPS en

Re: About to give up!!!

2008-02-09 Thread Ned Batchelder
t. That would have shown that the image URL was in fact returning HTML. One more thing: Use firebug if you can. It's a great developer tool, and could show you the result of the img retrieval. --Ned. http://nedbatchelder.com/blog Marty Alchin wrote: > On 2/9/08, Brandon Taylor <[EMA

Re: Best way to template "," and "and" separated lists?

2008-02-07 Thread Ned Batchelder
er for n. The nth tag doesn't exist yet, but does it look like what you are asking for? --Ned. http://nedbatchelder.com/blog toomim wrote: > On Feb 6, 11:05 pm, toomim <[EMAIL PROTECTED]> wrote: > >> I don't understand, how do I get {{sep}} to change from ',&

Re: template: how to make use of forloop.counter0

2008-02-04 Thread Ned Batchelder
proper CSS attributes, you get the idea.) --Ned. http://nedbatchelder.com/blog Michael Hipp wrote: > David Reynolds wrote: > >> On 3 Feb 2008, at 3:32 pm, Michael Hipp wrote: >> >> >>> Malcolm Tredinnick wrote: >>> >&g

Re: problems with custom template library

2008-02-03 Thread Ned Batchelder
like the blog_extras.py imports do. --Ned. [EMAIL PROTECTED] wrote: > Hi Ned, > > I figured as much, but since without the 'try' made no difference, I > thought I'd give it a whirl here is the source. > 'lukenslanguages' is the project directory. >

Re: problems with custom template library

2008-02-03 Thread Ned Batchelder
When Kenneth suggested "try: @register.filter", he meant, try: "@register.filter", that is, the word "try:" was not meant to go in the file. You may have an import problem in your models file. Can you post more of the source so that we can take a look? --Ned.

Re: Template help, gotta be simple

2008-02-02 Thread Ned Batchelder
I'm not sure there's a way to do this purely in the template language. You can munge the data in the view instead. This line creates a new filtered_data list that has only the data you want to display: filtered_data = [ dict([ (k,d[k]) for k in fields ]) for d in data ] -

Re: multiple function arguments

2008-01-27 Thread Ned Batchelder
with three arguments, and looks like it is called with only two, but there are actually three: foo, 1, and 2. --Ned. http://nedbatchelder.com/blog road wrote: > This may be more of a python question rather than django, but I > figured it could be answered here. > > I'm getting a type

Re: pdf/Firefox and turning off GZipMiddleware

2008-01-25 Thread Ned Batchelder
We just ran into this problem also. It's reported in ticket 6027: http://code.djangoproject.com/ticket/6027 GzipMiddleware and responses with files for content (rather than strings) don't get along... --Ned. [EMAIL PROTECTED] wrote: > I've been tearing my hair out for a l

Re: Trouble with pattern in urls.py

2008-01-23 Thread Ned Batchelder
I don't know if the URL you show is literally what you hit or not. If it is, then it doesn't match because "param1" doesn't match "\d+" which means one or more digits. Same for param2. --Ned. almostvindiesel wrote: > Hi all, > > I'm new to re

Re: best practices for a production site

2008-01-19 Thread Ned Batchelder
. Only when you have a fix that needs to leapfrog ahead of the feature work do you need to merge anything. --Ned. http://nedbatchelder.com Kenneth Gonsalves wrote: > On 18-Jan-08, at 9:54 PM, William Siegrist wrote: > > >> If the spelling changes are in 1 file, and the ne

Re: template for loop problems

2008-01-13 Thread Ned Batchelder
You don't need {{ }} within the {% for .. %} tag. Try simply {% for tmpDict in assayDict.methods %} --Ned. http://nedbatchelder.com/blog [EMAIL PROTECTED] wrote: > Hello All, > > I'm running into a little trouble using the template system of > django. > In python i

Re: The timeuntil / timesince filter doesn't handle time objects -- was that a design decision, or was that something that got overlooked?

2008-01-08 Thread Ned Batchelder
I would think we can make a reasonable semantic that using timesince or timeuntil on a time object means that time, today. Joe, is that what you expected it to mean? Making this change to the filter would turn what is now an error condition into something useful. --Ned. http

Re: Printable article page URLs?

2008-01-03 Thread Ned Batchelder
D'oh! Sorry. I hate those kind of replies! (At least I also contributed answering the asked questions in another post...) --Ned. Tim Chase wrote: >> You could try not serving a different page at all: CSS can >> apply a different stylesheet when printing than when on the &g

Re: Printable article page URLs?

2008-01-02 Thread Ned Batchelder
I also like /articles/slug/print, in that print modifies the articles/slug url that precedes it. Also, you can prevent robot spidering other ways than robots.txt. A tag in the served content can direct the robot as well: see http://www.robotstxt.org/meta.html --Ned. http

Re: Printable article page URLs?

2008-01-02 Thread Ned Batchelder
You could try not serving a different page at all: CSS can apply a different stylesheet when printing than when on the screen. See http://www.alistapart.com/stories/goingtoprint/ for an introduction. --Ned. http://nedbatchelder.com Alex Koshelev wrote: > The second variant with GET query

Re: How to create an "iffirst" tag?

2008-01-02 Thread Ned Batchelder
I may be the only one still interested in this, but the patch got incorporated yesterday (http://code.djangoproject.com/changeset/6981), so Malcolm, your original idea will now work. --Ned. Ned Batchelder wrote: > I tried out this change, and it works well. I've created a ticket

Re: How to create an "iffirst" tag?

2008-01-01 Thread Ned Batchelder
I tried out this change, and it works well. I've created a ticket (http://code.djangoproject.com/ticket/6295) with a patch. --Ned. http://nedbatchelder.com Ned Batchelder wrote: > Malcolm, thanks for continuing this (I was away for a few days). I > was thinking about the forloop i

Re: How to create an "iffirst" tag?

2007-12-31 Thread Ned Batchelder
ly works if the ifchanged tag is evaluated on every iteration of the loop. --Ned. Malcolm Tredinnick wrote: > Hey Ned, > > On Sat, 2007-12-29 at 08:27 +1100, Malcolm Tredinnick wrote: > [...] > >> def render(self, context): >>if co

Re: How to create an "iffirst" tag?

2007-12-28 Thread Ned Batchelder
#x27;s the first time in the if clause: {% for thing in mylist %} {% if thing.test %} {% iffirst %}Things: {% else %}, {% endiffirst %} {{thing}} {% endif %} {% endfor %} --Ned. Malcolm Tredinnick wrote: > On Fri, 2007-12-28 at 15:36 -0500, Ned Batc

Re: How to create an "iffirst" tag?

2007-12-28 Thread Ned Batchelder
ve to loop over the posts in the view, and annotate each with a filtered list of tags. I'm already looping in the template, and don't need to loop in the view at all except to perform this filtering. To me, this is kind of ugly. Do-able, but unfortunate. --Ned. Todd O'Bryan wr

Re: How to create an "iffirst" tag?

2007-12-28 Thread Ned Batchelder
Just a matter of taste. I suppose filtering in the view would be the simplest way to achieve what I'm looking for. For my own edification: is there a way to write an iffirst tag? I often wish for it. --Ned. Todd O'Bryan wrote: > On Dec 28, 2007 2:46 PM, Ned Batchelder <

How to create an "iffirst" tag?

2007-12-28 Thread Ned Batchelder
will be messed up even if I do have this tag: the comma will have space before it). So, two questions: 1) How would I create a tag like this, and 2) is there some simpler way to achieve my purpose? --Ned. -- Ned Batchelder, http://nedbatchelder.com --~--~-~--~~~-

Re: Passing a dictionary as a query argument?

2007-12-17 Thread Ned Batchelder
ides some guarantee about the equivalency of pickles, but I don't think so. --Ned. http://nedbatchelder.com/blog [EMAIL PROTECTED] wrote: > I fixed this -- not Django's fault at all. For the full field code, go > to http://www.djangosnippets.org/snippets/513/ > > On Dec 13, 8:

Re: How to modify every element in a list all at once

2007-12-15 Thread Ned Batchelder
for s in s2: s.price *= .9 --Ned. Greg wrote: > Hello, > I have the following list: > > [, )>, Small'>, )>, , )>, > , )>, , > )>] > > In my view I want to be able to modify the Price of each element. I > want to times the price of each

Re: Tableless models?

2007-12-13 Thread Ned Batchelder
class and do whatever you want with it. For example, you can write a view function that pulls data from wherever you want (an RSS feed, a file on disk, a random number generator), then formats it as HTML and returns it to the browser. There's no need for a database to be involved. --Ned.

Re: Prevent SQL-injection

2007-12-08 Thread Ned Batchelder
n't doing. Perhaps if you included some more context of your problem... --Ned. http://nedbatchelder.com/blog Nianbig wrote: > > On Dec 9, 12:57 am, "Karen Tracey" <[EMAIL PROTECTED]> wrote: > >> On Dec 8, 2007 5:58 PM, Nianbig <[EMAIL PROTECTED]>

Re: Combating submission form Spam

2007-12-06 Thread Ned Batchelder
I have been hoping, but not managing, to find the time to create a Django implementation of my anti-spam technique: Stopping Spambots with hashes and honeypots (http://nedbatchelder.com/text/stopbots.html). It works very effectively without any extra work on the part of real humans. --Ned

Re: Memcached Shared Caching - What if one of the servers drops out?

2007-12-03 Thread Ned Batchelder
help here: the client library always thinks of the servers as a pool. If you only have one server, you'll still be running all the same code, and if for some reason that server becomes unreachable, you'll likely have the same error in the client library, plus you won't have any cach

Re: making two-column table from one-column data

2007-12-02 Thread Ned Batchelder
for d in data %} {% if d.firstcol %}{% endif %} {{d}} {% if d.lastcol %}{% endif %} {% endfor %} {% for blank in data_blanks %} {% endfor %} {% if data_blanks %}{% endif %} --Ned. http://nedbatchelder.com andrej kesely wrote: >

Re: Django's doctest clashes with coverage.py

2007-11-25 Thread Ned Batchelder
You're quite welcome. One other thing I forgot to mention: nosetest.py has a --with-coverage option, and Django support. I've used it to coverage test my Django code. --Ned. Marcin Kaszynski wrote: > > On Nov 25, 3:58 am, "Russell Keith-Magee" <[EMAIL PROTECTED]&

Re: Django's doctest clashes with coverage.py

2007-11-24 Thread Ned Batchelder
Please use coverage.py, I would be honored to have it included in Django core. If it's better as an add-on of some sort, that's great too. Let a thousand flowers bloom! --Ned. Todd O'Bryan wrote: > On Nov 24, 2007 9:58 PM, Russell Keith-Magee <[EMAIL PROTECTED]>

Re: keeping SECRET_KEY secret

2007-11-02 Thread Ned Batchelder
st proposal: at the top of the generated settings file, include this comment along these lines: # This file contains settings which should be kept secret. # For ideas on how to manage complex settings files, # see: http://code.djangoproject.com/wiki/SplitSettings --Ned. Malcolm Tredinnick wrote:

Re: URL dispatcher with filter

2007-08-26 Thread Ned Batchelder
url raise Http404 @login_required def foo(request, cid): c = get_allowed_c(request, cid) # Do whatever you want with c... This means that each view function has a single line in common with the others, just as it used to before your access checking. --Ned. Tim Chase wrote

Re: generating PDF using Reportlab's SimpleDocTemplate

2007-08-23 Thread Ned Batchelder
You can probably skip the StringIO. HttpResponses support a file-like interface, so you can write directly to them. Try passing the HttpResponse directly to the SimpleDocTemplate constructor instead. --Ned. http://nedbatchelder.com/blog abrightwell wrote: > Nevermind, the main proble

Re: Developing and testing a model mixin

2007-08-12 Thread Ned
On Aug 12, 4:35 am, "Russell Keith-Magee" <[EMAIL PROTECTED]> wrote: > This is one approach - another would be an abstract base class. Great. > The simplest approach would be to write a simple test app, use the > normal Django test framework on that app, and then not install/include > that test

Developing and testing a model mixin

2007-08-11 Thread Ned
I'm new to Django and fairly new to Python. I'm developing an add-in for using for using models as nested set trees* At the moment it's a mixin class which provides methods such as parent(), descendants(), depth() etc. for examining the tree, and move_to() for relocating a node within the tree.

Re: Random character in rendered HTML

2007-07-23 Thread Ned Batchelder
hexdump utility can be helpful here to see what is really in the files. Even "simple text editors" interpret byte sequences for you to display text, and can hide information that might be important in this case. --Ned. brutimus wrote: > I've been having this problem w

Re: regex in url

2007-07-17 Thread Ned Batchelder
For a quick answer: (?Pxxx) means: "match xxx, and store it as a value named blah in the result". This lets the regex machinery build a set of name/value pairs suitable for use as arguments to a view function. --Ned. james_027 wrote: > hi kenneth, > > thanks a lot, i thin

  1   2   >