Permalink
Browse files

修复版本,改动比较大

  • Loading branch information...
1 parent 4a45978 commit 570c459aa9b3920379a0f5505d43a6763b30d86f @xuming committed Jun 6, 2012
Showing with 43,772 additions and 5,564 deletions.
  1. +2 −0 .gitignore
  2. 0 app/gaedbimport/__init__.py
  3. +61 −0 app/gaedbimport/gaedbimport.py
  4. +28 −30 app/recurse.py
  5. +4 −0 appengine_config.py
  6. +17 −6 appengine_console.py
  7. +1 −1 complie_text.bat
  8. +61 −0 index.yaml
  9. +1,021 −1,088 locale/zh_CN/LC_MESSAGES/django.po
  10. +35 −10 micolog/__init__.py
  11. +155 −146 micolog/admin.py
  12. +65 −47 micolog/base.py
  13. +443 −234 micolog/blog.py
  14. +289 −82 micolog/cache.py
  15. +107 −0 micolog/cache2.py
  16. 0 {app → micolog/filter}/html_filter.py
  17. +8 −1 micolog/filter/myfilter.py
  18. +209 −0 micolog/filter/recurse.py
  19. +671 −457 micolog/model.py
  20. +4 −4 micolog/plugin.py
  21. +12 −12 micolog/template.py
  22. +17 −0 micolog/test.py
  23. +0 −1 micolog/zip_loader.py
  24. +261 −0 plugins/akismet.py
  25. +3,318 −0 plugins/wordpress/elapse.wordpress.2010-11-25.xml
  26. +16,992 −0 plugins/wordpress/schwarzespapier.wordpress.2010-11-22.xml
  27. +4,997 −0 plugins/wordpress/schwarzespapier.wordpress.2010-11-22_1.xml
  28. +4,994 −0 plugins/wordpress/schwarzespapier.wordpress.2010-11-22_2.xml
  29. +4,998 −0 plugins/wordpress/schwarzespapier.wordpress.2010-11-22_3.xml
  30. +2,709 −0 plugins/wordpress/schwarzespapier.wordpress.2010-11-22_4.xml
  31. +25 −10 settings.py
  32. +0 −16 themes/default/focus.js
  33. BIN themes/default/images/bullet.gif
  34. BIN themes/default/images/cbottom.gif
  35. BIN themes/default/images/ctop.gif
  36. BIN themes/default/images/foobkg.gif
  37. BIN themes/default/images/go.gif
  38. BIN themes/default/images/homsar.jpeg
  39. BIN themes/default/images/inputbg.gif
  40. BIN themes/default/images/logo.gif
  41. BIN themes/default/images/mleft.gif
  42. BIN themes/default/images/mright.gif
  43. BIN themes/default/images/top.gif
  44. BIN themes/default/images/topbkg.gif
  45. BIN themes/default/images/transparent.gif
  46. +0 −285 themes/default/rounded_corners_lite.inc.js
  47. BIN themes/default/screenshot.png
  48. BIN themes/default/skin.jpg
  49. BIN themes/default/skin_small.jpg
  50. +0 −126 themes/default/style.css
  51. +0 −107 themes/default/templates/base.html
  52. +0 −27 themes/default/templates/category.html
  53. +0 −126 themes/default/templates/comments.html
  54. +0 −7 themes/default/templates/error-101.html
  55. +0 −7 themes/default/templates/error-102.html
  56. +0 −5 themes/default/templates/error.html
  57. +0 −7 themes/default/templates/error404.html
  58. +0 −55 themes/default/templates/index.html
  59. +0 −5 themes/default/templates/msg.html
  60. +0 −38 themes/default/templates/page.html
  61. +0 −34 themes/default/templates/sidebar.html
  62. +0 −51 themes/default/templates/single.html
  63. +0 −32 themes/default/templates/tag.html
  64. +0 −16 themes/default_jp/focus.js
  65. BIN themes/default_jp/images/bullet.gif
  66. BIN themes/default_jp/images/cbottom.gif
  67. BIN themes/default_jp/images/ctop.gif
  68. BIN themes/default_jp/images/foobkg.gif
  69. BIN themes/default_jp/images/go.gif
  70. BIN themes/default_jp/images/homsar.jpeg
  71. BIN themes/default_jp/images/inputbg.gif
  72. BIN themes/default_jp/images/logo.gif
  73. BIN themes/default_jp/images/mleft.gif
  74. BIN themes/default_jp/images/mright.gif
  75. BIN themes/default_jp/images/top.gif
  76. BIN themes/default_jp/images/topbkg.gif
  77. BIN themes/default_jp/images/transparent.gif
  78. +0 −285 themes/default_jp/rounded_corners_lite.inc.js
  79. BIN themes/default_jp/screenshot.png
  80. BIN themes/default_jp/skin.jpg
  81. BIN themes/default_jp/skin_small.jpg
  82. +0 −126 themes/default_jp/style.css
  83. +0 −106 themes/default_jp/templates/base.html
  84. +0 −30 themes/default_jp/templates/category.html
  85. +0 −116 themes/default_jp/templates/comments.html
  86. +0 −7 themes/default_jp/templates/error-101.html
  87. +0 −7 themes/default_jp/templates/error-102.html
  88. +0 −5 themes/default_jp/templates/error.html
  89. +0 −7 themes/default_jp/templates/error404.html
  90. +0 −51 themes/default_jp/templates/index.html
  91. +0 −46 themes/default_jp/templates/month.html
  92. +0 −5 themes/default_jp/templates/msg.html
  93. +0 −38 themes/default_jp/templates/page.html
  94. +0 −35 themes/default_jp/templates/sidebar.html
  95. +0 −51 themes/default_jp/templates/single.html
  96. +0 −32 themes/default_jp/templates/tag.html
  97. +0 −16 themes/pixel-en/ie.css
  98. +0 −17 themes/pixel-en/ie6.css
  99. BIN themes/pixel-en/images/bg-trans.png
  100. BIN themes/pixel-en/images/bgbody.jpg
  101. BIN themes/pixel-en/images/bggrad.jpg
  102. BIN themes/pixel-en/images/bullet.gif
  103. BIN themes/pixel-en/images/comments.gif
  104. BIN themes/pixel-en/images/gravatar-trans.png
  105. BIN themes/pixel-en/images/lookingbg.jpg
  106. BIN themes/pixel-en/images/more.gif
  107. BIN themes/pixel-en/images/rss-trans.png
  108. BIN themes/pixel-en/images/tags.gif
  109. +0 −20 themes/pixel-en/js/sfhover.js
  110. BIN themes/pixel-en/screenshot.png
  111. +0 −799 themes/pixel-en/style.css
  112. +0 −75 themes/pixel-en/templates/base.html
  113. +0 −41 themes/pixel-en/templates/category.html
  114. +0 −126 themes/pixel-en/templates/comments.html
  115. +0 −13 themes/pixel-en/templates/error-101.html
  116. +0 −12 themes/pixel-en/templates/error-102.html
  117. +0 −12 themes/pixel-en/templates/error404.html
  118. +0 −45 themes/pixel-en/templates/index.html
  119. +0 −41 themes/pixel-en/templates/month.html
  120. +0 −5 themes/pixel-en/templates/msg.html
  121. +0 −30 themes/pixel-en/templates/page.html
  122. +0 −109 themes/pixel-en/templates/sidebar.html
  123. +0 −34 themes/pixel-en/templates/single.html
  124. +0 −41 themes/pixel-en/templates/tag.html
  125. +153 −0 themes/xuming/comment.js
  126. +319 −0 themes/xuming/freshpress.css
  127. BIN themes/xuming/icon.png
  128. BIN themes/xuming/images/cleardot.gif
  129. BIN themes/xuming/images/logo.gif
  130. BIN themes/xuming/images/mlog32.png
  131. BIN themes/xuming/images/mlog48.png
  132. BIN themes/xuming/images/mlog64.png
  133. BIN themes/xuming/images/png/sprites.png
  134. BIN themes/xuming/images/sprites.gif
  135. BIN themes/xuming/images/sprites_.gif
  136. +32 −0 themes/xuming/jquery-1.2.6.min.js
  137. +2 −0 themes/xuming/jquery.mobile-1.1.0.min.css
  138. +130 −0 themes/xuming/my.css
  139. +235 −0 themes/xuming/style.css
  140. +129 −0 themes/xuming/templates/base.html
  141. +55 −0 themes/xuming/templates/category.html
  142. +20 −0 themes/xuming/templates/comment.html
  143. +27 −0 themes/xuming/templates/comment_edit.html
  144. +45 −0 themes/xuming/templates/comments.html
  145. +38 −0 themes/xuming/templates/comments_more.html
  146. +7 −0 themes/xuming/templates/error-101.html
  147. +7 −0 themes/xuming/templates/error-102.html
  148. +1 −1 themes/{pixel-en → xuming}/templates/error.html
  149. +18 −0 themes/xuming/templates/error404.html
  150. +3 −0 themes/xuming/templates/error__.html
  151. +54 −0 themes/xuming/templates/index.html
  152. +69 −0 themes/xuming/templates/m/comment_edit.html
  153. +43 −0 themes/xuming/templates/m/comments.html
  154. +30 −0 themes/xuming/templates/m/comments_more.html
  155. +93 −0 themes/xuming/templates/m/index.html
  156. +44 −0 themes/xuming/templates/m/more.html
  157. +50 −0 themes/xuming/templates/m/page.html
  158. +132 −0 themes/xuming/templates/m/single.html
  159. +91 −0 themes/xuming/templates/m/tag.html
  160. +64 −46 themes/{default → xuming}/templates/month.html
  161. +61 −0 themes/xuming/templates/page.html
  162. +105 −0 themes/xuming/templates/sidebar.html
  163. +93 −0 themes/xuming/templates/single.html
  164. +54 −0 themes/xuming/templates/tag.html
  165. +1 −0 themes/xuming/templates/test.html
  166. BIN {static → }/tinymce.zip
  167. +1 −1 update.bat
  168. +1 −1 views/admin/author.html
  169. +3 −3 views/admin/authors.html
  170. +1 −1 views/admin/base.html
  171. +7 −7 views/admin/categories.html
  172. +13 −4 views/admin/category.html
  173. +7 −6 views/admin/comments.html
  174. +2 −4 views/admin/entry.html
  175. +2 −2 views/admin/filemanager.html
  176. +2 −1 views/admin/import.html
  177. +5 −2 views/admin/pages.html
  178. +8 −2 views/admin/posts.html
  179. +6 −18 views/admin/setup.html
  180. +2 −1 views/admin/setup_base.html
  181. +2 −1 views/admin/status.html
  182. +1 −7 views/admin/tools.html
