|
1
|
|
|
# -*- coding: utf-8 -*- |
|
2
|
|
|
# |
|
3
|
|
|
# Copyright (c) 2016 dotzero <[email protected]> |
|
4
|
|
|
# |
|
5
|
|
|
# Permission is hereby granted, free of charge, to any person obtaining a copy |
|
6
|
|
|
# of this software and associated documentation files (the "Software"), to deal |
|
7
|
|
|
# in the Software without restriction, including without limitation the rights |
|
8
|
|
|
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
9
|
|
|
# copies of the Software, and to permit persons to whom the Software is |
|
10
|
|
|
# furnished to do so, subject to the following conditions: |
|
11
|
|
|
# |
|
12
|
|
|
# The above copyright notice and this permission notice shall be included |
|
13
|
|
|
# in all copies or substantial portions of the Software. |
|
14
|
|
|
# |
|
15
|
|
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
16
|
|
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
17
|
|
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
|
18
|
|
|
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
19
|
|
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|
20
|
|
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
|
21
|
|
|
# SOFTWARE. |
|
22
|
|
|
|
|
23
|
1 |
|
from tilda.base import TildaBase |
|
24
|
|
|
|
|
25
|
|
|
|
|
26
|
1 |
|
class TildaPage(TildaBase): |
|
27
|
1 |
|
def __init__(self, *args, **kwargs): |
|
28
|
|
|
# Basic fields |
|
29
|
1 |
|
self.id = int(kwargs.get('id', 0)) |
|
30
|
1 |
|
self.projectid = int(kwargs.get('projectid', 0)) |
|
31
|
1 |
|
self.title = kwargs.get('title', '') |
|
32
|
1 |
|
self.descr = kwargs.get('descr', '') |
|
33
|
1 |
|
self.img = kwargs.get('img', '') |
|
34
|
1 |
|
self.featureimg = kwargs.get('featureimg', '') |
|
35
|
1 |
|
self.alias = kwargs.get('alias', '') |
|
36
|
1 |
|
self.date = self._fromdatestring(kwargs.get('date')) |
|
37
|
1 |
|
self.sort = int(kwargs.get('sort', 0)) |
|
38
|
1 |
|
self.published = self._fromtimestamp(kwargs.get('published')) |
|
39
|
1 |
|
self.filename = kwargs.get('filename', '') |
|
40
|
1 |
|
self.html = kwargs.get('html', '') |
|
41
|
|
|
# Export fields |
|
42
|
1 |
|
self.css = kwargs.get('css', list()) |
|
43
|
1 |
|
self.js = kwargs.get('js', list()) |
|
44
|
1 |
|
self.images = kwargs.get('images', list()) |
|
45
|
|
|
|
|
46
|
1 |
|
def __str__(self): |
|
47
|
1 |
|
return '(%d) %s' % (self.id, self.title) |
|
48
|
|
|
|
|
49
|
1 |
|
def __repr__(self): |
|
50
|
|
|
return '%s(%r)' % (self.__class__, self.__dict__) |
|
51
|
|
|
|