MCPcopy
hub / github.com/eudicots/Cactus / upload

Method upload

cactus/deployment/file.py:115–145  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

113 return self.remote_changed()
114
115 def upload(self):
116
117 self.prepare()
118
119 # Plugins may actually update those values afterwards
120 self.cache_control = self.MAX_CACHE_EXPIRATION if self.is_fingerprinted else self.DEFAULT_CACHE_EXPIRATION
121 self.content_encoding = 'gzip' if self.is_compressed else None
122 self.content_length = len(self.payload())
123
124 self.engine.site.plugin_manager.preDeployFile(self)
125
126 remote_changed = self.remote_changed()
127
128 if remote_changed:
129 self.do_upload()
130
131 self.total_bytes_uploaded = self.total_bytes
132
133 op1 = '+' if remote_changed else '-'
134 op2 = ' (%s compressed)' % (fileSize(len(self.payload()))) if self.is_compressed else ''
135
136 # logger.warning("deploy.progress %s", self.engine.progress())
137
138 ipc.signal("deploy.progress", {
139 "progress": self.engine.progress(),
140 "fileName": self.path
141 })
142
143 logger.info('%s %s - %s%s' % (op1, self.path, fileSize(len(self.data())), op2))
144
145 return {'changed': remote_changed, 'size': len(self.payload())}
146
147 def __repr__(self):
148 return '<File: {0}>'.format(self.path)

Callers 7

test_cache_controlMethod · 0.45
test_no_bucket_createMethod · 0.45
test_simple_deployMethod · 0.45
test_compressionMethod · 0.45
deployMethod · 0.45

Calls 8

prepareMethod · 0.95
payloadMethod · 0.95
remote_changedMethod · 0.95
do_uploadMethod · 0.95
dataMethod · 0.95
fileSizeFunction · 0.90
progressMethod · 0.80
preDeployFileMethod · 0.45

Tested by 6

test_cache_controlMethod · 0.36
test_no_bucket_createMethod · 0.36
test_simple_deployMethod · 0.36
test_compressionMethod · 0.36