Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Boxiang Sun
slapos.core
Commits
c8e3af4c
Commit
c8e3af4c
authored
Jul 09, 2012
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Factorise.
parent
9766ac0a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
7 deletions
+14
-7
master/bt5/vifib_web/ExtensionTemplateItem/ViFiBWeb.py
master/bt5/vifib_web/ExtensionTemplateItem/ViFiBWeb.py
+13
-6
master/bt5/vifib_web/bt/revision
master/bt5/vifib_web/bt/revision
+1
-1
No files found.
master/bt5/vifib_web/ExtensionTemplateItem/ViFiBWeb.py
View file @
c8e3af4c
...
...
@@ -36,10 +36,10 @@ def formatXml(self, xml):
popen
=
subprocess
.
Popen
([
'xmllint'
,
'--format'
,
'--recover'
,
'-'
],
stdin
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
)
return
popen
.
communicate
(
xml
)[
0
]
def
_getCacheFactory
(
self
):
# common methods
def
_getCacheFactory
(
self
,
cache_factory_name
):
portal
=
self
.
getPortalObject
()
cache_tool
=
portal
.
portal_caches
cache_factory_name
=
'facebook_server_auth_token_cache_factory'
cache_factory
=
cache_tool
.
getRamCacheRoot
().
get
(
cache_factory_name
)
#XXX This conditional statement should be remove as soon as
#Broadcasting will be enable among all zeo clients.
...
...
@@ -50,21 +50,28 @@ def _getCacheFactory(self):
cache_tool
.
updateCache
()
return
cache_tool
.
getRamCacheRoot
().
get
(
cache_factory_name
)
def
Facebook_setServerToken
(
self
,
key
,
body
):
cache_factory
=
_getCacheFactory
(
self
)
def
setServerToken
(
self
,
key
,
body
,
cache_factory_name
):
cache_factory
=
_getCacheFactory
(
self
,
cache_factory_name
)
cache_duration
=
cache_factory
.
cache_duration
for
cache_plugin
in
cache_factory
.
getCachePluginList
():
cache_plugin
.
set
(
key
,
DEFAULT_CACHE_SCOPE
,
body
,
cache_duration
=
cache_duration
)
def
Facebook_getServerToken
(
self
,
key
):
cache_factory
=
_getCacheFactory
(
self
)
def
getServerToken
(
self
,
key
,
cache_factory_name
):
cache_factory
=
_getCacheFactory
(
self
,
cache_factory_name
)
for
cache_plugin
in
cache_factory
.
getCachePluginList
():
cache_entry
=
cache_plugin
.
get
(
key
,
DEFAULT_CACHE_SCOPE
)
if
cache_entry
is
not
None
:
return
cache_entry
.
getValue
()
raise
KeyError
(
'Key %r not found'
%
key
)
# Facebook AS
def
Facebook_setServerToken
(
self
,
key
,
body
):
setServerToken
(
self
,
key
,
body
,
'facebook_server_auth_token_cache_factory'
)
def
Facebook_getServerToken
(
self
,
key
):
return
getServerToken
(
self
,
key
,
'facebook_server_auth_token_cache_factory'
)
def
Facebook_getAccessTokenFromCode
(
self
,
code
,
redirect_uri
):
return
facebook
.
get_access_token_from_code
(
code
=
code
,
redirect_uri
=
redirect_uri
,
...
...
master/bt5/vifib_web/bt/revision
View file @
c8e3af4c
388
\ No newline at end of file
389
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment