meringue 0.3.1__py2.7.egg → 0.3.4__py2.7.egg

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
EGG-INFO/PKG-INFO CHANGED
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 1.1
2
2
  Name: Meringue
3
- Version: 0.3.1
3
+ Version: 0.3.4
4
4
  Summary: Weboven django base package
5
5
  Home-page: https://github.com/dd/Meringue
6
6
  Author: weboven team
@@ -19,6 +19,7 @@ Description: ========
19
19
 
20
20
  * Django >= 1.5.0
21
21
  * pillow >= 2.0.0
22
+ * beautifulsoup4 >= 4.3.2
22
23
 
23
24
  ==================
24
25
  Meringue changelog
@@ -48,6 +49,7 @@ Description: ========
48
49
  * настройки вроде DEBUG из админки
49
50
  * перезагрузка сервера из админки
50
51
  * put_js преобразовывать относительные пути
52
+ * тег add_attrs добавляющий всё чтопередано атрибутами тега
51
53
 
52
54
 
53
55
  ---------------
@@ -55,6 +57,21 @@ Description: ========
55
57
  ---------------
56
58
 
57
59
 
60
+ 0.3.4
61
+ -------------
62
+
63
+ *
64
+
65
+
66
+ 0.3.3
67
+ -------------
68
+
69
+ * put_css/put_js:
70
+
71
+ - поправлена ссылка на .map
72
+ - добавлен параметр MERINGUE_LOAD_MINI в settings указывающий загружать минифицированный файл или нет (default = DEBUG)
73
+
74
+
58
75
  0.3.1.alpha.4
59
76
  -------------
60
77
 
@@ -71,6 +88,7 @@ Description: ========
71
88
  * PublishModel mtime field
72
89
  * PublishModel ctime field
73
90
  * put_css/put_js:
91
+
74
92
  - по возможности выводит минифицированный файл
75
93
  - в min переделывает ссылку на .map
76
94
  - переработана внутренняя составляющая в отдельный класс
EGG-INFO/SOURCES.txt CHANGED
@@ -6,9 +6,9 @@ setup.py
6
6
  Meringue.egg-info/PKG-INFO
7
7
  Meringue.egg-info/SOURCES.txt
8
8
  Meringue.egg-info/dependency_links.txt
9
+ Meringue.egg-info/not-zip-safe
9
10
  Meringue.egg-info/requires.txt
10
11
  Meringue.egg-info/top_level.txt
11
- Meringue.egg-info/zip-safe
12
12
  meringue/__init__.py
13
13
  meringue/context_processors.py
14
14
  meringue/decorators.py
@@ -19,6 +19,7 @@ meringue/middleware.py
19
19
  meringue/models.py
20
20
  meringue/settings.py
21
21
  meringue/upload_handlers.py
22
+ meringue/views.py
22
23
  meringue/widgets.py
23
24
  meringue/static/css/inline-gallery.css
24
25
  meringue/static/css/reset.css
EGG-INFO/requires.txt CHANGED
@@ -1,2 +1,3 @@
1
1
  Django>=1.5.0
2
- pillow>=2.0.0
2
+ pillow>=2.0.0
3
+ beautifulsoup4>=4.3.2
meringue/__init__.py CHANGED
@@ -1,9 +1,9 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
3
  __VERSION__ = (
4
- (0, 3, 1),
5
- # ('a', 4),
6
- # ('dev', 7)
4
+ (0, 3, 4),
5
+ # ('a', 1),
6
+ # ('dev', 1)
7
7
  )
8
8
 
9
9
  try:
