OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 from copy import copy | 5 from copy import copy |
6 import logging | 6 import logging |
7 import posixpath | 7 import posixpath |
8 | 8 |
9 from api_models import GetNodeCategories | 9 from api_models import GetNodeCategories |
10 from api_schema_graph import APINodeCursor | 10 from api_schema_graph import APINodeCursor |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 'events': self._GenerateEvents(self._jsc_model.events), | 109 'events': self._GenerateEvents(self._jsc_model.events), |
110 'domEvents': self._GenerateDomEvents(self._jsc_model.events), | 110 'domEvents': self._GenerateDomEvents(self._jsc_model.events), |
111 'properties': self._GenerateProperties(self._jsc_model.properties), | 111 'properties': self._GenerateProperties(self._jsc_model.properties), |
112 'introList': self._GetIntroTableList(), | 112 'introList': self._GetIntroTableList(), |
113 'channelWarning': self._GetChannelWarning(), | 113 'channelWarning': self._GetChannelWarning(), |
114 } | 114 } |
115 if self._jsc_model.deprecated: | 115 if self._jsc_model.deprecated: |
116 as_dict['deprecated'] = self._jsc_model.deprecated | 116 as_dict['deprecated'] = self._jsc_model.deprecated |
117 | 117 |
118 as_dict['byName'] = _GetByNameDict(as_dict) | 118 as_dict['byName'] = _GetByNameDict(as_dict) |
| 119 |
119 return as_dict | 120 return as_dict |
120 | 121 |
121 def _IsExperimental(self): | 122 def _IsExperimental(self): |
122 return self._jsc_model.name.startswith('experimental') | 123 return self._jsc_model.name.startswith('experimental') |
123 | 124 |
124 def _GetChannelWarning(self): | 125 def _GetChannelWarning(self): |
125 if not self._IsExperimental(): | 126 if not self._IsExperimental(): |
126 return { | 127 return { |
127 self._availability.channel_info.channel: True | 128 self._availability.channel_info.channel: True |
128 } | 129 } |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 dst_dict['enum_values'][-1]['last'] = True | 382 dst_dict['enum_values'][-1]['last'] = True |
382 elif type_.instance_of is not None: | 383 elif type_.instance_of is not None: |
383 dst_dict['simple_type'] = type_.instance_of | 384 dst_dict['simple_type'] = type_.instance_of |
384 else: | 385 else: |
385 dst_dict['simple_type'] = type_.property_type.name | 386 dst_dict['simple_type'] = type_.property_type.name |
386 | 387 |
387 def _CreateAvailabilityTemplate(self, status, scheduled, version): | 388 def _CreateAvailabilityTemplate(self, status, scheduled, version): |
388 '''Returns an object suitable for use in templates to display availability | 389 '''Returns an object suitable for use in templates to display availability |
389 information. | 390 information. |
390 ''' | 391 ''' |
| 392 # TODO(rockot): Temporary hack. Remove this very soon. |
| 393 if status == 'master': |
| 394 status = 'trunk' |
391 return { | 395 return { |
392 'partial': self._template_cache.GetFromFile( | 396 'partial': self._template_cache.GetFromFile( |
393 '%sintro_tables/%s_message.html' % (PRIVATE_TEMPLATES, status)).Get(), | 397 '%sintro_tables/%s_message.html' % (PRIVATE_TEMPLATES, status)).Get(), |
394 'scheduled': scheduled, | 398 'scheduled': scheduled, |
395 'version': version | 399 'version': version |
396 } | 400 } |
397 | 401 |
398 def _GetAvailabilityTemplate(self): | 402 def _GetAvailabilityTemplate(self): |
399 '''Gets availability for the current node and returns an appropriate | 403 '''Gets availability for the current node and returns an appropriate |
400 template object. | 404 template object. |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
553 # converted to a Motemplate object, transform it to a template. | 557 # converted to a Motemplate object, transform it to a template. |
554 if 'partial' in node: | 558 if 'partial' in node: |
555 # Note: it's enough to copy() not deepcopy() because only a single | 559 # Note: it's enough to copy() not deepcopy() because only a single |
556 # top-level key is being modified. | 560 # top-level key is being modified. |
557 node = copy(node) | 561 node = copy(node) |
558 node['partial'] = self._template_cache.GetFromFile( | 562 node['partial'] = self._template_cache.GetFromFile( |
559 posixpath.join(PRIVATE_TEMPLATES, node['partial'])).Get() | 563 posixpath.join(PRIVATE_TEMPLATES, node['partial'])).Get() |
560 content.append(node) | 564 content.append(node) |
561 misc_rows.append({ 'title': category, 'content': content }) | 565 misc_rows.append({ 'title': category, 'content': content }) |
562 return misc_rows | 566 return misc_rows |
OLD | NEW |