From 2bae1766f3470524798da327d812f69de465ffe7 Mon Sep 17 00:00:00 2001 From: Dmitry Trofimov Date: Thu, 20 Jan 2011 16:02:49 +0300 Subject: [PATCH 1/3] Added template_name reference to Django 1.3 views classes and as_view method. --- .../django/conf/project_template/manage.py | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100644 python/lib/Lib/site-packages/django/conf/project_template/manage.py diff --git a/python/lib/Lib/site-packages/django/conf/project_template/manage.py b/python/lib/Lib/site-packages/django/conf/project_template/manage.py deleted file mode 100644 index 5e78ea979ea3..000000000000 --- a/python/lib/Lib/site-packages/django/conf/project_template/manage.py +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env python -from django.core.management import execute_manager -try: - import settings # Assumed to be in the same directory. -except ImportError: - import sys - sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__) - sys.exit(1) - -if __name__ == "__main__": - execute_manager(settings) From 604fa13289601879e16e5fbb7ca005ac284e66bc Mon Sep 17 00:00:00 2001 From: Maxim Shafirov Date: Thu, 20 Jan 2011 17:23:29 +0300 Subject: [PATCH 2/3] Architecture priorities updated according latest Apple guidelines. --- python/build/Info.plist | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/python/build/Info.plist b/python/build/Info.plist index 96b333ef9efd..5df2147a8256 100644 --- a/python/build/Info.plist +++ b/python/build/Info.plist @@ -27,28 +27,22 @@ @@version@@ CFBundleVersion @@build@@ + + LSArchitecturePriority + + i386 + x86_64 + ppc + + Java - + ClassPath $APP_PACKAGE/lib/bootstrap.jar:$APP_PACKAGE/lib/extensions.jar:$APP_PACKAGE/lib/util.jar:$APP_PACKAGE/lib/jdom.jar:$APP_PACKAGE/lib/log4j.jar JVMVersion @@jdk_req@@ - JVMArchs - - i386 - x86_64 - ppc - - - LSArchitecturePriority - - i386 - x86_64 - ppc - - MainClass com.intellij.idea.Main Properties @@ -86,6 +80,6 @@ WorkingDirectory $APP_PACKAGE/bin - + From 74639820e86142a9f4000f16e937fc5c88323565 Mon Sep 17 00:00:00 2001 From: Dmitry Trofimov Date: Thu, 20 Jan 2011 19:47:21 +0300 Subject: [PATCH 3/3] Added super class attributes completion (PY-2744). --- python/src/META-INF/python-plugin-common.xml | 1 + ...ySuperAttributesCompletionContributor.java | 56 +++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 python/src/com/jetbrains/python/codeInsight/PySuperAttributesCompletionContributor.java diff --git a/python/src/META-INF/python-plugin-common.xml b/python/src/META-INF/python-plugin-common.xml index 77f4746845e9..fcdf8892823d 100644 --- a/python/src/META-INF/python-plugin-common.xml +++ b/python/src/META-INF/python-plugin-common.xml @@ -37,6 +37,7 @@ + diff --git a/python/src/com/jetbrains/python/codeInsight/PySuperAttributesCompletionContributor.java b/python/src/com/jetbrains/python/codeInsight/PySuperAttributesCompletionContributor.java new file mode 100644 index 000000000000..013b0ed332c5 --- /dev/null +++ b/python/src/com/jetbrains/python/codeInsight/PySuperAttributesCompletionContributor.java @@ -0,0 +1,56 @@ +package com.jetbrains.python.codeInsight; + +import com.google.common.collect.Lists; +import com.intellij.codeInsight.completion.*; +import com.intellij.codeInsight.lookup.LookupElementBuilder; +import com.intellij.patterns.PlatformPatterns; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiWhiteSpace; +import com.intellij.psi.util.PsiTreeUtil; +import com.intellij.util.ProcessingContext; +import com.jetbrains.python.psi.*; +import org.jetbrains.annotations.NotNull; + +import java.util.List; + +/** + * @author traff + */ +public class PySuperAttributesCompletionContributor extends CompletionContributor { + public PySuperAttributesCompletionContributor() { + extend(CompletionType.BASIC, + PlatformPatterns.psiElement().withParent(PyReferenceExpression.class), + new CompletionProvider() { + @Override + protected void addCompletions(@NotNull CompletionParameters parameters, + ProcessingContext context, + @NotNull CompletionResultSet result) { + PsiElement position = parameters.getOriginalPosition(); + PyClass containingClass = PsiTreeUtil.getParentOfType(position, PyClass.class); + if (containingClass == null && position instanceof PsiWhiteSpace) { + position = PsiTreeUtil.prevLeaf(position); + containingClass = PsiTreeUtil.getParentOfType(position, PyClass.class); + } + if (containingClass == null) { + return; + } + PyFunction func = PsiTreeUtil.getParentOfType(position, PyFunction.class); + if (func != null) { + return; + } + List seenNames = Lists.newArrayList(); + for (PyTargetExpression expr : containingClass.getClassAttributes()) { + seenNames.add(expr.getName()); + } + for (PyClass ancestor : containingClass.iterateAncestors()) { + for (PyTargetExpression expr : ancestor.getClassAttributes()) { + if (!seenNames.contains(expr.getName())) { + result.addElement(LookupElementBuilder.create(expr, expr.getName() + " = ")); + seenNames.add(expr.getName()); + } + } + } + } + }); + } +}