Permalink
Browse files

Imported Django from private SVN repository (created from r. 8825)

git-svn-id: http://code.djangoproject.com/svn/django/trunk@3 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
1 parent 07ffc7d commit ed114e15106192b22ebb78ef5bf5bce72b419d13 @adrianholovaty adrianholovaty committed Jul 13, 2005
Showing with 13,851 additions and 0 deletions.
  1. 0 django/__init__.py
  2. 0 django/bin/__init__.py
  3. +15 −0 django/bin/daily_cleanup.py
  4. +412 −0 django/bin/django-admin.py
  5. 0 django/bin/profiling/__init__.py
  6. +34 −0 django/bin/profiling/gather_profile_stats.py
  7. +22 −0 django/bin/profiling/handler.py
  8. +45 −0 django/bin/setup.py
  9. +36 −0 django/bin/validate.py
  10. 0 django/conf/__init__.py
  11. 0 django/conf/app_template/__init__.py
  12. +1 −0 django/conf/app_template/models/__init__.py
  13. +3 −0 django/conf/app_template/models/app_name.py
  14. 0 django/conf/app_template/urls/__init__.py
  15. +5 −0 django/conf/app_template/urls/app_name.py
  16. 0 django/conf/app_template/views/__init__.py
  17. +199 −0 django/conf/global_settings.py
  18. 0 django/conf/project_template/__init__.py
  19. 0 django/conf/project_template/apps/__init__.py
  20. 0 django/conf/project_template/settings/__init__.py
  21. +31 −0 django/conf/project_template/settings/main.py
  22. +42 −0 django/conf/settings.py
  23. 0 django/conf/urls/__init__.py
  24. +56 −0 django/conf/urls/admin.py
  25. +6 −0 django/conf/urls/admin_password_reset.py
  26. +12 −0 django/conf/urls/comments.py
  27. +17 −0 django/conf/urls/defaults.py
  28. +5 −0 django/conf/urls/flatfiles.py
  29. +19 −0 django/conf/urls/registration.py
  30. +6 −0 django/conf/urls/rss.py
  31. +5 −0 django/conf/urls/shortcut.py
  32. 0 django/core/__init__.py
  33. +255 −0 django/core/cache.py
  34. +28 −0 django/core/db/__init__.py
  35. 0 django/core/db/backends/__init__.py
  36. +107 −0 django/core/db/backends/mysql.py
  37. +109 −0 django/core/db/backends/postgresql.py
  38. +32 −0 django/core/db/base.py
  39. +42 −0 django/core/db/typecasts.py
  40. +466 −0 django/core/defaultfilters.py
  41. +743 −0 django/core/defaulttags.py
  42. +26 −0 django/core/exceptions.py
  43. +79 −0 django/core/extensions.py
  44. +759 −0 django/core/formfields.py
  45. +157 −0 django/core/handler.py
  46. +51 −0 django/core/mail.py
  47. +2,142 −0 django/core/meta.py
  48. +76 −0 django/core/paginator.py
  49. +136 −0 django/core/rss.py
  50. +488 −0 django/core/template.py
  51. +18 −0 django/core/template_file.py
  52. +142 −0 django/core/template_loader.py
  53. +96 −0 django/core/urlresolvers.py
  54. +420 −0 django/core/validators.py
  55. +22 −0 django/core/xheaders.py
  56. 0 django/middleware/__init__.py
  57. +120 −0 django/middleware/admin.py
  58. +104 −0 django/middleware/common.py
  59. +18 −0 django/middleware/doc.py
  60. +91 −0 django/models/__init__.py
  61. +290 −0 django/models/auth.py
  62. +281 −0 django/models/comments.py
  63. +107 −0 django/models/core.py
  64. 0 django/parts/__init__.py
  65. 0 django/parts/admin/__init__.py
  66. +93 −0 django/parts/admin/doc.py
  67. 0 django/parts/auth/__init__.py
  68. +48 −0 django/parts/auth/anonymoususers.py
  69. +46 −0 django/parts/auth/formfields.py
  70. 0 django/parts/media/__init__.py
  71. +6 −0 django/parts/media/photos.py
  72. +7 −0 django/templatetags/__init__.py
  73. +331 −0 django/templatetags/comments.py
  74. +45 −0 django/templatetags/log.py
  75. 0 django/tests/__init__.py
  76. +119 −0 django/tests/cache_tests.py
  77. +102 −0 django/tests/template_inheritance.py
  78. +707 −0 django/tests/template_tests.py
  79. 0 django/utils/__init__.py
  80. +171 −0 django/utils/datastructures.py
  81. +317 −0 django/utils/dateformat.py
  82. +27 −0 django/utils/dates.py
  83. +152 −0 django/utils/feedgenerator.py
  84. +110 −0 django/utils/html.py
  85. +319 −0 django/utils/httpwrappers.py
  86. +22 −0 django/utils/images.py
  87. +42 −0 django/utils/stopwords.py
  88. +108 −0 django/utils/text.py
  89. +46 −0 django/utils/timesince.py
  90. +13 −0 django/utils/xmlutils.py
  91. 0 django/views/__init__.py
  92. 0 django/views/admin/__init__.py
  93. +328 −0 django/views/admin/doc.py
  94. +1,089 −0 django/views/admin/main.py
  95. +70 −0 django/views/admin/template.py
  96. 0 django/views/auth/__init__.py
  97. +62 −0 django/views/auth/login.py
  98. 0 django/views/comments/__init__.py
  99. +347 −0 django/views/comments/comments.py
  100. +34 −0 django/views/comments/karma.py
  101. +82 −0 django/views/comments/userflags.py
  102. 0 django/views/core/__init__.py
  103. +34 −0 django/views/core/flatfiles.py
  104. 0 django/views/decorators/__init__.py
  105. +12 −0 django/views/decorators/auth.py
  106. +64 −0 django/views/decorators/cache.py
  107. +72 −0 django/views/defaults.py
  108. 0 django/views/generic/__init__.py
  109. +223 −0 django/views/generic/date_based.py
  110. +106 −0 django/views/generic/list_detail.py
  111. 0 django/views/registration/__init__.py
  112. +109 −0 django/views/registration/passwords.py
  113. 0 django/views/rss/__init__.py
  114. +12 −0 django/views/rss/rss.py