View
@@ -8,3 +8,5 @@
psd
config.py
app.yaml
+
+/bulkloader
No changes.
@@ -0,0 +1,61 @@
+#-------------------------------------------------------------------------------
+# Name: gaedbimporter
+# Purpose:
+#
+# Author: Xuming
+#
+# Created: 16-11-2010
+#-------------------------------------------------------------------------------
+#!/usr/bin/env python
+
+import sys, imp, new
+class gaedbimporter(object):
+ def __init__(self, item, *args, **kw):
+ if item != "gaedb":
+ raise ImportError
+
+ def is_package(self,fullname):
+ return True
+
+ def get_code(self,fullname):
+ return compile(self.get_source(fullname), "db:%s" % fullname, "exec")
+
+ def get_source(self,fullname):
+ return '''def test():
+ print 'testff' '''
+
+ def find_module(self, fullname, path=None):
+ if fullname=='dbtest':
+ return self
+ else:
+ return None
+
+ def load_module(self, fullname):
+ print "load_module:", fullname
+ ispkg=True
+ code=self.get_code(fullname)
+
+ #ispkg, code = self._get_code(fullname)
+ #mod = sys.modules.setdefault(fullname, imp.new_module(fullname))
+ mod=sys.modules.values()[0]
+ mod.__file__ = "<%s>" % self.__class__.__name__
+ mod.__loader__ = self
+ if ispkg:
+ mod.__path__ = []
+ mod=sys.modules.setdefault(fullname,mod)
+ print sys.modules
+ #print mod.__dict__
+ exec code in mod.__dict__
+ return mod
+
+ @classmethod
+ def install(cls):
+ sys.path_hooks.append(gaedbimporter)
+ sys.path_importer_cache.clear() # probably not necessary
+ sys.path.insert(0, "gaedb")
+
+if __name__ == "__main__":
+ gaedbimporter.install()
+ from dbtest import *
+ test()
+
View
@@ -1,7 +1,5 @@
import os
-os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
from google.appengine.dist import use_library
-use_library('django', '1.2')
from django.template import Library
from django.template import Node, NodeList
from django.template import TemplateSyntaxError, VariableDoesNotExist
@@ -15,7 +13,7 @@ def __init__(self, **kwargs):
self.nodelist_first, self.nodelist_second = kwargs['nodelist_first'], kwargs['nodelist_second']
del kwargs['nodelist_first'], kwargs['nodelist_second'], kwargs['sequence'], kwargs['children_name'], kwargs['loopvar']
self.kwargs = kwargs
-
+
def __repr__(self):
reversed_text = self.is_reversed and ' reversed' or ''
return "<For Node: for %s in %s, tail_len: %d%s>" % \
@@ -43,7 +41,7 @@ def render(self, context, depth=0, values=False):
else:
parentloop = {}
context.push()
-
+
# On the first recursion pass, we have no values
if not values:
try:
@@ -56,20 +54,20 @@ def render(self, context, depth=0, values=False):
values = list(values)
len_values = len(values)
-
+
# Create a recurseloop value in the context. We'll update counters on each iteration just below.
loop_dict = context['recurseloop'] = {'parent': parentloop}
-
+
loop_dict['depth'] = depth + 1
loop_dict['depth0'] = depth
for i, item in enumerate(values):
# Add the additional arguments to the context
# They come in the form of {'name':(initial,increment)}
- # As for now only numbers are supported, but also strings can be multiplied
+ # As for now only numbers are supported, but also strings can be multiplied
for k,v in self.kwargs.iteritems():
context[k] = v[0] + v[1]*depth
-
+
# Shortcuts for current loop iteration number.
loop_dict['counter0'] = i
loop_dict['counter'] = i+1
@@ -79,41 +77,41 @@ def render(self, context, depth=0, values=False):
loop_dict['last'] = (i == len_values - 1)
context[ self.loopvar ] = item
-
+
for node in self.nodelist_first:
nodelist.append( node.render(context) )
-
+
if len( getattr( item, self.children_name ) ):
nodelist.append( self.render( context, depth+1, getattr( item, self.children_name ) ) )
-
+
for node in self.nodelist_second:
nodelist.append( node.render(context) )
-
+
context.pop()
return nodelist.render(context)
#@register.tag(name="for")
def do_recurse(parser, token):
"""
- Recursively loops over each item in an array .
+ Recursively loops over each item in an array .
It also increments passed variables on each recursion depth.
For example, to display a list of comments with replies given ``comment_list``:
-
+
{% recurse comment in comments children="replies" indent=(0,20) %}
<div style="margin-left:{{indent}}px">{{ comment.text }}</div>
{% endrecurse %}
-
+
``children`` is the name of the iterable that contains the children of the current element
``children`` needs to be a property of comment, and is required for the recurseloop to work
You can pass additional parameters after children in the form of:
-
+
var_name=(intial_value, increment)
-
+
You need to take care of creating the tree structure on your own.
- As for now there should be no spaces between the equal ``=``
+ As for now there should be no spaces between the equal ``=``
signs when assigning children or additional variables
-
- In addition to the variables passed, the recurse loop sets a
+
+ In addition to the variables passed, the recurse loop sets a
number of variables available within the loop:
========================== ================================================
Variable Description
@@ -126,12 +124,12 @@ def do_recurse(parser, token):
``recurseloop.last`` True if this is the last time through the current level
``recurseloop.parent`` This is the loop one level "above" the current one
========================== ================================================
-
+
You can also use the tag {% yield %} inside a recursion.
The ``yield`` tag will output the same HTML that's between the recurse and endrecurse tags
if the current element has children. If there are no children ``yield`` will output nothing
You must not, however wrap the ``yield`` tag inside other tags, just like you must not wrap
- the ``else`` tag inside other tags when making if-else-endif
+ the ``else`` tag inside other tags when making if-else-endif
"""
# We will be throwing this a lot
def tError( contents ):
@@ -145,25 +143,25 @@ def tError( contents ):
lenbits = len(bits)
if lenbits < 5:
tError(token.contents)
-
+
in_index = 2
children_index = 4
if bits[in_index] != 'in':
tError(token.contents)
-
+
children_token = bits[children_index].split("=")
-
+
if len(children_token) != 2 or children_token[0] != 'children':
tError(token.contents)
f = children_token[1][0]
l = children_token[1][-1]
-
+
if f != l or f not in quotes:
tError(token.contents)
else:
children_token[1] = children_token[1].replace(f,"")
-
+
def convert(val):
try:
val = float(val)
@@ -187,18 +185,18 @@ def convert(val):
l = arg[1][-1]
if f != "(" or l != ")":
tError(token.contents)
-
+
try:
argval = tuple([ convert(x) for x in arg[1].replace("(","").replace(")","").split(",") ])
# Invalid float number, or missing comma
except (IndexError, ValueError):
tError(token.contents)
node_vars[ str(arg[0]) ] = argval
-
+
node_vars['children_name'] = children_token[1]
node_vars['loopvar'] = bits[1]
node_vars['sequence'] = parser.compile_filter(bits[3])
-
+
nodelist_first = parser.parse( ('yield', 'endrecurse',) )
token = parser.next_token()
if token.contents == 'yield':
View
@@ -0,0 +1,4 @@
+def webapp_add_wsgi_middleware(app):
+ from google.appengine.ext.appstats import recording
+ app = recording.appstats_wsgi_middleware(app)
+ return app
View
@@ -12,17 +12,28 @@
SCRIPT_DIR = os.path.join(DIR_PATH, 'google', 'appengine', 'tools')
+
+
EXTRA_PATHS = [
DIR_PATH,
os.path.join(DIR_PATH, 'lib', 'antlr3'),
- os.path.join(DIR_PATH, 'lib', 'django'),
+ os.path.join(DIR_PATH, 'lib', 'django_1_3'),
+ os.path.join(DIR_PATH, 'lib', 'fancy_urllib'),
+ os.path.join(DIR_PATH, 'lib', 'ipaddr'),
+ os.path.join(DIR_PATH, 'lib', 'jinja2'),
+ os.path.join(DIR_PATH, 'lib', 'protorpc'),
+ os.path.join(DIR_PATH, 'lib', 'markupsafe'),
os.path.join(DIR_PATH, 'lib', 'webob'),
+ os.path.join(DIR_PATH, 'lib', 'webapp2'),
os.path.join(DIR_PATH, 'lib', 'yaml', 'lib'),
- os.path.join(DIR_PATH, 'lib', 'fancy_urllib')
+ os.path.join(DIR_PATH, 'lib', 'simplejson'),
+ os.path.join(DIR_PATH, 'lib', 'google.appengine._internal.graphy'),
]
+
sys.path = EXTRA_PATHS + sys.path
from google.appengine.ext.remote_api import remote_api_stub
-from google.appengine.ext import db
+#from google.appengine.ext import db
+from google.appengine.ext import ndb
def auth_func():
return raw_input('Username:'), getpass.getpass('Password:')
@@ -33,13 +44,13 @@ def auth_func():
if len(sys.argv) > 2:
host = sys.argv[2]
else:
- host = '%s.appspot.com' % app_id
+ host = 'localhost'
os.environ['APPLICATION_ID']=app_id
os.environ['AUTH_DOMAIN'] = 'gmail.com'
os.environ['USER_EMAIL'] = 'test@gmail.com'
os.environ['SERVER_NAME'] = 'testserver'
-os.environ['SERVER_PORT'] = '80'
+os.environ['SERVER_PORT'] = '8089'
os.environ['USER_IS_ADMIN'] = '1' #admin user 0 | 1
os.environ['HTTP_HOST']='localhost'
@@ -60,5 +71,5 @@ def auth_func():
apiproxy_stub_map.apiproxy.RegisterStub('memcache', memcache_stub.MemcacheServiceStub())
#remote_api_stub.ConfigureRemoteDatastore(app_id, '/remote_api', auth_func, host)
-from model import *
+from micolog.model import *
code.interact('App Engine interactive console for %s' % (app_id,), None, locals())
View
@@ -1,2 +1,2 @@
-set path=C:\Program Files\Google\google_appengine\gettext;%path%
+set path=E:\Program Files\Google\google_appengine\gettext;%path%
tools\compile-messages.py -l zh_CN
Oops, something went wrong.

0 comments on commit 570c459

Please sign in to comment.