meringue/__init__.pyc CHANGED
Binary file
Binary file
meringue/decorators.pyc CHANGED
Binary file
meringue/errors.pyc CHANGED
Binary file
meringue/fields.pyc CHANGED
Binary file
meringue/forms.pyc CHANGED
Binary file
meringue/middleware.pyc CHANGED
Binary file
meringue/models.py CHANGED
@@ -28,7 +28,7 @@ options.DEFAULT_NAMES = options.DEFAULT_NAMES + (
28
28
  class GetAbsoluteUrlMixin(object):
29
29
 
30
30
  '''
31
- Миксин автоматизирующий получение абсолютного адреса
31
+ Примесь автоматизирующая получение абсолютного адреса
32
32
  Для получения адреса использует стандартную функцию reverse (в
33
33
  случае если установлен django_hosts то reverse_full)
34
34
 
meringue/models.pyc CHANGED
Binary file
meringue/settings.py CHANGED
@@ -81,3 +81,14 @@ DEFAULT_PHONE_LOCALIZATION = getattr(
81
81
  'MERINGUE_DEFAULT_PHONE_LOCALIZATION',
82
82
  'RU'
83
83
  )
84
+
85
+
86
+ ##############
87
+ # PUT CSS/JS #
88
+ ##############
89
+
90
+ LOAD_MINI = getattr(
91
+ settings,
92
+ 'MERINGUE_LOAD_MINI',
93
+ not settings.DEBUG
94
+ )
meringue/settings.pyc CHANGED
Binary file
Binary file
@@ -3,6 +3,8 @@
3
3
  import logging
4
4
  import re
5
5
 
6
+ from bs4 import BeautifulSoup
7
+
6
8
  from django import forms
7
9
  from django import template
8
10
  from django.utils.safestring import mark_safe
@@ -89,3 +91,17 @@ def field_render(boundfield):
89
91
 
90
92
  result = FieldRender(boundfield)
91
93
  return result.render()
94
+
95
+
96
+ register = template.Library()
97
+ @register.filter
98
+ def add_placeholder(field):
99
+ """
100
+ Устанавливает placeholder равный значению label
101
+ """
102
+ soup = BeautifulSoup(unicode(field), 'html.parser')
103
+ for tag in soup.children:
104
+ if tag.name != 'script':
105
+ tag['placeholder'] = field.label
106
+ return mark_safe(soup.renderContents())
107
+
Binary file
@@ -70,7 +70,7 @@ class PutStatic:
70
70
  def _load_static_file(self):
71
71
  file = None
72
72
 
73
- if self.load_min:
73
+ if self.load_min and m_settings.LOAD_MINI:
74
74
  try:
75
75
  file = self._load_file(os.path.join(
76
76
  self.dir,
@@ -99,12 +99,23 @@ class PutStatic:
99
99
  result = text
100
100
  return result
101
101
 
102
+
102
103
  def _fix_map_link(self, text):
104
+
105
+ def _calculate_map_link(m):
106
+ result = 'sourceMappingURL=%s%s'
107
+ if m.groupdict()['scheme']:
108
+ return result % (m.groupdict()['scheme'], m.groupdict()['path'])
109
+
110
+ if m.groupdict()['path'].startswith('/'):
111
+ return result % (settings.STATIC_URL, m.groupdict()['path'])
112
+
113
+ return result % (settings.STATIC_URL, "/".join([self.dir, m.groupdict()['path']]))
114
+
103
115
  result = re.sub(
104
116
  re.compile(ur'sourceMappingURL=(?P<scheme>https:\/\/|http:\/\/|\/\/)?(?P<path>[\w\.]+)',
105
117
  re.UNICODE),
106
- lambda m: 'sourceMappingURL=%s%s' % (settings.STATIC_URL,
107
- m.groupdict()['path']),
118
+ _calculate_map_link,
108
119
  text
109
120
  )
110
121
  return result
@@ -137,7 +148,7 @@ def put_css(path):
137
148
  file = PutStatic(path, 'css') # , load_min=not settings.DEBUG)
138
149
  except FileNotFindError, error:
139
150
  if settings.TEMPLATE_DEBUG:
140
- return u'<script type=\"text/javascript\">console.log(\"файл\
151
+ return u'<script type=\"text/javascript\">console.error(\"файл\
141
152
  %s ненайден\"); </script>' % path
142
153
  raise error
143
154
 
@@ -157,7 +168,7 @@ def put_js(path):
157
168
  file = PutStatic(path, 'js') # , load_min=not settings.DEBUG)
158
169
  except FileNotFindError, error:
159
170
  if settings.TEMPLATE_DEBUG:
160
- return u'<script type=\"text/javascript\">console.log(\"файл\
171
+ return u'<script type=\"text/javascript\">console.error(\"файл\
161
172
  %s ненайден\"); </script>' % path
162
173
  raise error
163
174
 
Binary file
Binary file
@@ -12,11 +12,15 @@ def _rename(v, rn):
12
12
 
13
13
  class MemoryFileUploadHandler(uploadhandler.MemoryFileUploadHandler):
14
14
  def file_complete(self, file_size):
15
- self.file_name = _rename(self.file.getvalue(), self.file_name)
15
+ if not self.activated:
16
+ return
17
+
18
+ self.file_name = _rename(self.file.read(), self.file_name)
16
19
  return super(MemoryFileUploadHandler, self).file_complete(file_size)
17
20
 
18
21
 
19
22
  class TemporaryFileUploadHandler(uploadhandler.TemporaryFileUploadHandler):
20
23
  def file_complete(self, file_size):
21
- self.file_name = _rename(self.file.getvalue(), self.file_name)
22
- return super(MemoryFileUploadHandler, self).file_complete(file_size)
24
+ file = super(TemporaryFileUploadHandler, self).file_complete(file_size)
25
+ self.file_name = _rename(file.read(), self.file_name)
26
+ return file
Binary file
Binary file
meringue/utils/admin.pyc CHANGED
Binary file
Binary file
Binary file
meringue/utils/urls.pyc CHANGED
Binary file
Binary file
meringue/views.py ADDED
@@ -0,0 +1,7 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ from django.http import HttpResponse
4
+
5
+
6
+ def im_a_teapot(request):
7
+ return HttpResponse(status=418)
meringue/views.pyc ADDED
Binary file
meringue/widgets.pyc CHANGED
Binary file
@@ -1,35 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
-
3
- import logging
4
-
5
- from django.conf import settings
6
- from django.template import Library
7
- from django.utils import timezone
8
-
9
- from meringue import settings as wn_settings
10
-
11
-
12
- register = Library()
13
-
14
-
15
- @register.simple_tag
16
- def cop_year():
17
- '''
18
- Шаблонный тег возвращает диапозон годов для футера в формате:
19
- YYYY-YYYY
20
- YYYY
21
-
22
- Год старта проекта указывается в settings проекта - START_YEAR
23
- '''
24
-
25
- year = timezone.now().year
26
- return year == wn_settings.START_YEAR and year or '%d&mdash;%d' %\
27
- (wn_settings.START_YEAR, year)
28
-
29
-
30
- @register.simple_tag
31
- def put_reset():
32
- """
33
- Шаблонный тег выводит содержимое файла reset.css заключённое в тег style
34
- """
35
- return '<style>%s</style>' % open(wn_settings.path('meringue/static/css/reset%s.css' % '' if settings.DEBUG else '.min'), 'r').read()
Binary file
File without changes