mirror of
https://github.com/GAM-team/GAM.git
synced 2025-05-12 12:17:20 +00:00
remove Sites API library
Some checks are pending
Build and test GAM / build (Win64, build, 10, VC-WIN64A, windows-2022) (push) Waiting to run
Build and test GAM / build (aarch64, build, 3, linux-aarch64, ubuntu-24.04-arm) (push) Waiting to run
Build and test GAM / build (aarch64, build, 4, linux-aarch64, ubuntu-22.04-arm) (push) Waiting to run
Build and test GAM / build (aarch64, build, 6, linux-aarch64, ubuntu-22.04-arm, yes) (push) Waiting to run
Build and test GAM / build (aarch64, build, 8, darwin64-arm64, macos-14) (push) Waiting to run
Build and test GAM / build (aarch64, build, 9, darwin64-arm64, macos-15) (push) Waiting to run
Build and test GAM / build (x86_64, build, 1, linux-x86_64, ubuntu-22.04) (push) Waiting to run
Build and test GAM / build (x86_64, build, 2, linux-x86_64, ubuntu-24.04) (push) Waiting to run
Build and test GAM / build (x86_64, build, 5, linux-x86_64, ubuntu-22.04, yes) (push) Waiting to run
Build and test GAM / build (x86_64, build, 7, darwin64-x86_64, macos-13) (push) Waiting to run
Build and test GAM / build (x86_64, test, 11, ubuntu-24.04, 3.10) (push) Waiting to run
Build and test GAM / build (x86_64, test, 12, ubuntu-24.04, 3.11) (push) Waiting to run
Build and test GAM / build (x86_64, test, 13, ubuntu-24.04, 3.12) (push) Waiting to run
Build and test GAM / merge (push) Blocked by required conditions
Build and test GAM / publish (push) Blocked by required conditions
CodeQL / Analyze (python) (push) Waiting to run
Check for Google Root CA Updates / check-apis (push) Waiting to run
Some checks are pending
Build and test GAM / build (Win64, build, 10, VC-WIN64A, windows-2022) (push) Waiting to run
Build and test GAM / build (aarch64, build, 3, linux-aarch64, ubuntu-24.04-arm) (push) Waiting to run
Build and test GAM / build (aarch64, build, 4, linux-aarch64, ubuntu-22.04-arm) (push) Waiting to run
Build and test GAM / build (aarch64, build, 6, linux-aarch64, ubuntu-22.04-arm, yes) (push) Waiting to run
Build and test GAM / build (aarch64, build, 8, darwin64-arm64, macos-14) (push) Waiting to run
Build and test GAM / build (aarch64, build, 9, darwin64-arm64, macos-15) (push) Waiting to run
Build and test GAM / build (x86_64, build, 1, linux-x86_64, ubuntu-22.04) (push) Waiting to run
Build and test GAM / build (x86_64, build, 2, linux-x86_64, ubuntu-24.04) (push) Waiting to run
Build and test GAM / build (x86_64, build, 5, linux-x86_64, ubuntu-22.04, yes) (push) Waiting to run
Build and test GAM / build (x86_64, build, 7, darwin64-x86_64, macos-13) (push) Waiting to run
Build and test GAM / build (x86_64, test, 11, ubuntu-24.04, 3.10) (push) Waiting to run
Build and test GAM / build (x86_64, test, 12, ubuntu-24.04, 3.11) (push) Waiting to run
Build and test GAM / build (x86_64, test, 13, ubuntu-24.04, 3.12) (push) Waiting to run
Build and test GAM / merge (push) Blocked by required conditions
Build and test GAM / publish (push) Blocked by required conditions
CodeQL / Analyze (python) (push) Waiting to run
Check for Google Root CA Updates / check-apis (push) Waiting to run
This commit is contained in:
parent
24bd99386b
commit
57e1625246
@ -1,283 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# Copyright 2009 Google Inc. All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
"""Data model classes for parsing and generating XML for the Sites Data API."""
|
||||
|
||||
import atom
|
||||
import gdata
|
||||
|
||||
# XML Namespaces used in Google Sites entities.
|
||||
SITES_NAMESPACE = 'http://schemas.google.com/sites/2008'
|
||||
SITES_TEMPLATE = '{http://schemas.google.com/sites/2008}%s'
|
||||
SPREADSHEETS_NAMESPACE = 'http://schemas.google.com/spreadsheets/2006'
|
||||
SPREADSHEETS_TEMPLATE = '{http://schemas.google.com/spreadsheets/2006}%s'
|
||||
GACL_NAMESPACE = 'http://schemas.google.com/acl/2007'
|
||||
GACL_TEMPLATE = '{http://schemas.google.com/acl/2007}%s'
|
||||
DC_TERMS_TEMPLATE = '{http://purl.org/dc/terms}%s'
|
||||
THR_TERMS_TEMPLATE = '{http://purl.org/syndication/thread/1.0}%s'
|
||||
XHTML_NAMESPACE = 'http://www.w3.org/1999/xhtml'
|
||||
XHTML_TEMPLATE = '{http://www.w3.org/1999/xhtml}%s'
|
||||
|
||||
SITES_INVITE_LINK_REL = SITES_NAMESPACE + '#invite'
|
||||
SITES_PARENT_LINK_REL = SITES_NAMESPACE + '#parent'
|
||||
SITES_REVISION_LINK_REL = SITES_NAMESPACE + '#revision'
|
||||
SITES_SOURCE_LINK_REL = SITES_NAMESPACE + '#source'
|
||||
SITES_TEMPLATE_LINK_REL = SITES_NAMESPACE + '#template'
|
||||
|
||||
ALTERNATE_REL = 'alternate'
|
||||
WEB_ADDRESS_MAPPING_REL = 'webAddressMapping'
|
||||
|
||||
SITES_KIND_SCHEME = 'http://schemas.google.com/g/2005#kind'
|
||||
ANNOUNCEMENT_KIND_TERM = SITES_NAMESPACE + '#announcement'
|
||||
ANNOUNCEMENT_PAGE_KIND_TERM = SITES_NAMESPACE + '#announcementspage'
|
||||
ATTACHMENT_KIND_TERM = SITES_NAMESPACE + '#attachment'
|
||||
COMMENT_KIND_TERM = SITES_NAMESPACE + '#comment'
|
||||
FILECABINET_KIND_TERM = SITES_NAMESPACE + '#filecabinet'
|
||||
LISTITEM_KIND_TERM = SITES_NAMESPACE + '#listitem'
|
||||
LISTPAGE_KIND_TERM = SITES_NAMESPACE + '#listpage'
|
||||
WEBPAGE_KIND_TERM = SITES_NAMESPACE + '#webpage'
|
||||
WEBATTACHMENT_KIND_TERM = SITES_NAMESPACE + '#webattachment'
|
||||
FOLDER_KIND_TERM = SITES_NAMESPACE + '#folder'
|
||||
TAG_KIND_TERM = SITES_NAMESPACE + '#tag'
|
||||
|
||||
SUPPORT_KINDS = [
|
||||
'announcement', 'announcementspage', 'attachment', 'comment', 'filecabinet',
|
||||
'listitem', 'listpage', 'webpage', 'webattachment', 'tag'
|
||||
]
|
||||
|
||||
|
||||
class GDataBase(atom.AtomBase):
|
||||
"""The Google Sites intermediate class from atom.AtomBase."""
|
||||
_namespace = gdata.GDATA_NAMESPACE
|
||||
_children = atom.AtomBase._children.copy()
|
||||
_attributes = atom.AtomBase._attributes.copy()
|
||||
|
||||
def __init__(self, text=None):
|
||||
atom.AtomBase.__init__(self, text=text)
|
||||
|
||||
class SitesBase(GDataBase):
|
||||
_namespace = SITES_NAMESPACE
|
||||
|
||||
class SiteName(SitesBase):
|
||||
"""Google Sites <sites:siteName>."""
|
||||
_tag = 'siteName'
|
||||
|
||||
class Theme(SitesBase):
|
||||
"""Google Sites <sites:theme>."""
|
||||
_tag = 'theme'
|
||||
|
||||
class SiteEntry(gdata.BatchEntry):
|
||||
"""Google Sites Site Feed Entry."""
|
||||
_tag = 'entry'
|
||||
_namespace = atom.ATOM_NAMESPACE
|
||||
_children = gdata.BatchEntry._children.copy()
|
||||
|
||||
_children['{%s}siteName' % SITES_NAMESPACE] = ('siteName', SiteName)
|
||||
_children['{%s}theme' % SITES_NAMESPACE] = ('theme', Theme)
|
||||
_attributes = gdata.BatchEntry._attributes.copy()
|
||||
_attributes['{%s}etag' % gdata.GDATA_NAMESPACE] = 'etag'
|
||||
|
||||
def __init__(self, siteName=None, title=None, summary=None, theme=None, sourceSite=None, category=None, etag=None):
|
||||
gdata.BatchEntry.__init__(self, category=category)
|
||||
self.siteName = siteName
|
||||
self.title = title
|
||||
self.summary = summary
|
||||
self.theme = theme
|
||||
if sourceSite is not None:
|
||||
sourceLink = atom.Link(href=sourceSite, rel=SITES_SOURCE_LINK_REL, link_type='application/atom+xml')
|
||||
self.link.append(sourceLink)
|
||||
self.etag = etag
|
||||
|
||||
def find_alternate_link(self):
|
||||
for link in self.link:
|
||||
if link.rel == ALTERNATE_REL and link.href:
|
||||
return link.href
|
||||
return None
|
||||
|
||||
FindAlternateLink = find_alternate_link
|
||||
|
||||
def find_source_link(self):
|
||||
for link in self.link:
|
||||
if link.rel == SITES_SOURCE_LINK_REL and link.href:
|
||||
return link.href
|
||||
return None
|
||||
|
||||
FindSourceLink = find_source_link
|
||||
|
||||
def find_webaddress_mappings(self):
|
||||
mappingLinks = []
|
||||
for link in self.link:
|
||||
if link.rel == WEB_ADDRESS_MAPPING_REL and link.href:
|
||||
mappingLinks.append(link.href)
|
||||
return mappingLinks
|
||||
|
||||
FindWebAddressMappings = find_webaddress_mappings
|
||||
|
||||
def SiteEntryFromString(xml_string):
|
||||
return atom.CreateClassFromXMLString(SiteEntry, xml_string)
|
||||
|
||||
class SiteFeed(gdata.BatchFeed, gdata.LinkFinder):
|
||||
"""A Google Sites feed flavor of an Atom Feed."""
|
||||
_tag = 'feed'
|
||||
_namespace = atom.ATOM_NAMESPACE
|
||||
_children = gdata.BatchFeed._children.copy()
|
||||
_children['{%s}entry' % atom.ATOM_NAMESPACE] = ('entry', [SiteEntry])
|
||||
|
||||
def __init__(self):
|
||||
gdata.BatchFeed.__init__(self)
|
||||
|
||||
def SiteFeedFromString(xml_string):
|
||||
return atom.CreateClassFromXMLString(SiteFeed, xml_string)
|
||||
|
||||
class AclBase(GDataBase):
|
||||
_namespace = GACL_NAMESPACE
|
||||
|
||||
class AclRole(AclBase):
|
||||
"""Describes the role of an entry in an access control list."""
|
||||
_tag = 'role'
|
||||
_children = AclBase._children.copy()
|
||||
_attributes = AclBase._attributes.copy()
|
||||
_attributes['value'] = 'value'
|
||||
|
||||
def __init__(self, value=None):
|
||||
AclBase.__init__(self)
|
||||
self.value = value
|
||||
|
||||
class AclAdditionalRole(AclBase):
|
||||
"""Describes an additionalRole element."""
|
||||
_tag = 'additionalRole'
|
||||
_children = AclBase._children.copy()
|
||||
_attributes = AclBase._attributes.copy()
|
||||
_attributes['value'] = 'value'
|
||||
|
||||
def __init__(self, value=None):
|
||||
AclBase.__init__(self)
|
||||
self.value = value
|
||||
|
||||
class AclScope(AclBase):
|
||||
"""Describes the scope of an entry in an access control list."""
|
||||
_tag = 'scope'
|
||||
_children = AclBase._children.copy()
|
||||
_attributes = AclBase._attributes.copy()
|
||||
_attributes['type'] = 'type'
|
||||
_attributes['value'] = 'value'
|
||||
|
||||
def __init__(self, stype=None, value=None):
|
||||
AclBase.__init__(self)
|
||||
self.type = stype
|
||||
self.value = value
|
||||
|
||||
|
||||
class AclWithKey(AclBase):
|
||||
"""Describes a key that can be used to access a document."""
|
||||
_tag = 'withKey'
|
||||
_children = AclBase._children.copy()
|
||||
_children['{%s}role' % GACL_NAMESPACE] = ('role', AclRole)
|
||||
_children['{%s}additionalRole' % GACL_NAMESPACE] = ('additionalRole', AclAdditionalRole)
|
||||
_attributes = AclBase._attributes.copy()
|
||||
_attributes['key'] = 'key'
|
||||
|
||||
def __init__(self, key=None, role=None, additionalRole=None):
|
||||
AclBase.__init__(self)
|
||||
self.key = key
|
||||
self.role = role
|
||||
self.additionalRole = additionalRole
|
||||
|
||||
class AclEntry(gdata.BatchEntry):
|
||||
"""Describes an entry in a feed of an access control list (ACL)."""
|
||||
_tag = 'entry'
|
||||
_namespace = atom.ATOM_NAMESPACE
|
||||
_children = gdata.BatchEntry._children.copy()
|
||||
|
||||
_children['{%s}role' % GACL_NAMESPACE] = ('role', AclRole)
|
||||
_children['{%s}additionalRole' % GACL_NAMESPACE] = ('additionalRole', AclAdditionalRole)
|
||||
_children['{%s}scope' % GACL_NAMESPACE] = ('scope', AclScope)
|
||||
_children['{%s}withKey' % GACL_NAMESPACE] = ('withKey', AclWithKey)
|
||||
_attributes = gdata.BatchEntry._attributes.copy()
|
||||
_attributes['{%s}etag' % gdata.GDATA_NAMESPACE] = 'etag'
|
||||
|
||||
def __init__(self, role=None, additionalRole=None, scope=None, withKey=None, etag=None):
|
||||
gdata.BatchEntry.__init__(self)
|
||||
self.role = role
|
||||
self.additionalRole = additionalRole
|
||||
self.scope = scope
|
||||
self.withKey = withKey
|
||||
self.etag = etag
|
||||
|
||||
def find_invite_link(self):
|
||||
for link in self.link:
|
||||
if link.rel == SITES_INVITE_LINK_REL and link.href:
|
||||
return link.href
|
||||
return None
|
||||
|
||||
FindInviteLink = find_invite_link
|
||||
|
||||
def AclEntryFromString(xml_string):
|
||||
return atom.CreateClassFromXMLString(AclEntry, xml_string)
|
||||
|
||||
class AclFeed(gdata.BatchFeed, gdata.LinkFinder):
|
||||
"""Describes a feed of an access control list (ACL)."""
|
||||
_tag = 'feed'
|
||||
_namespace = atom.ATOM_NAMESPACE
|
||||
_children = gdata.BatchFeed._children.copy()
|
||||
_children['{%s}entry' % atom.ATOM_NAMESPACE] = ('entry', [AclEntry])
|
||||
|
||||
def __init__(self):
|
||||
gdata.BatchFeed.__init__(self)
|
||||
|
||||
def AclFeedFromString(xml_string):
|
||||
return atom.CreateClassFromXMLString(AclFeed, xml_string)
|
||||
|
||||
class ActivityEntry(gdata.BatchEntry):
|
||||
"""Describes an entry in a feed of site activity (changes)."""
|
||||
_tag = 'entry'
|
||||
_namespace = atom.ATOM_NAMESPACE
|
||||
_children = gdata.BatchEntry._children.copy()
|
||||
_attributes = gdata.BatchEntry._attributes.copy()
|
||||
|
||||
def __init__(self):
|
||||
gdata.BatchEntry.__init__(self)
|
||||
|
||||
def __find_category_scheme(self, scheme):
|
||||
for category in self.category:
|
||||
if category.scheme == scheme:
|
||||
return category
|
||||
return None
|
||||
|
||||
def kind(self):
|
||||
kind = self.__find_category_scheme(SITES_KIND_SCHEME)
|
||||
if kind is not None:
|
||||
return kind.term[len(SITES_NAMESPACE) + 1:]
|
||||
else:
|
||||
return None
|
||||
|
||||
Kind = kind
|
||||
|
||||
def ActivityEntryFromString(xml_string):
|
||||
return atom.CreateClassFromXMLString(ActivityEntry, xml_string)
|
||||
|
||||
class ActivityFeed(gdata.BatchFeed, gdata.LinkFinder):
|
||||
"""Describes a feed of site activity (changes)."""
|
||||
_tag = 'feed'
|
||||
_namespace = atom.ATOM_NAMESPACE
|
||||
_children = gdata.BatchFeed._children.copy()
|
||||
_children['{%s}entry' % atom.ATOM_NAMESPACE] = ('entry', [ActivityEntry])
|
||||
|
||||
def __init__(self):
|
||||
gdata.BatchFeed.__init__(self)
|
||||
|
||||
def ActivityFeedFromString(xml_string):
|
||||
return atom.CreateClassFromXMLString(ActivityFeed, xml_string)
|
@ -1,246 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
#
|
||||
# Copyright 2009 Google Inc. All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
"""SitesService extends the GDataService for Google Sites API calls."""
|
||||
|
||||
import gdata.apps
|
||||
import gdata.apps.service
|
||||
import gdata.service
|
||||
|
||||
|
||||
# Feed URI templates
|
||||
CONTENT_FEED_TEMPLATE = '/feeds/content/%s/%s/'
|
||||
REVISION_FEED_TEMPLATE = '/feeds/revision/%s/%s/'
|
||||
ACTIVITY_FEED_TEMPLATE = '/feeds/activity/%s/%s/'
|
||||
ACTIVITY_ENTRY_TEMPLATE = '/feeds/activity/%s/%s/%s'
|
||||
SITE_FEED_TEMPLATE = '/feeds/site/%s/'
|
||||
ACL_FEED_TEMPLATE = '/feeds/acl/site/%s/%s'
|
||||
ACL_ENTRY_TEMPLATE = '/feeds/acl/site/%s/%s/%s'
|
||||
|
||||
|
||||
class SitesService(gdata.service.GDataService):
|
||||
"""Client extension for the Google Sites API service."""
|
||||
|
||||
def __init__(self,
|
||||
source=None, server='sites.google.com', additional_headers=None,
|
||||
**kwargs):
|
||||
"""Constructs a new client for the Sites API.
|
||||
|
||||
Args:
|
||||
site: string (optional) Name (webspace) of the Google Site
|
||||
domain: string (optional) Domain of the (Google Apps hosted) Site.
|
||||
If no domain is given, the Site is assumed to be a consumer Google
|
||||
Site, in which case the value 'site' is used.
|
||||
source: string (optional) The name of the user's application.
|
||||
server: string (optional) The name of the server to which a connection
|
||||
will be opened. Default value: 'sites..google.com'.
|
||||
**kwargs: The other parameters to pass to gdata.service.GDataService
|
||||
constructor.
|
||||
"""
|
||||
if additional_headers == None:
|
||||
additional_headers = {}
|
||||
additional_headers['GData-Version'] = '1.4'
|
||||
gdata.service.GDataService.__init__(self,
|
||||
source=source, server=server, additional_headers=additional_headers,
|
||||
**kwargs)
|
||||
self.ssl = True
|
||||
self.port = 443
|
||||
|
||||
def make_site_feed_uri(self, domain=None, site=None):
|
||||
if not domain:
|
||||
domain = 'site'
|
||||
if not site:
|
||||
return SITE_FEED_TEMPLATE % domain
|
||||
return (SITE_FEED_TEMPLATE % domain) + site
|
||||
|
||||
MakeSiteFeedUri = make_site_feed_uri
|
||||
|
||||
def get_site_feed(self, uri=None, domain=None, site=None,
|
||||
extra_headers=None, url_params=None, escape_params=True):
|
||||
|
||||
uri = uri or self.make_site_feed_uri(domain=domain, site=site)
|
||||
try:
|
||||
return self.Get(uri,
|
||||
url_params=url_params, extra_headers=extra_headers, escape_params=escape_params,
|
||||
converter=gdata.apps.sites.SiteFeedFromString)
|
||||
except gdata.service.RequestError as e:
|
||||
raise gdata.apps.service.AppsForYourDomainException(e.args[0])
|
||||
|
||||
GetSiteFeed = get_site_feed
|
||||
|
||||
def create_site(self, siteentry=None, uri=None, domain=None, site=None,
|
||||
extra_headers=None, url_params=None, escape_params=True):
|
||||
|
||||
if uri is None:
|
||||
uri = self.make_site_feed_uri(domain=domain, site=site)
|
||||
try:
|
||||
return self.Post(siteentry, uri,
|
||||
url_params=url_params, extra_headers=extra_headers, escape_params=escape_params,
|
||||
converter=gdata.apps.sites.SiteEntryFromString)
|
||||
except gdata.service.RequestError as e:
|
||||
raise gdata.apps.service.AppsForYourDomainException(e.args[0])
|
||||
|
||||
CreateSite = create_site
|
||||
|
||||
def get_site(self, uri=None, domain=None, site=None,
|
||||
extra_headers=None, url_params=None, escape_params=True):
|
||||
|
||||
uri = uri or self.make_site_feed_uri(domain=domain, site=site)
|
||||
try:
|
||||
return self.Get(uri,
|
||||
url_params=url_params, extra_headers=extra_headers, escape_params=escape_params,
|
||||
converter=gdata.apps.sites.SiteEntryFromString)
|
||||
except gdata.service.RequestError as e:
|
||||
raise gdata.apps.service.AppsForYourDomainException(e.args[0])
|
||||
|
||||
GetSite = get_site
|
||||
|
||||
def update_site(self, siteentry=None, uri=None, domain=None, site=None,
|
||||
extra_headers=None, url_params=None, escape_params=True):
|
||||
|
||||
uri = uri or self.make_site_feed_uri(domain=domain, site=site)
|
||||
try:
|
||||
return self.Put(siteentry, uri,
|
||||
url_params=url_params, extra_headers=extra_headers, escape_params=escape_params,
|
||||
converter=gdata.apps.sites.SiteEntryFromString)
|
||||
except gdata.service.RequestError as e:
|
||||
raise gdata.apps.service.AppsForYourDomainException(e.args[0])
|
||||
|
||||
UpdateSite = update_site
|
||||
|
||||
def make_acl_feed_uri(self, domain=None, site=None):
|
||||
return ACL_FEED_TEMPLATE % (domain, site)
|
||||
|
||||
MakeAclFeedUri = make_acl_feed_uri
|
||||
|
||||
def get_acl_feed(self, uri=None, domain=None, site=None,
|
||||
extra_headers=None, url_params=None, escape_params=True):
|
||||
|
||||
uri = uri or self.make_acl_feed_uri(domain=domain, site=site)
|
||||
try:
|
||||
return self.Get(uri,
|
||||
url_params=url_params, extra_headers=extra_headers, escape_params=escape_params,
|
||||
converter=gdata.apps.sites.AclFeedFromString)
|
||||
except gdata.service.RequestError as e:
|
||||
raise gdata.apps.service.AppsForYourDomainException(e.args[0])
|
||||
|
||||
GetAclFeed = get_acl_feed
|
||||
|
||||
def make_acl_entry_uri(self, domain=None, site=None, ruleId=None):
|
||||
return ACL_ENTRY_TEMPLATE % (domain, site, ruleId)
|
||||
|
||||
MakeAclEntryUri = make_acl_entry_uri
|
||||
|
||||
def create_acl_entry(self, aclentry=None, uri=None, domain=None, site=None,
|
||||
extra_headers=None, url_params=None, escape_params=True):
|
||||
|
||||
uri = uri or self.make_acl_feed_uri(domain=domain, site=site)
|
||||
try:
|
||||
return self.Post(aclentry, uri,
|
||||
url_params=url_params, extra_headers=extra_headers, escape_params=escape_params,
|
||||
converter=gdata.apps.sites.AclEntryFromString)
|
||||
except gdata.service.RequestError as e:
|
||||
raise gdata.apps.service.AppsForYourDomainException(e.args[0])
|
||||
|
||||
CreateAclEntry = create_acl_entry
|
||||
|
||||
def get_acl_entry(self, uri=None, domain=None, site=None, ruleId=None,
|
||||
extra_headers=None, url_params=None, escape_params=True):
|
||||
|
||||
uri = uri or self.make_acl_entry_uri(domain=domain, site=site, ruleId=ruleId)
|
||||
try:
|
||||
return self.Get(uri,
|
||||
url_params=url_params, extra_headers=extra_headers, escape_params=escape_params,
|
||||
converter=gdata.apps.sites.AclEntryFromString)
|
||||
except gdata.service.RequestError as e:
|
||||
raise gdata.apps.service.AppsForYourDomainException(e.args[0])
|
||||
|
||||
GetAclEntry = get_acl_entry
|
||||
|
||||
def update_acl_entry(self, aclentry=None, uri=None, domain=None, site=None, ruleId=None,
|
||||
extra_headers=None, url_params=None, escape_params=True):
|
||||
|
||||
uri = uri or self.make_acl_entry_uri(domain=domain, site=site, ruleId=ruleId)
|
||||
try:
|
||||
return self.Put(aclentry, uri,
|
||||
url_params=url_params, extra_headers=extra_headers, escape_params=escape_params,
|
||||
converter=gdata.apps.sites.AclEntryFromString)
|
||||
except gdata.service.RequestError as e:
|
||||
raise gdata.apps.service.AppsForYourDomainException(e.args[0])
|
||||
|
||||
UpdateAclEntry = update_acl_entry
|
||||
|
||||
def delete_acl_entry(self, uri=None, domain=None, site=None, ruleId=None,
|
||||
extra_headers=None, url_params=None, escape_params=True):
|
||||
|
||||
uri = uri or self.make_acl_entry_uri(domain=domain, site=site, ruleId=ruleId)
|
||||
try:
|
||||
return self.Delete(uri,
|
||||
url_params=url_params, escape_params=escape_params, extra_headers=extra_headers)
|
||||
except gdata.service.RequestError as e:
|
||||
raise gdata.apps.service.AppsForYourDomainException(e.args[0])
|
||||
|
||||
DeleteAclEntry = delete_acl_entry
|
||||
|
||||
def make_activity_feed_uri(self, domain=None, site=None):
|
||||
return ACTIVITY_FEED_TEMPLATE % (domain, site)
|
||||
|
||||
MakeActivityFeedUri = make_activity_feed_uri
|
||||
|
||||
def get_activity_feed(self, uri=None, domain=None, site=None,
|
||||
extra_headers=None, url_params=None, escape_params=True):
|
||||
|
||||
uri = uri or self.make_activity_feed_uri(domain=domain, site=site)
|
||||
try:
|
||||
return self.Get(uri,
|
||||
url_params=url_params, extra_headers=extra_headers, escape_params=escape_params,
|
||||
converter=gdata.apps.sites.ActivityFeedFromString)
|
||||
except gdata.service.RequestError as e:
|
||||
raise gdata.apps.service.AppsForYourDomainException(e.args[0])
|
||||
|
||||
GetActivityFeed = get_activity_feed
|
||||
|
||||
def make_activity_entry_uri(self, domain=None, site=None, activityId=None):
|
||||
return ACTIVITY_ENTRY_TEMPLATE % (domain, site, activityId)
|
||||
|
||||
MakeActivityEntryUri = make_activity_entry_uri
|
||||
|
||||
def get_activity_entry(self, uri=None, domain=None, site=None, activityId=None,
|
||||
extra_headers=None, url_params=None, escape_params=True):
|
||||
|
||||
uri = uri or self.make_activity_entry_uri(domain=domain, site=site, activityId=activityId)
|
||||
try:
|
||||
return self.Get(uri,
|
||||
url_params=url_params, extra_headers=extra_headers, escape_params=escape_params,
|
||||
converter=gdata.apps.sites.ActivityEntryFromString)
|
||||
except gdata.service.RequestError as e:
|
||||
raise gdata.apps.service.AppsForYourDomainException(e.args[0])
|
||||
|
||||
GetActivityEntry = get_activity_entry
|
||||
|
||||
class SitesQuery(gdata.service.Query):
|
||||
|
||||
def make_site_feed_uri(self, domain=None, site=None):
|
||||
if not domain:
|
||||
domain = 'site'
|
||||
if not site:
|
||||
return SITE_FEED_TEMPLATE % domain
|
||||
return (SITE_FEED_TEMPLATE % domain) + site
|
||||
|
||||
def __init__(self, feed=None, domain=None, site=None, params=None):
|
||||
self.feed = feed or self.make_site_feed_uri(domain=domain, site=site)
|
||||
gdata.service.Query.__init__(self, feed=self.feed, params=params)
|
||||
|
Loading…
x
Reference in New Issue
Block a user