Skip to content

Commit 2bf3b97

Browse files
committed
More clean-up on viur-base
- Added Google Login setup - Cleaned main.py - replaced SendInBlue by Mailjet example (commented) - added User-module section with roles and Google settings - Removed resources and deploy/vi_plugins - Fixed and cleaned Example-Module and skeleton - Moved most templates to deploy/html/default - Cleaned imports
1 parent f83b704 commit 2bf3b97

38 files changed

+66
-620
lines changed

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
*.pyc
22
*.log
33
*.bak
4-
*.bat
54

65
.venv
76
.idea

deploy/.gcloudignore

+1-17
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,5 @@
66
# For more information, run:
77
# $ gcloud topic gcloudignore
88
#
9-
.gcloudignore
10-
# If you would like to upload your .git directory, .gitignore file or files
11-
# from your .gitignore file, remove the corresponding line
12-
# below:
13-
.git
14-
.gitignore
15-
16-
# Python pycache:
17-
__pycache__/
18-
# Ignored by the build system
19-
/setup.cfg
209

21-
node_modules/
22-
/viur/docs/
23-
/viur/CHANGELOG.md
24-
/viur/LICENSE
25-
/viur/README.md
26-
/viur/.readthedocs.yml
10+
.gcloudignore
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

deploy/html/example_list.html

+4-5
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@ <h1 class="headline">View {{ moduleName() }}</h1>
66
{% for skel in skellist %}
77
<div>{{ skel["name"] }}</div>
88
{% if skel["image"] %}
9-
<div>
10-
<img src="{{ downloadUrlFor(skel["image"]["dest"], derived="thumbnail-w500.webp") }}">
11-
</div>
12-
{% endif %}
9+
<div>
10+
<img src="{{ downloadUrlFor(skel["image"]["dest"], derived="thumbnail-w500.webp") }}">
11+
</div>
12+
{% endif %}
1313
{% endfor %}
14-
1514
{% endblock %}

deploy/main.py

+23-7
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,6 @@ class ProjectConfig(ConfigType):
7171

7272
conf.valid_application_ids = list(conf.project.appnames.keys())
7373

74-
# Client-ID for OAuth with google
75-
# conf.user.google_client_id = ""
7674

7775
# ------------------------------------------------------------------------------
7876
# Debugging & Performance
@@ -95,6 +93,23 @@ class ProjectConfig(ConfigType):
9593
# render old-style tuple-list in SelectBone's values structure
9694
conf.compatibility.remove("bone.select.structure.values.keytuple")
9795

96+
# ------------------------------------------------------------------------------
97+
# User module
98+
#
99+
100+
# Client-ID for OAuth with Google Account
101+
# conf.user.google_client_id = ""
102+
# conf.user.google_gsuite_domains = ["example.com"]
103+
104+
# User roles
105+
#
106+
# conf.user.roles = {
107+
# "custom": "Custom setting",
108+
# "admin": "Administrator",
109+
# "backoffice": "Back office worker",
110+
# "salesforce": "Sales force worker",
111+
# }
112+
98113
# ------------------------------------------------------------------------------
99114
# File module
100115
#
@@ -137,9 +152,10 @@ class ProjectConfig(ConfigType):
137152
# Email configuration
138153
#
139154

140-
conf.email.sendinblue_api_key = "xkeysib-XXX" # better: use secret.get("sib-api-key")
141-
conf.email.transport_class = email.EmailTransportSendInBlue
142-
conf.email.send_from_local_development_server = True # enable sending emails from local development server
155+
# conf.email.mailjet_api_key = "xxx" # better: use secret.get("mailjet-api-key")
156+
# conf.email.mailjet_api_secret = "xxx" # better: use secret.get("mailjet-api-secret")
157+
# conf.email.transport_class = email.EmailTransportMailjet
158+
# conf.email.send_from_local_development_server = True # enable sending emails from local development server
143159
# conf.email.sender_override = "mail@viur.dev"
144160
# conf.email.recipient_override = ["mail@viur.dev"] # send all emails to this recipient
145161

@@ -221,8 +237,8 @@ class ProjectConfig(ConfigType):
221237
# Server startup
222238
#
223239

224-
import modules
225-
import render
240+
import modules # noqa
241+
import render # noqa
226242

227243
# core.setDefaultLanguage("de")
228244
app = setup(modules, render)

deploy/modules/example.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,8 @@ class Example(List):
55
listTemplate = "example_list"
66

77
def listFilter(self, query):
8-
return query # everyone can see everything!
8+
return query # This content is public!
9+
10+
11+
Example.html = True # enable for HTML-rendering
12+
Example.json = True # enable for JSON-rendering

deploy/modules/file.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from viur.core import i18n, db, current
1+
from viur.core import i18n, current
22
from viur.core.modules.file import File
33

44

deploy/skeletons/example.py

+5-40
Original file line numberDiff line numberDiff line change
@@ -7,45 +7,10 @@ class ExampleSkel(Skeleton):
77
# Defaults
88
name = StringBone(
99
descr="Name",
10-
required=True
10+
required=True,
1111
)
1212

13-
sortindex = NumericBone(
14-
descr="Sort index",
15-
indexed=True,
16-
required=True
17-
)
18-
19-
image = FileBone(
20-
descr="Image",
21-
derive=conf["derives"]
22-
)
23-
24-
# SEO
25-
seo_title = StringBone(
26-
descr="SEO Title",
27-
params={
28-
"category": "SEO"
29-
}
30-
)
31-
32-
seo_description = StringBone(
33-
descr="SEO Description",
34-
params={
35-
"category": "SEO"
36-
}
37-
)
38-
39-
seo_keywords = StringBone(
40-
descr="SEO Keywords",
41-
params={
42-
"category": "SEO"
43-
}
44-
)
45-
46-
seo_image = FileBone(
47-
descr="SEO Preview Image",
48-
params={
49-
"category": "SEO"
50-
}
51-
)
13+
# image = FileBone(
14+
# descr="Image",
15+
# derive=conf.project.standard_derives,
16+
# )

deploy/vi_plugins/__init__.py

-25
This file was deleted.

deploy/vi_plugins/files.json

-3
This file was deleted.

project.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"admin": {
77
"command": "viur package install admin",
88
"kind": "exec",
9-
"version": "4.4.6"
9+
"version": "4.4.7"
1010
},
1111
"npm": {
1212
"command": "build",

resources/allbones/README.md

-5
This file was deleted.

resources/allbones/modules/allbones.py

-153
This file was deleted.

0 commit comments

Comments
 (0)