View
No changes.
View
No changes.
@@ -0,0 +1,15 @@
+"Daily cleanup file"
+
+from django.core.db import db
+
+DOCUMENTATION_DIRECTORY = '/home/html/documentation/'
+
+def clean_up():
+ # Clean up old database records
+ cursor = db.cursor()
+ cursor.execute("DELETE FROM auth_sessions WHERE start_time < NOW() - INTERVAL '2 weeks'")
+ cursor.execute("DELETE FROM registration_challenges WHERE request_date < NOW() - INTERVAL '1 week'")
+ db.commit()
+
+if __name__ == "__main__":
+ clean_up()
View

Large diffs are not rendered by default.

Oops, something went wrong.
No changes.
@@ -0,0 +1,34 @@
+"""
+gather_profile_stats.py /path/to/dir/of/profiles
+
+Note that the aggregated profiles must be read with pstats.Stats, not
+hotshot.stats (the formats are incompatible)
+"""
+
+from hotshot import stats
+import pstats
+import sys, os
+
+def gather_stats(p):
+ profiles = {}
+ for f in os.listdir(p):
+ if f.endswith('.agg.prof'):
+ path = f[:-9]
+ prof = pstats.Stats(os.path.join(p, f))
+ elif f.endswith('.prof'):
+ bits = f.split('.')
+ path = ".".join(bits[:-3])
+ prof = stats.load(os.path.join(p, f))
+ else:
+ continue
+ print "Processing %s" % f
+ if profiles.has_key(path):
+ profiles[path].add(prof)
+ else:
+ profiles[path] = prof
+ os.unlink(os.path.join(p, f))
+ for (path, prof) in profiles.items():
+ prof.dump_stats(os.path.join(p, "%s.agg.prof" % path))
+
+if __name__ == '__main__':
+ gather_stats(sys.argv[1])
@@ -0,0 +1,22 @@
+import hotshot, time, os
+from django.core.handler import CoreHandler
+
+PROFILE_DATA_DIR = "/var/log/cmsprofile/"
+
+def handler(req):
+ '''
+ Handler that uses hotshot to store profile data.
+
+ Stores profile data in PROFILE_DATA_DIR. Since hotshot has no way (that I
+ know of) to append profile data to a single file, each request gets its own
+ profile. The file names are in the format <url>.<n>.prof where <url> is
+ the request path with "/" replaced by ".", and <n> is a timestamp with
+ microseconds to prevent overwriting files.
+
+ Use the gather_profile_stats.py script to gather these individual request
+ profiles into aggregated profiles by request path.
+ '''
+ profname = "%s.%.3f.prof" % (req.uri.strip("/").replace('/', '.'), time.time())
+ profname = os.path.join(PROFILE_DATA_DIR, profname)
+ prof = hotshot.Profile(profname)
+ return prof.runcall(CoreHandler(), req)
View
@@ -0,0 +1,45 @@
+"""
+Usage:
+
+python setup.py bdist
+python setup.py sdist
+"""
+
+from distutils.core import setup
+import os
+
+# Whether to include the .py files, rather than just .pyc's. Doesn't do anything yet.
+INCLUDE_SOURCE = True
+
+# Determines which apps are bundled with the distribution.
+INSTALLED_APPS = ('auth', 'categories', 'comments', 'core', 'media', 'news', 'polls', 'registration', 'search', 'sms', 'staff')
+
+# First, lump together all the generic, core packages that need to be included.
+packages = [
+ 'django',
+ 'django.core',
+ 'django.templatetags',
+ 'django.utils',
+ 'django.views',
+]
+for a in INSTALLED_APPS:
+ for dirname in ('parts', 'templatetags', 'views'):
+ if os.path.exists('django/%s/%s/' % (dirname, a)):
+ packages.append('django.%s.%s' % (dirname, a))
+
+# Next, add individual modules.
+py_modules = [
+ 'django.cron.daily_cleanup',
+ 'django.cron.search_indexer',
+]
+py_modules += ['django.models.%s' % a for a in INSTALLED_APPS]
+
+setup(
+ name = 'django',
+ version = '1.0',
+ packages = packages,
+ py_modules = py_modules,
+ url = 'http://www.ljworld.com/',
+ author = 'World Online',
+ author_email = 'cms-support@ljworld.com',
+)
View
@@ -0,0 +1,36 @@
+from django.core import meta
+
+def validate_app(app_label):
+ mod = meta.get_app(app_label)
+ for klass in mod._MODELS:
+ try:
+ validate_class(klass)
+ except AssertionError, e:
+ print e
+
+def validate_class(klass):
+ opts = klass._meta
+ # Fields.
+ for f in opts.fields:
+ if isinstance(f, meta.ManyToManyField):
+ assert isinstance(f.rel, meta.ManyToMany), "ManyToManyField %s should have 'rel' set to a ManyToMany instance." % f.name
+ # Inline related objects.
+ for rel_opts, rel_field in opts.get_inline_related_objects():
+ assert len([f for f in rel_opts.fields if f.core]) > 0, "At least one field in %s should have core=True, because it's being edited inline by %s." % (rel_opts.object_name, opts.object_name)
+ # All related objects.
+ related_apps_seen = []
+ for rel_opts, rel_field in opts.get_all_related_objects():
+ if rel_opts in related_apps_seen:
+ assert rel_field.rel.related_name is not None, "Relationship in field %s.%s needs to set 'related_name' because more than one %s object is referenced in %s." % (rel_opts.object_name, rel_field.name, opts.object_name, rel_opts.object_name)
+ related_apps_seen.append(rel_opts)
+ # Etc.
+ if opts.admin is not None:
+ assert opts.admin.ordering or opts.ordering, "%s needs to set 'ordering' on either its 'admin' or its model, because it has 'admin' set." % opts.object_name
+
+if __name__ == "__main__":
+ import sys
+ try:
+ validate_app(sys.argv[1])
+ except IndexError:
+ sys.stderr.write("Usage: %s [appname]\n" % __file__)
+ sys.exit(1)
View
No changes.
No changes.
@@ -0,0 +1 @@
+__all__ = ['{{ app_name }}']
@@ -0,0 +1,3 @@
+from django.core import meta
+
+# Create your models here.
No changes.
@@ -0,0 +1,5 @@
+from django.conf.urls.defaults import *
+
+urlpatterns = patterns('{{ project_name }}.apps.{{ app_name }}.views',
+# (r'', ''),
+)
No changes.
@@ -0,0 +1,199 @@
+# Default Django settings. Override these with settings in the module
+# pointed-to by the DJANGO_SETTINGS_MODULE environment variable.
+
+import re
+
+####################
+# CORE #
+####################
+
+DEBUG = False
+
+# Whether to use the "Etag" header. This saves bandwidth but slows down performance.
+USE_ETAGS = False
+
+# people who get code error notifications
+ADMINS = (('Adrian Holovaty','aholovaty@ljworld.com'), ('Jacob Kaplan-Moss', 'jacob@lawrence.com'))
+
+# These IP addresses:
+# * See debug comments, when DEBUG is true
+# * Receive x-headers
+INTERNAL_IPS = (
+ '24.124.4.220', # World Online offices
+ '24.124.1.4', # https://admin.6newslawrence.com/
+ '24.148.30.138', # Adrian home
+ '127.0.0.1', # localhost
+)
+
+# Local time zone for this installation. All choices can be found here:
+# http://www.postgresql.org/docs/current/static/datetime-keywords.html#DATETIME-TIMEZONE-SET-TABLE
+TIME_ZONE = 'America/Chicago'
+
+# Language code for this installation. All choices can be found here:
+# http://www.w3.org/TR/REC-html40/struct/dirlang.html#langcodes
+# http://blogs.law.harvard.edu/tech/stories/storyReader$15
+LANGUAGE_CODE = 'en-us'
+
+# Not-necessarily-technical managers of the site. They get broken link
+# notifications and other various e-mails.
+MANAGERS = ADMINS
+
+# which e-mail address error messages come from
+SERVER_EMAIL = None
+
+# Whether to send broken-link e-mails
+SEND_BROKEN_LINK_EMAILS = True
+
+# postgres database connection info
+DATABASE_ENGINE = 'postgresql'
+DATABASE_NAME = 'cms'
+DATABASE_USER = 'apache'
+DATABASE_PASSWORD = ''
+DATABASE_HOST = '' # set to empty string for localhost
+
+# host for sending e-mail
+EMAIL_HOST = 'localhost'
+
+# name of the session cookie
+AUTH_SESSION_COOKIE = 'rizzo'
+
+# name of the authorization profile module (below django.apps)
+AUTH_PROFILE_MODULE = ''
+
+# list of locations of the template source files, in search order
+TEMPLATE_DIRS = []
+
+# default e-mail address to use for various automated correspondence from the site managers
+DEFAULT_FROM_EMAIL = 'webmaster@ljworld.com'
+
+# whether to append trailing slashes to URLs
+APPEND_SLASH = True
+
+# whether to prepend the "www." subdomain to URLs
+PREPEND_WWW = False
+
+# list of regular expressions representing User-Agent strings that are not
+# allowed to visit any page, CMS-wide. Use this for bad robots/crawlers.
+DISALLOWED_USER_AGENTS = (
+ re.compile(r'^NaverBot.*'),
+ re.compile(r'^EmailSiphon.*'),
+ re.compile(r'^SiteSucker.*'),
+ re.compile(r'^sohu-search')
+)
+
+ABSOLUTE_URL_OVERRIDES = {}
+
+# list of allowed prefixes for the {% ssi %} tag
+ALLOWED_INCLUDE_ROOTS = ('/home/html',)
+
+# if this is a admin settings module, this should be a list of
+# settings modules for which this admin is an admin for
+ADMIN_FOR = []
+
+# 404s that may be ignored
+IGNORABLE_404_STARTS = ('/cgi-bin/', '/_vti_bin', '/_vti_inf')
+IGNORABLE_404_ENDS = ('mail.pl', 'mailform.pl', 'mail.cgi', 'mailform.cgi', 'favicon.ico', '.php')
+
+##############
+# Middleware #
+##############
+
+# List of middleware classes to use. Order is important; in the request phase,
+# this middleware classes will be applied in the order given, and in the
+# response phase the middleware will be applied in reverse order.
+MIDDLEWARE_CLASSES = (
+ "django.middleware.common.CommonMiddleware",
+ "django.middleware.doc.XViewMiddleware",
+)
+
+#########
+# CACHE #
+#########
+
+# The cache backend to use. See the docstring in django.core.cache for the
+# values this can be set to.
+CACHE_BACKEND = 'simple://'
+
+####################
+# REGISTRATION #
+####################
+
+# E-mail addresses at these domains cannot sign up for accounts
+BANNED_EMAIL_DOMAINS = [
+ 'mailinator.com', 'dodgeit.com', 'spamgourmet.com', 'mytrashmail.com'
+]
+REGISTRATION_COOKIE_DOMAIN = None # set to a string like ".lawrence.com", or None for standard domain cookie
+
+# If this is set to True, users will be required to fill out their profile
+# (defined by AUTH_PROFILE_MODULE) before they will be allowed to create
+# an account.
+REGISTRATION_REQUIRES_PROFILE = False
+
+####################
+# COMMENTS #
+####################
+
+COMMENTS_ALLOW_PROFANITIES = False
+
+# The group ID that designates which users are banned.
+# Set to None if you're not using it.
+COMMENTS_BANNED_USERS_GROUP = 19
+
+# The group ID that designates which users can moderate comments.
+# Set to None if you're not using it.
+COMMENTS_MODERATORS_GROUP = 20
+
+# The group ID that designates the users whose comments should be e-mailed to MANAGERS.
+# Set to None if you're not using it.
+COMMENTS_SKETCHY_USERS_GROUP = 22
+
+# The system will e-mail MANAGERS the first COMMENTS_FIRST_FEW comments by each
+# user. Set this to 0 if you want to disable it.
+COMMENTS_FIRST_FEW = 10
+
+BANNED_IPS = (
+ # Dupont Stainmaster / GuessWho / a variety of other names (back when we had free comments)
+ '204.94.104.99', '66.142.59.23', '220.196.165.142',
+ # (Unknown)
+ '64.65.191.117',
+# # Jimmy_Olsen / Clark_Kent / Bruce_Wayne
+# # Unbanned on 2005-06-17, because other people want to register from this address.
+# '12.106.111.10',
+ # hoof_hearted / hugh_Jass / Ferd_Burfel / fanny_farkel
+ '24.124.72.20', '170.135.241.46',
+ # Zac_McGraw
+ '198.74.20.74', '198.74.20.75',
+)
+
+####################
+# BLOGS #
+####################
+
+# E-mail addresses to notify when a new blog entry is posted live
+BLOGS_EMAILS_TO_NOTIFY = []
+
+####################
+# PLACES #
+####################
+
+# A list of IDs -- *as integers, not strings* -- that are considered the "main"
+# cities served by this installation. Probably just one.
+MAIN_CITY_IDS = (1,) # Lawrence
+
+# A list of IDs -- *as integers, not strings* -- that are considered "local" by
+# this installation.
+LOCAL_CITY_IDS = (1, 3) # Lawrence and Kansas City, MO
+
+####################
+# THUMBNAILS #
+####################
+
+THUMB_ALLOWED_WIDTHS = (90, 120, 180, 240, 450)
+
+####################
+# VARIOUS ROOTS #
+####################
+
+# This is the new media root and URL! Use it, and only it!
+MEDIA_ROOT = '/home/media/media.lawrence.com/'
+MEDIA_URL = 'http://media.lawrence.com'
No changes.
Oops, something went wrong.

0 comments on commit ed114e1

Please sign in to comment.